From 8e11eabababed7e64530ebd3f0ea6a5f1d07b380 Mon Sep 17 00:00:00 2001 From: Laurent Cozic Date: Tue, 22 Sep 2020 16:01:00 +0100 Subject: [PATCH] Android: Fixes #3797: Disable beta editor even if it was already enabled --- ReactNativeClient/lib/components/screens/note.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/ReactNativeClient/lib/components/screens/note.js b/ReactNativeClient/lib/components/screens/note.js index 599a9f7063..35f4bd6dde 100644 --- a/ReactNativeClient/lib/components/screens/note.js +++ b/ReactNativeClient/lib/components/screens/note.js @@ -208,6 +208,10 @@ class NoteScreenComponent extends BaseScreenComponent { } }; + this.useBetaEditor = () => { + return Setting.value('editor.beta') && Platform.OS !== 'android'; + }; + this.takePhoto_onPress = this.takePhoto_onPress.bind(this); this.cameraView_onPhoto = this.cameraView_onPhoto.bind(this); this.cameraView_onCancel = this.cameraView_onCancel.bind(this); @@ -644,7 +648,7 @@ class NoteScreenComponent extends BaseScreenComponent { const newNote = Object.assign({}, this.state.note); - if (this.state.mode == 'edit' && !Setting.value('editor.beta') && !!this.selection) { + if (this.state.mode == 'edit' && !this.useBetaEditor() && !!this.selection) { const prefix = newNote.body.substring(0, this.selection.start); const suffix = newNote.body.substring(this.selection.end); newNote.body = `${prefix}\n${resourceTag}\n${suffix}`; @@ -966,7 +970,7 @@ class NoteScreenComponent extends BaseScreenComponent { } let bodyComponent = null; - if (this.state.mode == 'view' && !Setting.value('editor.beta')) { + if (this.state.mode == 'view' && !this.useBetaEditor()) { const onCheckboxChange = newBody => { this.saveOneProperty('body', newBody); }; @@ -1021,7 +1025,7 @@ class NoteScreenComponent extends BaseScreenComponent { this.saveOneProperty('body', newBody); }; - bodyComponent = Setting.value('editor.beta') + bodyComponent = this.useBetaEditor() // Note: blurOnSubmit is necessary to get multiline to work. // See https://github.com/facebook/react-native/issues/12717#issuecomment-327001997 ? {titleComp} {bodyComponent} - {!Setting.value('editor.beta') && actionButtonComp} + {!this.useBetaEditor() && actionButtonComp}