Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/hooks/useAutoFocusInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export default function useAutoFocusInput() {
return;
}
inputRef.current.focus();
setIsScreenTransitionEnded(false);
}, [isScreenTransitionEnded, isInputInitialized]);

useFocusEffect(
Expand Down
8 changes: 4 additions & 4 deletions src/pages/iou/MoneyRequestMerchantPage.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import lodashGet from 'lodash/get';
import PropTypes from 'prop-types';
import React, {useCallback, useEffect, useRef} from 'react';
import React, {useCallback, useEffect} from 'react';
import {View} from 'react-native';
import {withOnyx} from 'react-native-onyx';
import _ from 'underscore';
import Form from '@components/Form';
import HeaderWithBackButton from '@components/HeaderWithBackButton';
import ScreenWrapper from '@components/ScreenWrapper';
import TextInput from '@components/TextInput';
import useAutoFocusInput from '@hooks/useAutoFocusInput';
import useLocalize from '@hooks/useLocalize';
import Navigation from '@libs/Navigation/Navigation';
import styles from '@styles/styles';
Expand Down Expand Up @@ -47,7 +48,7 @@ const defaultProps = {

function MoneyRequestMerchantPage({iou, route}) {
const {translate} = useLocalize();
const inputRef = useRef(null);
const {inputCallbackRef} = useAutoFocusInput();
const iouType = lodashGet(route, 'params.iouType', '');
const reportID = lodashGet(route, 'params.reportID', '');

Expand Down Expand Up @@ -92,7 +93,6 @@ function MoneyRequestMerchantPage({iou, route}) {
<ScreenWrapper
includeSafeAreaPaddingBottom={false}
shouldEnableMaxHeight
onEntryTransitionEnd={() => inputRef.current && inputRef.current.focus()}
testID={MoneyRequestMerchantPage.displayName}
>
<HeaderWithBackButton
Expand All @@ -116,7 +116,7 @@ function MoneyRequestMerchantPage({iou, route}) {
label={translate('common.merchant')}
accessibilityLabel={translate('common.merchant')}
accessibilityRole={CONST.ACCESSIBILITY_ROLE.TEXT}
ref={(el) => (inputRef.current = el)}
ref={inputCallbackRef}
/>
</View>
</Form>
Expand Down