From 67ebe8fbd2bc7b87d58263119068aa92d6dab9d3 Mon Sep 17 00:00:00 2001 From: Mustafa Buyukcelebi Date: Mon, 2 Dec 2019 17:39:49 +0300 Subject: [PATCH] Fix for editor selection issue --- .eslintrc.js | 4 ---- .eslintrc.json | 5 +++-- .../markdownEditor/view/markdownEditorView.js | 10 +++++----- 3 files changed, 8 insertions(+), 11 deletions(-) delete mode 100644 .eslintrc.js diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 40c6dcd05..000000000 --- a/.eslintrc.js +++ /dev/null @@ -1,4 +0,0 @@ -module.exports = { - root: true, - extends: '@react-native-community', -}; diff --git a/.eslintrc.json b/.eslintrc.json index 6444a3273..58ca64ea7 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -7,7 +7,8 @@ "plugin:eslint-comments/recommended", "plugin:import/errors", "plugin:import/warnings", - "plugin:jest/recommended" + "plugin:jest/recommended", + "@react-native-community" ], "env": { "browser": true, @@ -46,7 +47,7 @@ "no-case-declarations": "off", "no-cycle": "off", "react-hooks/rules-of-hooks": "error", - "react-hooks/exhaustive-deps": "warn", + "react-hooks/exhaustive-deps": "off", "import/no-extraneous-dependencies": [ "error", { diff --git a/src/components/markdownEditor/view/markdownEditorView.js b/src/components/markdownEditor/view/markdownEditorView.js index 9c9dbe29e..a798cf199 100644 --- a/src/components/markdownEditor/view/markdownEditorView.js +++ b/src/components/markdownEditor/view/markdownEditorView.js @@ -45,13 +45,13 @@ const MarkdownEditorView = ({ if (!isPreviewActive) { _setTextAndSelection({ selection: { start: 0, end: 0 }, text }); } - }, [_setTextAndSelection, isPreviewActive, text]); + }, [isPreviewActive]); useEffect(() => { if (text === '' && draftBody !== '') { _setTextAndSelection({ selection: { start: 0, end: 0 }, text: draftBody }); } - }, [_setTextAndSelection, draftBody, text]); + }, [draftBody]); useEffect(() => { if (editable === null) { @@ -63,7 +63,7 @@ const MarkdownEditorView = ({ } else { setEditable(!isLoading); } - }, [editable, isLoading]); + }, [isLoading]); useEffect(() => { if (uploadedImage && uploadedImage.url) { @@ -75,7 +75,7 @@ const MarkdownEditorView = ({ isImage: !!uploadedImage, }); } - }, [_setTextAndSelection, selection, text, uploadedImage]); + }, [uploadedImage]); useEffect(() => { setText(draftBody); @@ -91,7 +91,7 @@ const MarkdownEditorView = ({ handleIsFormValid(text); } } - }, [_changeText, handleIsFormValid, text]); + }, [text]); // eslint-disable-next-line react-hooks/exhaustive-deps const _changeText = useCallback(input => {