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