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