New container design

This commit is contained in:
Mustafa Buyukcelebi 2019-06-26 11:37:27 +03:00
parent 790abbe0cf
commit bce3778a0e
2 changed files with 57 additions and 16 deletions

View File

@ -140,24 +140,25 @@ class TransferContainer extends Component {
};
render() {
const { accounts, currentAccount, navigation } = this.props;
const { accounts, currentAccount, navigation, children } = this.props;
const { balance, fundType } = this.state;
const transferType = navigation.getParam('transferType', '');
return (
<TransferView
accounts={accounts}
fetchBalance={this.fetchBalance}
getAccountsWithUsername={this._getAccountsWithUsername}
transferToAccount={this._transferToAccount}
handleOnModalClose={this._handleOnModalClose}
accountType={currentAccount.local.authType}
currentAccountName={currentAccount.name}
balance={balance}
fundType={fundType}
transferType={transferType}
/>
children &&
children({
accounts,
balance,
fundType,
transferType,
fetchBalance: this.fetchBalance,
getAccountsWithUsername: this._getAccountsWithUsername,
transferToAccount: this._transferToAccount,
handleOnModalClose: this._handleOnModalClose,
accountType: currentAccount.local.authType,
currentAccountName: currentAccount.name,
})
);
}
}

View File

@ -1,5 +1,45 @@
import TransferScreen from './screen/transferScreen';
import Transfer from './container/transferContainer';
import React from 'react';
import TransferContainer from './container/transferContainer';
import TransferScreen from './screen/transferScreen';
const Transfer = ({ navigation }) => (
<TransferContainer navigation={navigation}>
{({
accounts,
balance,
fundType,
transferType,
fetchBalance,
getAccountsWithUsername,
transferToAccount,
handleOnModalClose,
accountType,
currentAccountName,
}) => {
switch (transferType) {
case 'transfer_token':
return (
<TransferScreen
accounts={accounts}
balance={balance}
fundType={fundType}
transferType={transferType}
fetchBalance={fetchBalance}
getAccountsWithUsername={getAccountsWithUsername}
transferToAccount={transferToAccount}
handleOnModalClose={handleOnModalClose}
accountType={accountType}
currentAccountName={currentAccountName}
/>
);
default:
return null;
}
}}
</TransferContainer>
);
export { TransferScreen, Transfer };
export default Transfer;