mirror of
https://github.com/ecency/ecency-mobile.git
synced 2024-12-21 12:21:31 +03:00
Fixed some issues
This commit is contained in:
parent
274817dce3
commit
a082388735
@ -37,7 +37,6 @@ class SettingsScreen extends PureComponent {
|
||||
handleOnChange,
|
||||
intl,
|
||||
isDarkTheme,
|
||||
isDefaultFooter,
|
||||
isLoggedIn,
|
||||
isNotificationSettingsOpen,
|
||||
nsfw,
|
||||
@ -71,6 +70,15 @@ class SettingsScreen extends PureComponent {
|
||||
})}
|
||||
titleStyle={styles.cardTitle}
|
||||
/>
|
||||
<SettingsItem
|
||||
title={intl.formatMessage({
|
||||
id: 'settings.dark_theme',
|
||||
})}
|
||||
type="toggle"
|
||||
actionType="theme"
|
||||
isOn={isDarkTheme}
|
||||
handleOnChange={handleOnChange}
|
||||
/>
|
||||
<SettingsItem
|
||||
title={intl.formatMessage({
|
||||
id: 'settings.currency',
|
||||
@ -114,26 +122,6 @@ class SettingsScreen extends PureComponent {
|
||||
selectedOptionIndex={parseInt(nsfw, 10)}
|
||||
handleOnChange={handleOnChange}
|
||||
/>
|
||||
<SettingsItem
|
||||
title={intl.formatMessage({
|
||||
id: 'settings.dark_theme',
|
||||
})}
|
||||
type="toggle"
|
||||
actionType="theme"
|
||||
isOn={isDarkTheme}
|
||||
handleOnChange={handleOnChange}
|
||||
/>
|
||||
<SettingsItem
|
||||
title={intl.formatMessage({
|
||||
id: 'settings.send_feedback',
|
||||
})}
|
||||
text={intl.formatMessage({
|
||||
id: 'settings.send',
|
||||
})}
|
||||
type="button"
|
||||
actionType="feedback"
|
||||
handleOnButtonPress={handleOnButtonPress}
|
||||
/>
|
||||
{!!isLoggedIn && (
|
||||
<Fragment>
|
||||
<SettingsItem
|
||||
@ -173,7 +161,7 @@ class SettingsScreen extends PureComponent {
|
||||
isOn={isNotificationSettingsOpen}
|
||||
handleOnChange={handleOnChange}
|
||||
/>
|
||||
)}
|
||||
)}
|
||||
noBorder
|
||||
fitContent
|
||||
locked
|
||||
@ -237,6 +225,19 @@ class SettingsScreen extends PureComponent {
|
||||
</CollapsibleCard>
|
||||
</View>
|
||||
)}
|
||||
<View style={[styles.settingsCard, styles.paddingBottom]}>
|
||||
<SettingsItem
|
||||
title={intl.formatMessage({
|
||||
id: 'settings.send_feedback',
|
||||
})}
|
||||
text={intl.formatMessage({
|
||||
id: 'settings.send',
|
||||
})}
|
||||
type="button"
|
||||
actionType="feedback"
|
||||
handleOnButtonPress={handleOnButtonPress}
|
||||
/>
|
||||
</View>
|
||||
</ScrollView>
|
||||
</Fragment>
|
||||
);
|
||||
|
@ -13,4 +13,7 @@ export default EStyleSheet.create({
|
||||
cardTitle: {
|
||||
color: '$primaryBlue',
|
||||
},
|
||||
paddingBottom: {
|
||||
paddingBottom: 20,
|
||||
},
|
||||
});
|
||||
|
@ -12,6 +12,9 @@ import {
|
||||
} from '../../../providers/steem/dsteem';
|
||||
import { toastNotification } from '../../../redux/actions/uiAction';
|
||||
|
||||
// Utils
|
||||
import { countDecimals } from '../../../utils/number';
|
||||
|
||||
// Component
|
||||
import TransferView from '../screen/transferScreen';
|
||||
|
||||
@ -78,6 +81,11 @@ class TransferContainer extends Component {
|
||||
amount,
|
||||
memo,
|
||||
};
|
||||
|
||||
if (countDecimals(Number(data.amount)) < 3) {
|
||||
data.amount = Number(data.amount).toFixed(3);
|
||||
}
|
||||
|
||||
data.amount = `${data.amount} ${fundType}`;
|
||||
|
||||
switch (transferType) {
|
||||
|
@ -1,6 +1,8 @@
|
||||
/* eslint-disable no-restricted-globals */
|
||||
import React, { Fragment, Component } from 'react';
|
||||
import { Text, View, WebView, ScrollView } from 'react-native';
|
||||
import {
|
||||
Text, View, WebView, ScrollView, TouchableOpacity,
|
||||
} from 'react-native';
|
||||
import ActionSheet from 'react-native-actionsheet';
|
||||
import { injectIntl } from 'react-intl';
|
||||
|
||||
@ -45,7 +47,7 @@ class TransferView extends Component {
|
||||
if (key) {
|
||||
switch (key) {
|
||||
case 'destination':
|
||||
getAccountsWithUsername(value).then(res => {
|
||||
getAccountsWithUsername(value).then((res) => {
|
||||
const isValid = res.includes(value);
|
||||
|
||||
this.setState({ isUsernameValid: isValid });
|
||||
@ -67,7 +69,9 @@ class TransferView extends Component {
|
||||
|
||||
_handleTransferAction = () => {
|
||||
const { transferToAccount, accountType } = this.props;
|
||||
const { from, destination, amount, memo } = this.state;
|
||||
const {
|
||||
from, destination, amount, memo,
|
||||
} = this.state;
|
||||
|
||||
this.setState({ isTransfering: true });
|
||||
|
||||
@ -79,7 +83,7 @@ class TransferView extends Component {
|
||||
};
|
||||
|
||||
_handleOnAmountChange = (state, amount) => {
|
||||
let _amount = amount;
|
||||
let _amount = amount.toString();
|
||||
if (_amount.includes(',')) {
|
||||
_amount = amount.replace(',', '.');
|
||||
}
|
||||
@ -160,47 +164,47 @@ class TransferView extends Component {
|
||||
/>
|
||||
<TransferFormItem
|
||||
label={intl.formatMessage({ id: 'transfer.to' })}
|
||||
rightComponent={() =>
|
||||
this._renderInput(
|
||||
intl.formatMessage({ id: 'transfer.to_placeholder' }),
|
||||
'destination',
|
||||
'default',
|
||||
)
|
||||
rightComponent={() => this._renderInput(
|
||||
intl.formatMessage({ id: 'transfer.to_placeholder' }),
|
||||
'destination',
|
||||
'default',
|
||||
)
|
||||
}
|
||||
/>
|
||||
<TransferFormItem
|
||||
label={intl.formatMessage({ id: 'transfer.amount' })}
|
||||
rightComponent={() =>
|
||||
this._renderInput(
|
||||
intl.formatMessage({ id: 'transfer.amount' }),
|
||||
'amount',
|
||||
'numeric',
|
||||
)
|
||||
rightComponent={() => this._renderInput(
|
||||
intl.formatMessage({ id: 'transfer.amount' }),
|
||||
'amount',
|
||||
'numeric',
|
||||
)
|
||||
}
|
||||
/>
|
||||
<TransferFormItem
|
||||
rightComponent={() =>
|
||||
this._renderDescription(
|
||||
`${intl.formatMessage({
|
||||
id: 'transfer.amount_desc',
|
||||
})} ${balance} ${fundType}`,
|
||||
)
|
||||
}
|
||||
rightComponent={() => (
|
||||
<TouchableOpacity onPress={() => this._handleOnAmountChange('amount', balance)}>
|
||||
{this._renderDescription(
|
||||
`${intl.formatMessage({
|
||||
id: 'transfer.amount_desc',
|
||||
})} ${balance} ${fundType}`,
|
||||
)}
|
||||
|
||||
</TouchableOpacity>
|
||||
)
|
||||
}
|
||||
/>
|
||||
<TransferFormItem
|
||||
label={intl.formatMessage({ id: 'transfer.memo' })}
|
||||
rightComponent={() =>
|
||||
this._renderInput(
|
||||
intl.formatMessage({ id: 'transfer.memo_placeholder' }),
|
||||
'memo',
|
||||
'default',
|
||||
true,
|
||||
)
|
||||
rightComponent={() => this._renderInput(
|
||||
intl.formatMessage({ id: 'transfer.memo_placeholder' }),
|
||||
'memo',
|
||||
'default',
|
||||
true,
|
||||
)
|
||||
}
|
||||
/>
|
||||
<TransferFormItem
|
||||
rightComponent={() =>
|
||||
this._renderDescription(intl.formatMessage({ id: 'transfer.memo_desc' }))
|
||||
rightComponent={() => this._renderDescription(intl.formatMessage({ id: 'transfer.memo_desc' }))
|
||||
}
|
||||
/>
|
||||
</View>
|
||||
@ -225,7 +229,7 @@ class TransferView extends Component {
|
||||
title={intl.formatMessage({ id: 'transfer.information' })}
|
||||
cancelButtonIndex={1}
|
||||
destructiveButtonIndex={0}
|
||||
onPress={index => {
|
||||
onPress={(index) => {
|
||||
index === 0 ? this._handleTransferAction() : null;
|
||||
}}
|
||||
/>
|
||||
|
4
src/utils/number.js
Normal file
4
src/utils/number.js
Normal file
@ -0,0 +1,4 @@
|
||||
export const countDecimals = (value) => {
|
||||
if (Math.floor(value) === value) return 0;
|
||||
return value.toString().split('.')[1].length || 0;
|
||||
};
|
Loading…
Reference in New Issue
Block a user