From 148676b6974810b2b39de9cc719cd803e567c9bf Mon Sep 17 00:00:00 2001 From: GandalfGwaihir Date: Thu, 11 Apr 2024 21:41:20 +0530 Subject: [PATCH 1/2] use useAutoFocusInput --- src/pages/EditReportFieldText.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pages/EditReportFieldText.tsx b/src/pages/EditReportFieldText.tsx index d89724f0228b..ebb5c0acb188 100644 --- a/src/pages/EditReportFieldText.tsx +++ b/src/pages/EditReportFieldText.tsx @@ -3,8 +3,8 @@ import {View} from 'react-native'; import FormProvider from '@components/Form/FormProvider'; import InputWrapper from '@components/Form/InputWrapper'; import type {FormInputErrors, FormOnyxValues} from '@components/Form/types'; -import type {AnimatedTextInputRef} from '@components/RNTextInput'; import TextInput from '@components/TextInput'; +import useAutoFocusInput from '@hooks/useAutoFocusInput'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import CONST from '@src/CONST'; @@ -30,7 +30,7 @@ type EditReportFieldTextPageProps = { function EditReportFieldTextPage({fieldName, onSubmit, fieldValue, isRequired, fieldKey}: EditReportFieldTextPageProps) { const styles = useThemeStyles(); const {translate} = useLocalize(); - const inputRef = useRef(null); + const {inputCallbackRef} = useAutoFocusInput(); const validate = useCallback( (values: FormOnyxValues) => { @@ -61,7 +61,7 @@ function EditReportFieldTextPage({fieldName, onSubmit, fieldValue, isRequired, f label={fieldName} accessibilityLabel={fieldName} role={CONST.ROLE.PRESENTATION} - ref={inputRef} + ref={inputCallbackRef} /> From d5778687b33a014d5860f9fe901832ff6fbb11d1 Mon Sep 17 00:00:00 2001 From: GandalfGwaihir Date: Fri, 12 Apr 2024 01:42:51 +0530 Subject: [PATCH 2/2] Fix lint --- src/pages/EditReportFieldText.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/EditReportFieldText.tsx b/src/pages/EditReportFieldText.tsx index ebb5c0acb188..0649d59cd2ee 100644 --- a/src/pages/EditReportFieldText.tsx +++ b/src/pages/EditReportFieldText.tsx @@ -1,4 +1,4 @@ -import React, {useCallback, useRef} from 'react'; +import React, {useCallback} from 'react'; import {View} from 'react-native'; import FormProvider from '@components/Form/FormProvider'; import InputWrapper from '@components/Form/InputWrapper';