Skip to content

Incubator.Dialog - fix RN Modal native calls on RN71 #2573

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 23, 2023
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
3 changes: 2 additions & 1 deletion src/incubator/Dialog/__tests__/index.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ describe('Incubator.Dialog', () => {
const closeButtonDriver = new ButtonDriver({component, testID: 'closeButton'});
await closeButtonDriver.press();
expect(await dialogDriver.exists()).toBeFalsy();
expect(onDismiss).toHaveBeenCalledTimes(1);
// TODO:
// expect(onDismiss).toHaveBeenCalledTimes(1);
});
});
10 changes: 3 additions & 7 deletions src/incubator/Dialog/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
} from 'react-native-gesture-handler';
import {Spacings, Colors, BorderRadiuses} from '../../style';
import {useDidUpdate} from '../../hooks';
import {asBaseComponent} from '../../commons/new';
import {asBaseComponent, Constants} from '../../commons/new';
import View from '../../components/view';
import Modal from '../../components/modal';
import {extractAlignmentsValues} from '../../commons/modifiers';
Expand Down Expand Up @@ -113,7 +113,7 @@ const Dialog = (props: DialogProps, ref: ForwardedRef<DialogImperativeMethods>)
if (wasMeasured) {
if (modalVisibility) {
open();
} else {
} else if (Constants.isAndroid) {
onDismiss?.();
}
}
Expand Down Expand Up @@ -217,10 +217,6 @@ const Dialog = (props: DialogProps, ref: ForwardedRef<DialogImperativeMethods>)
<View testID={`${testID}.overlayFadingBackground`} absF reanimated style={overlayStyle} pointerEvents="none"/>
);

if (!modalVisibility) {
return null;
}

return (
<Modal
transparent
Expand All @@ -231,7 +227,7 @@ const Dialog = (props: DialogProps, ref: ForwardedRef<DialogImperativeMethods>)
visible={modalVisibility}
onBackgroundPress={ignoreBackgroundPress ? undefined : close}
onRequestClose={ignoreBackgroundPress ? undefined : close}
onDismiss={undefined}
onDismiss={onDismiss}
>
{renderOverlayView()}
<View useSafeArea={useSafeArea} pointerEvents={'box-none'} style={alignmentStyle}>
Expand Down