From 4b29f855f113a1a1ad8d1b39d241a9746712d0bc Mon Sep 17 00:00:00 2001 From: Vivek Kumar Date: Fri, 15 Sep 2023 16:14:59 +0530 Subject: [PATCH] use focusAndUpdateMultilineInputRange for auto-focus --- src/pages/PrivateNotes/PrivateNotesEditPage.js | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/src/pages/PrivateNotes/PrivateNotesEditPage.js b/src/pages/PrivateNotes/PrivateNotesEditPage.js index 70afebb3d5bf..4cada83941ac 100644 --- a/src/pages/PrivateNotes/PrivateNotesEditPage.js +++ b/src/pages/PrivateNotes/PrivateNotesEditPage.js @@ -23,6 +23,7 @@ import personalDetailsPropType from '../personalDetailsPropType'; import * as Report from '../../libs/actions/Report'; import useLocalize from '../../hooks/useLocalize'; import OfflineWithFeedback from '../../components/OfflineWithFeedback'; +import focusAndUpdateMultilineInputRange from '../../libs/focusAndUpdateMultilineInputRange'; const propTypes = { /** All of the personal details for everyone */ @@ -77,19 +78,7 @@ function PrivateNotesEditPage({route, personalDetailsList, session, report}) { return ( { - if (!privateNotesInput.current) { - return; - } - - privateNotesInput.current.focus(); - - // Below condition is needed for web, desktop and mweb only, for native cursor to position at end by default. - if (privateNotesInput.current.value && privateNotesInput.current.setSelectionRange) { - const length = privateNotesInput.current.value.length; - privateNotesInput.current.setSelectionRange(length, length); - } - }} + onEntryTransitionEnd={() => focusAndUpdateMultilineInputRange(privateNotesInput.current)} >