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() { render() {
const { accounts, currentAccount, navigation } = this.props; const { accounts, currentAccount, navigation, children } = this.props;
const { balance, fundType } = this.state; const { balance, fundType } = this.state;
const transferType = navigation.getParam('transferType', ''); const transferType = navigation.getParam('transferType', '');
return ( return (
<TransferView children &&
accounts={accounts} children({
fetchBalance={this.fetchBalance} accounts,
getAccountsWithUsername={this._getAccountsWithUsername} balance,
transferToAccount={this._transferToAccount} fundType,
handleOnModalClose={this._handleOnModalClose} transferType,
accountType={currentAccount.local.authType} fetchBalance: this.fetchBalance,
currentAccountName={currentAccount.name} getAccountsWithUsername: this._getAccountsWithUsername,
balance={balance} transferToAccount: this._transferToAccount,
fundType={fundType} handleOnModalClose: this._handleOnModalClose,
transferType={transferType} accountType: currentAccount.local.authType,
/> currentAccountName: currentAccount.name,
})
); );
} }
} }

View File

@ -1,5 +1,45 @@
import TransferScreen from './screen/transferScreen'; import React from 'react';
import Transfer from './container/transferContainer';
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; export default Transfer;