diff --git a/src/containers/transferContainer.js b/src/containers/transferContainer.js index 7f4cda0cc..9d795c60b 100644 --- a/src/containers/transferContainer.js +++ b/src/containers/transferContainer.js @@ -39,6 +39,7 @@ class TransferContainer extends Component { balance: props.navigation.getParam('balance', ''), tokenAddress: props.navigation.getParam('tokenAddress', ''), transferType: props.navigation.getParam('transferType', ''), + referredUsername: props.navigation.getParam('referredUsername'), selectedAccount: props.currentAccount, }; } @@ -230,7 +231,7 @@ class TransferContainer extends Component { actionModalVisible, dispatch, } = this.props; - const { balance, fundType, selectedAccount, tokenAddress } = this.state; + const { balance, fundType, selectedAccount, tokenAddress, referredUsername } = this.state; const transferType = navigation.getParam('transferType', ''); @@ -246,6 +247,7 @@ class TransferContainer extends Component { selectedAccount, hivePerMVests, actionModalVisible, + referredUsername, fetchBalance: this.fetchBalance, getAccountsWithUsername: this._getAccountsWithUsername, transferToAccount: this._transferToAccount, diff --git a/src/screens/referScreen/referScreen.tsx b/src/screens/referScreen/referScreen.tsx index 8d5558f63..db69e92c3 100644 --- a/src/screens/referScreen/referScreen.tsx +++ b/src/screens/referScreen/referScreen.tsx @@ -53,11 +53,11 @@ const ReferScreen = ({ navigation }) => { }); }; - const _handleDelegateHP = () => { + const _handleDelegateHP = (item: Referral) => { console.log('delegate HP!'); navigate({ routeName: ROUTES.SCREENS.TRANSFER, - params: { transferType: 'delegate', fundType: 'HIVE_POWER' }, + params: { transferType: 'delegate', fundType: 'HIVE_POWER', referredUsername: item.referredUsername }, }); }; const _renderPointsEarned = () => { @@ -121,9 +121,9 @@ const ReferScreen = ({ navigation }) => { ); }; - const _rightItemRenderer = () => { + const _rightItemRenderer = (item:Referral) => { return ( - + _handleDelegateHP(item)}> {intl.formatMessage({ id: 'refer.delegate_hp', @@ -144,7 +144,7 @@ const ReferScreen = ({ navigation }) => { isBlackRightColor isLoggedIn leftItemRenderer={() => _leftItemRenderer(item)} - rightItemRenderer={_rightItemRenderer} + rightItemRenderer={() => _rightItemRenderer(item)} /> ); }; diff --git a/src/screens/transfer/index.js b/src/screens/transfer/index.js index 6baafdef1..7172abe80 100644 --- a/src/screens/transfer/index.js +++ b/src/screens/transfer/index.js @@ -25,6 +25,7 @@ const Transfer = ({ navigation }) => ( actionModalVisible, setWithdrawVestingRoute, dispatch, + referredUsername, }) => { switch (transferType) { case 'transfer_token': @@ -65,6 +66,7 @@ const Transfer = ({ navigation }) => ( hivePerMVests={hivePerMVests} actionModalVisible={actionModalVisible} dispatch={dispatch} + referredUsername={referredUsername} /> ); case 'power_down': diff --git a/src/screens/transfer/screen/delegateScreen.js b/src/screens/transfer/screen/delegateScreen.js index 2c29ec6e5..a79341729 100644 --- a/src/screens/transfer/screen/delegateScreen.js +++ b/src/screens/transfer/screen/delegateScreen.js @@ -70,6 +70,16 @@ class DelegateScreen extends Component { } // Component Lifecycles + componentDidMount() { + const { referredUsername } = this.props; + if (referredUsername) { + console.log('----referredUsername---- : ', referredUsername); + this.setState({ destination: referredUsername, usersResult: [], step: 2 }, () => { + this._fetchReceivedVestingShare(); + }); + this.destinationTextInput.current?.blur(); + } + } componentDidUpdate(prevProps, prevState) { if (prevState.from !== this.state.from) { this._fetchReceivedVestingShare();