mirror of
https://github.com/ecency/ecency-mobile.git
synced 2024-11-29 22:07:46 +03:00
set user in delegation screen when redirected from refer screen
This commit is contained in:
parent
c339895faa
commit
a338d362df
@ -39,6 +39,7 @@ class TransferContainer extends Component {
|
|||||||
balance: props.navigation.getParam('balance', ''),
|
balance: props.navigation.getParam('balance', ''),
|
||||||
tokenAddress: props.navigation.getParam('tokenAddress', ''),
|
tokenAddress: props.navigation.getParam('tokenAddress', ''),
|
||||||
transferType: props.navigation.getParam('transferType', ''),
|
transferType: props.navigation.getParam('transferType', ''),
|
||||||
|
referredUsername: props.navigation.getParam('referredUsername'),
|
||||||
selectedAccount: props.currentAccount,
|
selectedAccount: props.currentAccount,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -230,7 +231,7 @@ class TransferContainer extends Component {
|
|||||||
actionModalVisible,
|
actionModalVisible,
|
||||||
dispatch,
|
dispatch,
|
||||||
} = this.props;
|
} = this.props;
|
||||||
const { balance, fundType, selectedAccount, tokenAddress } = this.state;
|
const { balance, fundType, selectedAccount, tokenAddress, referredUsername } = this.state;
|
||||||
|
|
||||||
const transferType = navigation.getParam('transferType', '');
|
const transferType = navigation.getParam('transferType', '');
|
||||||
|
|
||||||
@ -246,6 +247,7 @@ class TransferContainer extends Component {
|
|||||||
selectedAccount,
|
selectedAccount,
|
||||||
hivePerMVests,
|
hivePerMVests,
|
||||||
actionModalVisible,
|
actionModalVisible,
|
||||||
|
referredUsername,
|
||||||
fetchBalance: this.fetchBalance,
|
fetchBalance: this.fetchBalance,
|
||||||
getAccountsWithUsername: this._getAccountsWithUsername,
|
getAccountsWithUsername: this._getAccountsWithUsername,
|
||||||
transferToAccount: this._transferToAccount,
|
transferToAccount: this._transferToAccount,
|
||||||
|
@ -53,11 +53,11 @@ const ReferScreen = ({ navigation }) => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const _handleDelegateHP = () => {
|
const _handleDelegateHP = (item: Referral) => {
|
||||||
console.log('delegate HP!');
|
console.log('delegate HP!');
|
||||||
navigate({
|
navigate({
|
||||||
routeName: ROUTES.SCREENS.TRANSFER,
|
routeName: ROUTES.SCREENS.TRANSFER,
|
||||||
params: { transferType: 'delegate', fundType: 'HIVE_POWER' },
|
params: { transferType: 'delegate', fundType: 'HIVE_POWER', referredUsername: item.referredUsername },
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
const _renderPointsEarned = () => {
|
const _renderPointsEarned = () => {
|
||||||
@ -121,9 +121,9 @@ const ReferScreen = ({ navigation }) => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const _rightItemRenderer = () => {
|
const _rightItemRenderer = (item:Referral) => {
|
||||||
return (
|
return (
|
||||||
<TouchableOpacity style={styles.rightItemRendererContainer} onPress={_handleDelegateHP}>
|
<TouchableOpacity style={styles.rightItemRendererContainer} onPress={() => _handleDelegateHP(item)}>
|
||||||
<Text style={styles.rightItemText}>
|
<Text style={styles.rightItemText}>
|
||||||
{intl.formatMessage({
|
{intl.formatMessage({
|
||||||
id: 'refer.delegate_hp',
|
id: 'refer.delegate_hp',
|
||||||
@ -144,7 +144,7 @@ const ReferScreen = ({ navigation }) => {
|
|||||||
isBlackRightColor
|
isBlackRightColor
|
||||||
isLoggedIn
|
isLoggedIn
|
||||||
leftItemRenderer={() => _leftItemRenderer(item)}
|
leftItemRenderer={() => _leftItemRenderer(item)}
|
||||||
rightItemRenderer={_rightItemRenderer}
|
rightItemRenderer={() => _rightItemRenderer(item)}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
@ -25,6 +25,7 @@ const Transfer = ({ navigation }) => (
|
|||||||
actionModalVisible,
|
actionModalVisible,
|
||||||
setWithdrawVestingRoute,
|
setWithdrawVestingRoute,
|
||||||
dispatch,
|
dispatch,
|
||||||
|
referredUsername,
|
||||||
}) => {
|
}) => {
|
||||||
switch (transferType) {
|
switch (transferType) {
|
||||||
case 'transfer_token':
|
case 'transfer_token':
|
||||||
@ -65,6 +66,7 @@ const Transfer = ({ navigation }) => (
|
|||||||
hivePerMVests={hivePerMVests}
|
hivePerMVests={hivePerMVests}
|
||||||
actionModalVisible={actionModalVisible}
|
actionModalVisible={actionModalVisible}
|
||||||
dispatch={dispatch}
|
dispatch={dispatch}
|
||||||
|
referredUsername={referredUsername}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
case 'power_down':
|
case 'power_down':
|
||||||
|
@ -70,6 +70,16 @@ class DelegateScreen extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Component Lifecycles
|
// 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) {
|
componentDidUpdate(prevProps, prevState) {
|
||||||
if (prevState.from !== this.state.from) {
|
if (prevState.from !== this.state.from) {
|
||||||
this._fetchReceivedVestingShare();
|
this._fetchReceivedVestingShare();
|
||||||
|
Loading…
Reference in New Issue
Block a user