Fix update keywords field on Android (#2229)

This commit is contained in:
Elias Nahum 2018-10-09 11:56:35 -03:00
parent 2e5f7fd60c
commit 3ea3fe7e2f
No known key found for this signature in database
GPG key ID: E038DB71E0B61702
2 changed files with 11 additions and 10 deletions

View file

@ -53,19 +53,19 @@ export default class NotificationSettingsMentionsBase extends PureComponent {
}
const comments = notifyProps.comments || 'any';
const mentionKeysString = mentionKeys.join(',');
const newState = {
...notifyProps,
comments,
newReplyValue: comments,
usernameMention: usernameMentionIndex > -1,
mention_keys: mentionKeys.join(','),
mention_keys: mentionKeysString,
androidKeywords: mentionKeysString,
showKeywordsModal: false,
showReplyModal: false,
};
this.keywords = newState.mention_keys;
return newState;
};

View file

@ -23,8 +23,10 @@ import NotificationSettingsMentionsBase from './notification_settings_mention_ba
class NotificationSettingsMentionsAndroid extends NotificationSettingsMentionsBase {
cancelMentionKeys = () => {
this.setState({showKeywordsModal: false});
this.keywords = this.state.mention_keys;
this.setState({
androidKeywords: this.state.mention_keys,
showKeywordsModal: false,
});
};
cancelReplyNotification = () => {
@ -34,8 +36,8 @@ class NotificationSettingsMentionsAndroid extends NotificationSettingsMentionsBa
});
};
onKeywordsChangeText = (value) => {
this.keywords = value;
onKeywordsChangeText = (androidKeywords) => {
this.setState({androidKeywords});
};
onReplyChanged = (value) => {
@ -64,7 +66,7 @@ class NotificationSettingsMentionsAndroid extends NotificationSettingsMentionsBa
</View>
<TextInputWithLocalizedPlaceholder
autoFocus={true}
value={this.keywords}
value={this.state.androidKeywords}
blurOnSubmit={true}
onChangeText={this.onKeywordsChangeText}
onSubmitEditing={this.saveMentionKeys}
@ -243,8 +245,7 @@ class NotificationSettingsMentionsAndroid extends NotificationSettingsMentionsBa
}
saveMentionKeys = () => {
this.setState({showKeywordsModal: false});
this.updateMentionKeys(this.keywords);
this.updateMentionKeys(this.state.androidKeywords);
};
saveReplyNotification = () => {