Fix InputBalance default display (#1880)
This commit is contained in:
parent
6a92aea32b
commit
be039f9d5a
@ -243,8 +243,8 @@ class Vote extends TxModal<Props, State> {
|
||||
);
|
||||
}
|
||||
|
||||
private setVoteValue = (voteValue?: BN): void => {
|
||||
this.setState({ voteValue: voteValue || new BN(0) });
|
||||
private setVoteValue = (voteValue: BN): void => {
|
||||
this.setState({ voteValue });
|
||||
}
|
||||
|
||||
private fetchApprovals = (accountId: string | null): void => {
|
||||
|
||||
@ -50,7 +50,7 @@ function VoteValue ({ accountId, allBalances, onChange, t }: Props): React.React
|
||||
}
|
||||
}, [accountId, selectedId, allBalances]);
|
||||
|
||||
// only do onChange to parent when the BN value comes in, not our formatted version
|
||||
// only do onChange to parent when the BN value comes in, not our formatted version
|
||||
useEffect((): void => {
|
||||
isBn(value) && onChange(value);
|
||||
}, [value]);
|
||||
|
||||
@ -34,7 +34,7 @@ const DEFAULT_BITLENGTH = BitLengthOption.CHAIN_SPEC as BitLength;
|
||||
|
||||
function InputBalance ({ autoFocus, className, defaultValue: inDefault, help, isDisabled, isError, isZeroable, label, labelExtra, maxValue, onChange, onEnter, placeholder, style, value, withEllipsis, withLabel, withMax }: Props): React.ReactElement<Props> {
|
||||
const defaultValue = inDefault
|
||||
? formatBalance(value, { forceUnit: '-', withSi: false })
|
||||
? formatBalance(inDefault, { forceUnit: '-', withSi: false }).replace(',', isDisabled ? ',' : '')
|
||||
: inDefault;
|
||||
|
||||
return (
|
||||
|
||||
Loading…
Reference in New Issue
Block a user