fix: dont prevent default if action sheet isn't open

This commit is contained in:
thecodrr
2022-07-01 14:41:05 +05:00
parent ebf078d7cd
commit 7d1e378fa4
2 changed files with 5 additions and 2 deletions

View File

@@ -115,9 +115,11 @@ function ActionSheetPresenter(props) {
});
}, [animation, onClose, contentRef.current]);
var handleBackPress = (0, react_1.useCallback)(function (event) {
if (!isOpen)
return;
event.preventDefault();
onBeforeClose();
}, [onBeforeClose]);
}, [isOpen, onBeforeClose]);
(0, react_1.useEffect)(function () {
// Note: this is a custom event implemented on the React Native
// side to handle back button when action sheet is opened.

View File

@@ -108,10 +108,11 @@ export function ActionSheetPresenter(
const handleBackPress = useCallback(
(event: Event) => {
if (!isOpen) return;
event.preventDefault();
onBeforeClose();
},
[onBeforeClose]
[isOpen, onBeforeClose]
);
useEffect(() => {