diff --git a/src/components/settingsItem/view/settingsItemView.js b/src/components/settingsItem/view/settingsItemView.js index ad523fdcc..1b9b09465 100644 --- a/src/components/settingsItem/view/settingsItemView.js +++ b/src/components/settingsItem/view/settingsItemView.js @@ -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 ( handleOnChange(null, type, actionType)} + onPress={() => handleOnButtonPress(actionType)} textStyle={styles.textStyle} style={styles.textButton} text={text} diff --git a/src/screens/settings/container/settingsContainer.js b/src/screens/settings/container/settingsContainer.js index bb01f05fa..8433b7e53 100644 --- a/src/screens/settings/container/settingsContainer.js +++ b/src/screens/settings/container/settingsContainer.js @@ -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; } @@ -229,18 +225,18 @@ class SettingsContainer extends Component { }); } }; - + _handleSendFeedback = async () => { const { dispatch, intl } = this.props; let message; - await sendEmail( + await sendEmail( 'bug@esteem.app', 'Feedback/Bug report', `Write your message here! - App version: ${VersionNumber.buildVersion} - Platform: ${Platform.OS === 'ios' ? 'IOS' : 'Android'} - Device: ${DeviceInfo.getDeviceName()}`, + + App version: ${VersionNumber.buildVersion} + Platform: ${Platform.OS === 'ios' ? 'IOS' : 'Android'}`, ) .then(() => { message = 'settings.feedback_success'; @@ -249,7 +245,7 @@ class SettingsContainer extends Component { message = 'settings.feedback_fail'; }); - if (message) { + if (message) { dispatch( toastNotification( intl.formatMessage({ @@ -267,6 +263,7 @@ class SettingsContainer extends Component { ); diff --git a/src/screens/settings/screen/settingsScreen.js b/src/screens/settings/screen/settingsScreen.js index 20d740a7f..c4962a086 100644 --- a/src/screens/settings/screen/settingsScreen.js +++ b/src/screens/settings/screen/settingsScreen.js @@ -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({ - id: item, - }))} + options={NSFW.map(item => + intl.formatMessage({ + id: item, + }), + )} selectedOptionIndex={parseInt(nsfw, 10)} handleOnChange={handleOnChange} /> @@ -118,26 +121,6 @@ class SettingsScreen extends PureComponent { /> {!!isLoggedIn && ( - - )} + );