Skip to content

Commit 247c52f

Browse files
committed
fix: allow to interactively swipe down the modal
1 parent 0486604 commit 247c52f

3 files changed

Lines changed: 8 additions & 2 deletions

File tree

packages/react-native/React/Fabric/Mounting/ComponentViews/Modal/RCTFabricModalHostViewController.mm

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ - (instancetype)init
2222
}
2323
_touchHandler = [RCTSurfaceTouchHandler new];
2424

25-
self.modalInPresentation = YES;
26-
2725
return self;
2826
}
2927

packages/react-native/React/Fabric/Mounting/ComponentViews/Modal/RCTModalHostViewComponentView.mm

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,13 @@ - (void)presentationControllerDidAttemptToDismiss:(UIPresentationController *)co
283283
}
284284
}
285285

286+
- (void)presentationControllerDidDismiss:(UIPresentationController *)presentationController {
287+
auto eventEmitter = [self modalEventEmitter];
288+
if (eventEmitter) {
289+
eventEmitter->onRequestClose({});
290+
}
291+
}
292+
286293
@end
287294

288295
#ifdef __cplusplus

packages/rn-tester/js/examples/Modal/ModalPresentation.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ function ModalPresentation() {
4949

5050
const onRequestClose = useCallback(() => {
5151
console.log('onRequestClose');
52+
setProps(prev => ({...prev, visible: false}));
5253
}, []);
5354

5455
const [props, setProps] = useState<ModalProps>({

0 commit comments

Comments
 (0)