From 2d43a4df3d496ef1028db0bb40df6b32dbe0a99a Mon Sep 17 00:00:00 2001 From: Sadaqat Ali Date: Tue, 15 Feb 2022 13:16:27 +0500 Subject: [PATCH] fixed delegated amount not changing bug when from changes --- src/screens/transfer/screen/delegateScreen.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/screens/transfer/screen/delegateScreen.js b/src/screens/transfer/screen/delegateScreen.js index 2b603a840..1774727dd 100644 --- a/src/screens/transfer/screen/delegateScreen.js +++ b/src/screens/transfer/screen/delegateScreen.js @@ -69,6 +69,13 @@ class DelegateScreen extends Component { this.amountTextInput = React.createRef(); } + // Component Lifecycles + componentDidUpdate(prevProps, prevState) { + if (prevState.from !== this.state.from) { + this._fetchReceivedVestingShare(); + } + } + // Component Functions _setState = (key, value) => { const { getAccountsWithUsername, balance } = this.props; @@ -146,6 +153,10 @@ class DelegateScreen extends Component { this.setState({ delegatedHP: vestsToHp(vest_shares.amount, hivePerMVests).toFixed(3), }); + } else { + this.setState({ + delegatedHP: 0, + }); } } else { this.setState({