Skip to content
Merged
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
14 changes: 8 additions & 6 deletions src/components/Modal/BottomDockedModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,12 @@ function BottomDockedModal({
}, [deviceWidth, deviceWidthProp, deviceHeight, deviceHeightProp]);

const onBackButtonPressHandler = useCallback(() => {
if (isVisible) {
if (isVisibleState) {
onBackButtonPress();
return true;
}
return false;
}, [isVisible, onBackButtonPress]);
}, [isVisibleState, onBackButtonPress]);

const handleEscape = useCallback(
(e: KeyboardEvent) => {
Expand All @@ -79,7 +79,6 @@ function BottomDockedModal({
);

useEffect(() => {
const deviceEventListener = DeviceEventEmitter.addListener('didUpdateDimensions', handleDimensionsUpdate);
if (getPlatform() === CONST.PLATFORM.WEB) {
document.body.addEventListener('keyup', handleEscape, {capture: true});
} else {
Expand All @@ -92,10 +91,13 @@ function BottomDockedModal({
} else {
backHandlerListener.current?.remove();
}
deviceEventListener.remove();
};
// eslint-disable-next-line react-compiler/react-compiler, react-hooks/exhaustive-deps
}, []);
}, [handleEscape, onBackButtonPressHandler]);

useEffect(() => {
const deviceEventListener = DeviceEventEmitter.addListener('didUpdateDimensions', handleDimensionsUpdate);
return () => deviceEventListener.remove();
}, [handleDimensionsUpdate]);

useEffect(
() => () => {
Expand Down