fixed weird confilit bugs

This commit is contained in:
u-e 2019-03-20 23:28:59 +03:00
parent 86de8fe00e
commit 51cbd46f7d
3 changed files with 32 additions and 40 deletions

View File

@ -34,6 +34,7 @@ class SettingsItemView extends PureComponent {
isOn,
actionType,
defaultText,
handleOnButtonPress,
} = this.props;
switch (type) {
@ -64,7 +65,7 @@ class SettingsItemView extends PureComponent {
case 'button':
return (
<TextButton
onPress={() => handleOnChange(null, type, actionType)}
onPress={() => handleOnButtonPress(actionType)}
textStyle={styles.textStyle}
style={styles.textButton}
text={text}

View File

@ -90,10 +90,6 @@ class SettingsContainer extends Component {
setNsfw2DB(action);
break;
case 'feedback':
this._handleSendFeedback();
break;
default:
break;
}
@ -180,13 +176,17 @@ class SettingsContainer extends Component {
this._setPushToken();
};
_handleButtonPress = (action, actionType) => {
_handleButtonPress = (actionType) => {
const { dispatch, setPinCodeState } = this.props;
switch (actionType) {
case 'pincode':
setPinCodeState({ isReset: true });
dispatch(openPinCodeModal());
break;
case 'feedback':
this._handleSendFeedback();
break;
default:
break;
}
@ -202,10 +202,6 @@ class SettingsContainer extends Component {
this._handleToggleChanged(action, actionType);
break;
case 'button':
this._handleButtonPress(action, actionType);
break;
default:
break;
}
@ -238,9 +234,9 @@ class SettingsContainer extends Component {
'bug@esteem.app',
'Feedback/Bug report',
`Write your message here!
App version: ${VersionNumber.buildVersion}
Platform: ${Platform.OS === 'ios' ? 'IOS' : 'Android'}
Device: ${DeviceInfo.getDeviceName()}`,
Platform: ${Platform.OS === 'ios' ? 'IOS' : 'Android'}`,
)
.then(() => {
message = 'settings.feedback_success';
@ -267,6 +263,7 @@ class SettingsContainer extends Component {
<SettingsScreen
serverList={serverList}
handleOnChange={this._handleOnChange}
handleOnButtonPress={this._handleButtonPress}
{...this.props}
/>
);

View File

@ -44,6 +44,7 @@ class SettingsScreen extends PureComponent {
selectedCurrency,
selectedLanguage,
serverList,
handleOnButtonPress,
} = this.props;
return (
@ -92,9 +93,11 @@ class SettingsScreen extends PureComponent {
})}
type="dropdown"
actionType="nsfw"
options={NSFW.map(item => intl.formatMessage({
options={NSFW.map(item =>
intl.formatMessage({
id: item,
}))}
}),
)}
selectedOptionIndex={parseInt(nsfw, 10)}
handleOnChange={handleOnChange}
/>
@ -118,26 +121,6 @@ class SettingsScreen extends PureComponent {
/>
{!!isLoggedIn && (
<Fragment>
<SettingsItem
title={intl.formatMessage({
id: 'settings.pincode',
})}
text={intl.formatMessage({
id: 'settings.reset',
})}
type="button"
actionType="pincode"
handleOnChange={handleOnChange}
/>
<SettingsItem
title={intl.formatMessage({
id: 'settings.send_feedback',
})}
text={intl.formatMessage({
id: 'settings.send',
})}
type="button"
actionType="feedback"
{/* <SettingsItem
title={intl.formatMessage({
id: 'settings.default_footer',
@ -156,10 +139,21 @@ class SettingsScreen extends PureComponent {
})}
type="button"
actionType="pincode"
handleOnChange={handleOnChange}
handleOnButtonPress={handleOnButtonPress}
/>
</Fragment>
)}
<SettingsItem
title={intl.formatMessage({
id: 'settings.send_feedback',
})}
text={intl.formatMessage({
id: 'settings.send',
})}
type="button"
actionType="feedback"
handleOnButtonPress={handleOnButtonPress}
/>
</ScrollView>
</View>
);