Adjust logic for NoneField
This commit is contained in:
parent
92924524dd
commit
8e8b5e5e30
|
@ -12,6 +12,7 @@ import './NonceField.scss';
|
|||
|
||||
interface OwnProps {
|
||||
alwaysDisplay: boolean;
|
||||
showInvalidBeforeBlur?: boolean;
|
||||
}
|
||||
|
||||
interface StateProps {
|
||||
|
@ -27,7 +28,13 @@ type Props = OwnProps & DispatchProps & StateProps;
|
|||
|
||||
class NonceField extends React.Component<Props> {
|
||||
public render() {
|
||||
const { alwaysDisplay, requestNonce, noncePending, isOffline } = this.props;
|
||||
const {
|
||||
alwaysDisplay,
|
||||
showInvalidBeforeBlur,
|
||||
requestNonce,
|
||||
noncePending,
|
||||
isOffline
|
||||
} = this.props;
|
||||
return (
|
||||
<NonceFieldFactory
|
||||
withProps={({ nonce: { raw, value }, onChange, readOnly, shouldDisplay }) => {
|
||||
|
@ -51,6 +58,7 @@ class NonceField extends React.Component<Props> {
|
|||
onChange={onChange}
|
||||
disabled={noncePending}
|
||||
showInvalidWithoutValue={true}
|
||||
showInvalidBeforeBlur={showInvalidBeforeBlur}
|
||||
/>
|
||||
{noncePending ? (
|
||||
<div className="Nonce-spinner">
|
||||
|
|
|
@ -106,7 +106,7 @@ class AdvancedGas extends React.Component<Props, State> {
|
|||
)}
|
||||
{nonceField && (
|
||||
<div className="AdvancedGas-nonce">
|
||||
<NonceField alwaysDisplay={true} />
|
||||
<NonceField alwaysDisplay={true} showInvalidBeforeBlur={true} />
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
|
|
@ -49,7 +49,7 @@ class Input extends React.Component<Props, State> {
|
|||
} else if (!hasBlurred && !showInvalidBeforeBlur) {
|
||||
validClass = '';
|
||||
}
|
||||
if (!isStateless && !hasValue && showInvalidWithoutValue) {
|
||||
if ((!isStateless || showInvalidBeforeBlur) && !hasValue && showInvalidWithoutValue) {
|
||||
validClass = 'invalid';
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue