Skip to content

Commit

Permalink
Merge pull request #36840 from bernhardoj/fix/36513-cant-use-tab-key
Browse files Browse the repository at this point in the history
Fix can't use Tab key in money request participant and confirmation page
  • Loading branch information
thienlnam authored Feb 28, 2024
2 parents b447c11 + 4618ccf commit a0e444e
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions src/pages/iou/request/IOURequestStartPage.js
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -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(() => {
Expand Down

0 comments on commit a0e444e

Please sign in to comment.