diff --git a/src/pages/iou/request/IOURequestStartPage.js b/src/pages/iou/request/IOURequestStartPage.js index 05e3d7c96311..3af3b9a7d0ea 100644 --- a/src/pages/iou/request/IOURequestStartPage.js +++ b/src/pages/iou/request/IOURequestStartPage.js @@ -1,3 +1,4 @@ +import {useFocusEffect} from '@react-navigation/native'; import lodashGet from 'lodash/get'; import PropTypes from 'prop-types'; import React, {useCallback, useEffect, useRef, useState} from 'react'; @@ -80,18 +81,20 @@ function IOURequestStartPage({ const previousIOURequestType = usePrevious(transactionRequestType.current); const isFromGlobalCreate = _.isEmpty(report.reportID); - useEffect(() => { - const handler = (event) => { - if (event.code !== CONST.KEYBOARD_SHORTCUTS.TAB.shortcutKey) { - return; - } - event.preventDefault(); - event.stopPropagation(); - }; - KeyDownPressListener.addKeyDownPressListener(handler); - - return () => KeyDownPressListener.removeKeyDownPressListener(handler); - }, []); + useFocusEffect( + useCallback(() => { + const handler = (event) => { + if (event.code !== CONST.KEYBOARD_SHORTCUTS.TAB.shortcutKey) { + return; + } + event.preventDefault(); + event.stopPropagation(); + }; + KeyDownPressListener.addKeyDownPressListener(handler); + + return () => KeyDownPressListener.removeKeyDownPressListener(handler); + }, []), + ); // Clear out the temporary money request if the reportID in the URL has changed from the transaction's reportID useEffect(() => {