You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(iOS): allow to interactively swipe down the modal (#51483)
Summary:
This PR allows to interactively close the modal using the swipe down gesture.
It fixes 5 year old issue: #29319
In short it removes `modalInPresentation` which according to the documentation causes: "UIKit ignores events outside the view controller’s bounds and **prevents the interactive dismissal of the view controller while it is onscreen.**".
It also adds another delegate event to call onRequestClose whenever modal is closed by gesture.
https://github.com/user-attachments/assets/8849ecba-f762-47ec-a28b-b41c1991a882
## Changelog:
[IOS] [ADDED] - Allow to interactively swipe down the modal.
Add allowSwipeDismissal prop.
Pull Request resolved: #51483
Test Plan: Test if swiping down the modal calls onRequestClose
Reviewed By: rshest
Differential Revision: D75125438
Pulled By: javache
fbshipit-source-id: d4f2c8b59447680f405b725d0809573a937f97cf
* The `onRequestClose` callback is called when the user taps the hardware back button on Android or the menu button on Apple TV.
38
+
* The `onRequestClose` callback is called when the user taps the hardware back button on Android, dismisses the sheet using a gesture on iOS (when `allowSwipeDismissal` is set to true) or the menu button on Apple TV.
Copy file name to clipboardExpand all lines: packages/react-native/Libraries/Modal/Modal.js
+19-2Lines changed: 19 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -86,9 +86,9 @@ export type ModalBaseProps = {
86
86
*/
87
87
visible?: ?boolean,
88
88
/**
89
-
* The `onRequestClose` callback is called when the user taps the hardware back button on Android or the menu button on Apple TV.
89
+
* The `onRequestClose` callback is called when the user taps the hardware back button on Android, dismisses the sheet using a gesture on iOS (when `allowSwipeDismissal` is set to true) or the menu button on Apple TV.
Copy file name to clipboardExpand all lines: packages/react-native/ReactAndroid/api/ReactAndroid.api
+1Lines changed: 1 addition & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -5306,6 +5306,7 @@ public class com/facebook/react/viewmanagers/ModalHostViewManagerDelegate : com/
5306
5306
}
5307
5307
5308
5308
public abstract interface class com/facebook/react/viewmanagers/ModalHostViewManagerInterface : com/facebook/react/uimanager/ViewManagerWithGeneratedInterface {
5309
+
public abstract fun setAllowSwipeDismissal (Landroid/view/View;Z)V
5309
5310
public abstract fun setAnimated (Landroid/view/View;Z)V
5310
5311
public abstract fun setAnimationType (Landroid/view/View;Ljava/lang/String;)V
5311
5312
public abstract fun setHardwareAccelerated (Landroid/view/View;Z)V
0 commit comments