File tree 6 files changed +8
-38
lines changed
Fabric/Mounting/ComponentViews/Modal
6 files changed +8
-38
lines changed Original file line number Diff line number Diff line change @@ -95,8 +95,7 @@ export type Props = $ReadOnly<{|
95
95
96
96
/**
97
97
* The `onRequestClose` callback is called when the user taps the hardware
98
- * back button on Android, the menu button on Apple TV, or a modal is dismissed
99
- * with a gesture on iOS 13+.
98
+ * back button on Android or the menu button on Apple TV.
100
99
*
101
100
* This is required on Apple TV and Android.
102
101
*
Original file line number Diff line number Diff line change @@ -70,8 +70,7 @@ type NativeProps = $ReadOnly<{|
70
70
71
71
/**
72
72
* The `onRequestClose` callback is called when the user taps the hardware
73
- * back button on Android, the menu button on Apple TV, or a modal is dismissed
74
- * with a gesture on iOS 13+.
73
+ * back button on Android or the menu button on Apple TV.
75
74
*
76
75
* This is required on Apple TV and Android.
77
76
*
Original file line number Diff line number Diff line change @@ -91,9 +91,7 @@ static ModalHostViewOnOrientationChangeStruct onOrientationChangeStruct(CGRect r
91
91
return {orientation};
92
92
}
93
93
94
- @interface RCTModalHostViewComponentView () <
95
- RCTFabricModalHostViewControllerDelegate,
96
- UIAdaptivePresentationControllerDelegate>
94
+ @interface RCTModalHostViewComponentView () <RCTFabricModalHostViewControllerDelegate>
97
95
98
96
@end
99
97
@@ -112,7 +110,6 @@ - (instancetype)initWithFrame:(CGRect)frame
112
110
_viewController = [RCTFabricModalHostViewController new ];
113
111
_viewController.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
114
112
_viewController.delegate = self;
115
- _viewController.presentationController .delegate = self;
116
113
}
117
114
118
115
return self;
@@ -217,17 +214,4 @@ - (void)unmountChildComponentView:(UIView<RCTComponentViewProtocol> *)childCompo
217
214
[childComponentView removeFromSuperview ];
218
215
}
219
216
220
- #pragma mark - UIAdaptivePresentationControllerDelegate
221
-
222
- - (void )presentationControllerDidDismiss : (UIPresentationController *)presentationController
223
- {
224
- if (!_eventEmitter) {
225
- return ;
226
- }
227
-
228
- assert (std::dynamic_pointer_cast<ModalHostViewEventEmitter const >(_eventEmitter));
229
- auto eventEmitter = std::static_pointer_cast<ModalHostViewEventEmitter const >(_eventEmitter);
230
- eventEmitter->onRequestClose ({});
231
- }
232
-
233
217
@end
Original file line number Diff line number Diff line change 32
32
@property (nonatomic , copy ) NSArray <NSString *> *supportedOrientations;
33
33
@property (nonatomic , copy ) RCTDirectEventBlock onOrientationChange;
34
34
35
- @property (nonatomic , copy ) RCTDirectEventBlock onRequestClose;
36
-
37
35
#if TARGET_OS_TV
36
+ @property (nonatomic , copy ) RCTDirectEventBlock onRequestClose;
38
37
@property (nonatomic , strong ) RCTTVRemoteHandler *tvRemoteHandler;
39
38
#endif
40
39
Original file line number Diff line number Diff line change 20
20
#import " RCTTVRemoteHandler.h"
21
21
#endif
22
22
23
- @interface RCTModalHostView () <UIAdaptivePresentationControllerDelegate>
24
-
25
- @end
26
-
27
23
@implementation RCTModalHostView
28
24
{
29
25
__weak RCTBridge *_bridge;
@@ -50,7 +46,6 @@ - (instancetype)initWithBridge:(RCTBridge *)bridge
50
46
UIView *containerView = [UIView new ];
51
47
containerView.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
52
48
_modalViewController.view = containerView;
53
- _modalViewController.presentationController .delegate = self;
54
49
_touchHandler = [[RCTTouchHandler alloc ] initWithBridge: bridge];
55
50
#if TARGET_OS_TV
56
51
_menuButtonGestureRecognizer = [[UITapGestureRecognizer alloc ] initWithTarget: self action: @selector (menuButtonPressed: )];
@@ -75,21 +70,19 @@ - (void)menuButtonPressed:(__unused UIGestureRecognizer *)gestureRecognizer
75
70
_onRequestClose (nil );
76
71
}
77
72
}
78
- #endif
79
73
80
74
- (void )setOnRequestClose : (RCTDirectEventBlock)onRequestClose
81
75
{
82
76
_onRequestClose = onRequestClose;
83
- #if TARGET_OS_TV
84
77
if (_reactSubview) {
85
78
if (_onRequestClose && _menuButtonGestureRecognizer) {
86
79
[_reactSubview addGestureRecognizer: _menuButtonGestureRecognizer];
87
80
} else {
88
81
[_reactSubview removeGestureRecognizer: _menuButtonGestureRecognizer];
89
82
}
90
83
}
91
- #endif
92
84
}
85
+ #endif
93
86
94
87
- (void )notifyForBoundsChange : (CGRect )newBounds
95
88
{
@@ -264,11 +257,4 @@ - (UIInterfaceOrientationMask)supportedOrientationsMask
264
257
}
265
258
#endif
266
259
267
- - (void )presentationControllerDidDismiss : (UIPresentationController *)presentationController
268
- {
269
- if (_onRequestClose) {
270
- _onRequestClose (nil );
271
- }
272
- }
273
-
274
260
@end
Original file line number Diff line number Diff line change @@ -108,6 +108,9 @@ - (void)invalidate
108
108
RCT_EXPORT_VIEW_PROPERTY(identifier, NSNumber )
109
109
RCT_EXPORT_VIEW_PROPERTY(supportedOrientations, NSArray )
110
110
RCT_EXPORT_VIEW_PROPERTY(onOrientationChange, RCTDirectEventBlock)
111
+
112
+ #if TARGET_OS_TV
111
113
RCT_EXPORT_VIEW_PROPERTY (onRequestClose, RCTDirectEventBlock)
114
+ #endif
112
115
113
116
@end
You can’t perform that action at this time.
0 commit comments