mirror of
https://github.com/ecency/ecency-mobile.git
synced 2024-12-22 12:51:42 +03:00
Completed transfer feature
This commit is contained in:
parent
8dc279088b
commit
045c1c2c9b
@ -9,6 +9,10 @@ export default EStyleSheet.create({
|
||||
flex: 1,
|
||||
padding: 10,
|
||||
justifyContent: 'center',
|
||||
color: '$primaryBlack',
|
||||
},
|
||||
text: {
|
||||
color: '$primaryBlack',
|
||||
},
|
||||
rightPart: {
|
||||
flex: 2,
|
||||
|
@ -9,7 +9,7 @@ import styles from './transferFormItemStyles';
|
||||
|
||||
const TransferFormItemView = ({ rightComponent, label }) => (
|
||||
<View style={styles.container}>
|
||||
<View style={styles.leftPart}>{label && <Text>{label}</Text>}</View>
|
||||
<View style={styles.leftPart}>{label && <Text style={styles.text}>{label}</Text>}</View>
|
||||
<View style={styles.rightPart}>{rightComponent && rightComponent()}</View>
|
||||
</View>
|
||||
);
|
||||
|
@ -27,11 +27,23 @@ class WalletContainer extends PureComponent {
|
||||
|
||||
// Component Functions
|
||||
_navigate = (transferType, fundType) => {
|
||||
const { dispatch, setPinCodeState } = this.props;
|
||||
const { dispatch, setPinCodeState, walletData } = this.props;
|
||||
let balance;
|
||||
|
||||
switch (fundType) {
|
||||
case 'STEEM':
|
||||
balance = Math.round(walletData.balance * 1000) / 1000;
|
||||
break;
|
||||
case 'SBD':
|
||||
balance = Math.round(walletData.sbdBalance * 1000) / 1000;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
setPinCodeState({
|
||||
navigateTo: ROUTES.SCREENS.TRANSFER,
|
||||
navigateParams: { transferType, fundType },
|
||||
navigateParams: { transferType, fundType, balance },
|
||||
});
|
||||
dispatch(openPinCodeModal());
|
||||
};
|
||||
|
@ -255,13 +255,14 @@
|
||||
"to": "To",
|
||||
"amount": "Amount",
|
||||
"memo": "Memo",
|
||||
"information": "1",
|
||||
"amount_desc": "amount desc",
|
||||
"information": "Are you sure to transfer to funds?",
|
||||
"amount_desc": "Balance",
|
||||
"memo_desc": "This memo is public",
|
||||
"to_placeholder": "3",
|
||||
"memo_placeholder": "4",
|
||||
"to_placeholder": "Username",
|
||||
"memo_placeholder": "Enter your notes here",
|
||||
"transferToken": "Transfer",
|
||||
"transferToSaving": "Transfer To Saving",
|
||||
"powerUp": "Power Up"
|
||||
"powerUp": "Power Up",
|
||||
"steemconnect_title": "Steemconnect Transfer"
|
||||
}
|
||||
}
|
||||
|
@ -92,7 +92,10 @@ class ExampleContainer extends Component {
|
||||
};
|
||||
|
||||
render() {
|
||||
const { accounts, currentAccount } = this.props;
|
||||
const { accounts, currentAccount, navigation } = this.props;
|
||||
|
||||
const fundType = navigation.getParam('fundType', '');
|
||||
const balance = navigation.getParam('balance', '');
|
||||
|
||||
return (
|
||||
<TransferView
|
||||
@ -101,6 +104,8 @@ class ExampleContainer extends Component {
|
||||
transferToAccount={this._transferToAccount}
|
||||
handleOnModalClose={this._handleOnModalClose}
|
||||
accountType={currentAccount.local.authType}
|
||||
balance={balance}
|
||||
fundType={fundType}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ class TransferView extends Component {
|
||||
|
||||
// Component Functions
|
||||
_setState = (key, value) => {
|
||||
const { getAccountsWithUsername } = this.props;
|
||||
const { getAccountsWithUsername, balance } = this.props;
|
||||
|
||||
if (key) {
|
||||
switch (key) {
|
||||
@ -52,7 +52,7 @@ class TransferView extends Component {
|
||||
this.setState({ [key]: value });
|
||||
break;
|
||||
case 'amount':
|
||||
if (!isNaN(value)) this.setState({ [key]: value });
|
||||
if (!isNaN(value) && parseFloat(value) <= parseFloat(balance)) this.setState({ [key]: value });
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -100,7 +100,7 @@ class TransferView extends Component {
|
||||
_renderDescription = text => <Text style={styles.description}>{text}</Text>;
|
||||
|
||||
render() {
|
||||
const { accounts, intl, handleOnModalClose } = this.props;
|
||||
const { accounts, intl, handleOnModalClose, balance, fundType } = this.props;
|
||||
const {
|
||||
destination, isUsernameValid, amount, steemConnectTransfer, memo,
|
||||
} = this.state;
|
||||
@ -140,11 +140,10 @@ class TransferView extends Component {
|
||||
/>
|
||||
<TransferFormItem
|
||||
label={intl.formatMessage({ id: 'transfer.amount' })}
|
||||
rightComponent={() => this._renderInput('Amount', 'amount')}
|
||||
rightComponent={() => this._renderInput(intl.formatMessage({ id: 'transfer.amount' }), 'amount')}
|
||||
/>
|
||||
<TransferFormItem
|
||||
rightComponent={() => this._renderDescription(intl.formatMessage({ id: 'transfer.amount_desc' }))
|
||||
}
|
||||
rightComponent={() => this._renderDescription(`${intl.formatMessage({ id: 'transfer.amount_desc' })} ${balance} ${fundType}`)}
|
||||
/>
|
||||
<TransferFormItem
|
||||
label={intl.formatMessage({ id: 'transfer.memo' })}
|
||||
@ -184,7 +183,7 @@ class TransferView extends Component {
|
||||
isFullScreen
|
||||
isCloseButton
|
||||
handleOnModalClose={handleOnModalClose}
|
||||
title="Steemconnect Transfer"
|
||||
title={intl.formatMessage({ id: 'transfer.steemconnect_title' })}
|
||||
>
|
||||
<WebView source={{ uri: `${steemConnectOptions.base_url}${path}` }} />
|
||||
</Modal>
|
||||
|
@ -28,6 +28,7 @@ export default EStyleSheet.create({
|
||||
borderColor: '$borderColor',
|
||||
borderRadius: 10,
|
||||
padding: 10,
|
||||
color: '$primaryBlack',
|
||||
},
|
||||
description: {
|
||||
color: '$iconColor',
|
||||
@ -39,7 +40,7 @@ export default EStyleSheet.create({
|
||||
alignItems: 'center',
|
||||
},
|
||||
buttonText: {
|
||||
color: '$white',
|
||||
color: 'white',
|
||||
},
|
||||
dropdown: {
|
||||
borderWidth: 1,
|
||||
|
Loading…
Reference in New Issue
Block a user