react-native-screens 3.20.0 → 3.21.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -1
- package/RNScreens.podspec +1 -1
- package/android/build.gradle +24 -6
- package/android/src/main/java/com/swmansion/rnscreens/CustomSearchView.kt +4 -0
- package/android/src/main/java/com/swmansion/rnscreens/LifecycleHelper.kt +60 -0
- package/android/src/main/java/com/swmansion/rnscreens/ScreenStackHeaderConfig.kt +7 -9
- package/android/src/main/java/com/swmansion/rnscreens/ScreenStackHeaderConfigViewManager.kt +12 -4
- package/android/src/main/java/com/swmansion/rnscreens/ScreenViewManager.kt +10 -0
- package/android/src/main/java/com/swmansion/rnscreens/SearchBarManager.kt +32 -8
- package/android/src/main/java/com/swmansion/rnscreens/SearchBarView.kt +36 -15
- package/android/src/main/java/com/swmansion/rnscreens/events/HeaderAttachedEvent.kt +24 -0
- package/android/src/main/java/com/swmansion/rnscreens/events/HeaderDetachedEvent.kt +24 -0
- package/android/src/main/java/com/swmansion/rnscreens/events/SearchBarBlurEvent.kt +24 -0
- package/android/src/main/java/com/swmansion/rnscreens/events/SearchBarChangeTextEvent.kt +29 -0
- package/android/src/main/java/com/swmansion/rnscreens/events/SearchBarCloseEvent.kt +24 -0
- package/android/src/main/java/com/swmansion/rnscreens/events/SearchBarFocusEvent.kt +24 -0
- package/android/src/main/java/com/swmansion/rnscreens/events/SearchBarOpenEvent.kt +24 -0
- package/android/src/main/java/com/swmansion/rnscreens/events/SearchBarSearchButtonPressEvent.kt +26 -0
- package/android/src/main/res/base/anim/rns_standard_accelerate_interpolator.xml +6 -0
- package/android/src/main/res/v33/anim-v33/rns_default_enter_in.xml +38 -0
- package/android/src/main/res/v33/anim-v33/rns_default_enter_out.xml +38 -0
- package/android/src/main/res/v33/anim-v33/rns_default_exit_in.xml +38 -0
- package/android/src/main/res/v33/anim-v33/rns_default_exit_out.xml +38 -0
- package/android/src/paper/java/com/facebook/react/viewmanagers/RNSScreenManagerDelegate.java +15 -0
- package/android/src/paper/java/com/facebook/react/viewmanagers/RNSScreenManagerInterface.java +5 -0
- package/android/src/paper/java/com/facebook/react/viewmanagers/RNSScreenStackHeaderConfigManagerDelegate.java +3 -0
- package/android/src/paper/java/com/facebook/react/viewmanagers/RNSScreenStackHeaderConfigManagerInterface.java +1 -0
- package/common/cpp/react/renderer/components/rnscreens/RNSScreenState.h +1 -2
- package/ios/RCTImageComponentView+RNSScreenStackHeaderConfig.h +11 -0
- package/ios/RCTImageComponentView+RNSScreenStackHeaderConfig.mm +14 -0
- package/ios/RNSConvert.h +8 -2
- package/ios/RNSConvert.mm +28 -2
- package/ios/RNSEnums.h +6 -0
- package/ios/RNSFullWindowOverlay.h +5 -5
- package/ios/RNSFullWindowOverlay.mm +13 -13
- package/ios/RNSScreen.h +14 -6
- package/ios/RNSScreen.mm +129 -28
- package/ios/RNSScreenContainer.h +2 -2
- package/ios/RNSScreenContainer.mm +5 -5
- package/ios/RNSScreenNavigationContainer.mm +3 -3
- package/ios/RNSScreenStack.h +4 -4
- package/ios/RNSScreenStack.mm +62 -23
- package/ios/RNSScreenStackHeaderConfig.h +10 -3
- package/ios/RNSScreenStackHeaderConfig.mm +138 -81
- package/ios/RNSScreenStackHeaderSubview.h +5 -6
- package/ios/RNSScreenStackHeaderSubview.mm +20 -11
- package/ios/RNSScreenWindowTraits.mm +21 -2
- package/ios/RNSSearchBar.h +5 -4
- package/ios/RNSSearchBar.mm +87 -12
- package/lib/commonjs/TransitionProgressContext.js.map +1 -1
- package/lib/commonjs/fabric/FullWindowOverlayNativeComponent.js +0 -5
- package/lib/commonjs/fabric/FullWindowOverlayNativeComponent.js.map +1 -1
- package/lib/commonjs/fabric/ScreenContainerNativeComponent.js +0 -5
- package/lib/commonjs/fabric/ScreenContainerNativeComponent.js.map +1 -1
- package/lib/commonjs/fabric/ScreenNativeComponent.js +0 -5
- package/lib/commonjs/fabric/ScreenNativeComponent.js.map +1 -1
- package/lib/commonjs/fabric/ScreenNavigationContainerNativeComponent.js +0 -5
- package/lib/commonjs/fabric/ScreenNavigationContainerNativeComponent.js.map +1 -1
- package/lib/commonjs/fabric/ScreenStackHeaderConfigNativeComponent.js +0 -8
- package/lib/commonjs/fabric/ScreenStackHeaderConfigNativeComponent.js.map +1 -1
- package/lib/commonjs/fabric/ScreenStackHeaderSubviewNativeComponent.js +0 -8
- package/lib/commonjs/fabric/ScreenStackHeaderSubviewNativeComponent.js.map +1 -1
- package/lib/commonjs/fabric/ScreenStackNativeComponent.js +0 -5
- package/lib/commonjs/fabric/ScreenStackNativeComponent.js.map +1 -1
- package/lib/commonjs/fabric/SearchBarNativeComponent.js +7 -7
- package/lib/commonjs/fabric/SearchBarNativeComponent.js.map +1 -1
- package/lib/commonjs/index.js +8 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/index.native.js +51 -10
- package/lib/commonjs/index.native.js.map +1 -1
- package/lib/commonjs/native-stack/index.js.map +1 -1
- package/lib/commonjs/native-stack/navigators/createNativeStackNavigator.js +18 -16
- package/lib/commonjs/native-stack/navigators/createNativeStackNavigator.js.map +1 -1
- package/lib/commonjs/native-stack/types.js.map +1 -1
- package/lib/commonjs/native-stack/utils/HeaderHeightContext.js.map +1 -1
- package/lib/commonjs/native-stack/utils/SafeAreaProviderCompat.js.map +1 -1
- package/lib/commonjs/native-stack/utils/getDefaultHeaderHeight.js.map +1 -1
- package/lib/commonjs/native-stack/utils/useBackPressSubscription.js.map +1 -1
- package/lib/commonjs/native-stack/utils/useHeaderHeight.js.map +1 -1
- package/lib/commonjs/native-stack/views/FontProcessor.js +1 -0
- package/lib/commonjs/native-stack/views/FontProcessor.js.map +1 -1
- package/lib/commonjs/native-stack/views/HeaderConfig.js +3 -1
- package/lib/commonjs/native-stack/views/HeaderConfig.js.map +1 -1
- package/lib/commonjs/native-stack/views/NativeStackView.js +14 -1
- package/lib/commonjs/native-stack/views/NativeStackView.js.map +1 -1
- package/lib/commonjs/reanimated/ReanimatedNativeStackScreen.js.map +1 -1
- package/lib/commonjs/reanimated/ReanimatedScreen.js.map +1 -1
- package/lib/commonjs/reanimated/ReanimatedScreenProvider.js.map +1 -1
- package/lib/commonjs/reanimated/ReanimatedTransitionProgressContext.js.map +1 -1
- package/lib/commonjs/reanimated/index.js.map +1 -1
- package/lib/commonjs/reanimated/useReanimatedTransitionProgress.js.map +1 -1
- package/lib/commonjs/types.js.map +1 -1
- package/lib/commonjs/useTransitionProgress.js.map +1 -1
- package/lib/commonjs/utils.js +8 -1
- package/lib/commonjs/utils.js.map +1 -1
- package/lib/module/fabric/FullWindowOverlayNativeComponent.js +0 -5
- package/lib/module/fabric/FullWindowOverlayNativeComponent.js.map +1 -1
- package/lib/module/fabric/ScreenContainerNativeComponent.js +0 -5
- package/lib/module/fabric/ScreenContainerNativeComponent.js.map +1 -1
- package/lib/module/fabric/ScreenNativeComponent.js +0 -5
- package/lib/module/fabric/ScreenNativeComponent.js.map +1 -1
- package/lib/module/fabric/ScreenNavigationContainerNativeComponent.js +0 -5
- package/lib/module/fabric/ScreenNavigationContainerNativeComponent.js.map +1 -1
- package/lib/module/fabric/ScreenStackHeaderConfigNativeComponent.js +0 -6
- package/lib/module/fabric/ScreenStackHeaderConfigNativeComponent.js.map +1 -1
- package/lib/module/fabric/ScreenStackHeaderSubviewNativeComponent.js +0 -6
- package/lib/module/fabric/ScreenStackHeaderSubviewNativeComponent.js.map +1 -1
- package/lib/module/fabric/ScreenStackNativeComponent.js +0 -5
- package/lib/module/fabric/ScreenStackNativeComponent.js.map +1 -1
- package/lib/module/fabric/SearchBarNativeComponent.js +4 -6
- package/lib/module/fabric/SearchBarNativeComponent.js.map +1 -1
- package/lib/module/index.js +2 -2
- package/lib/module/index.js.map +1 -1
- package/lib/module/index.native.js +53 -11
- package/lib/module/index.native.js.map +1 -1
- package/lib/module/native-stack/navigators/createNativeStackNavigator.js +18 -16
- package/lib/module/native-stack/navigators/createNativeStackNavigator.js.map +1 -1
- package/lib/module/native-stack/types.js.map +1 -1
- package/lib/module/native-stack/utils/SafeAreaProviderCompat.js.map +1 -1
- package/lib/module/native-stack/utils/getDefaultHeaderHeight.js.map +1 -1
- package/lib/module/native-stack/utils/useBackPressSubscription.js.map +1 -1
- package/lib/module/native-stack/utils/useHeaderHeight.js.map +1 -1
- package/lib/module/native-stack/views/FontProcessor.js +1 -0
- package/lib/module/native-stack/views/FontProcessor.js.map +1 -1
- package/lib/module/native-stack/views/HeaderConfig.js +3 -1
- package/lib/module/native-stack/views/HeaderConfig.js.map +1 -1
- package/lib/module/native-stack/views/NativeStackView.js +15 -1
- package/lib/module/native-stack/views/NativeStackView.js.map +1 -1
- package/lib/module/reanimated/ReanimatedNativeStackScreen.js.map +1 -1
- package/lib/module/reanimated/ReanimatedScreen.js.map +1 -1
- package/lib/module/reanimated/ReanimatedScreenProvider.js.map +1 -1
- package/lib/module/reanimated/useReanimatedTransitionProgress.js.map +1 -1
- package/lib/module/types.js.map +1 -1
- package/lib/module/useTransitionProgress.js.map +1 -1
- package/lib/module/utils.js +6 -0
- package/lib/module/utils.js.map +1 -1
- package/lib/typescript/TransitionProgressContext.d.ts +1 -1
- package/lib/typescript/fabric/FullWindowOverlayNativeComponent.d.ts +6 -0
- package/lib/typescript/fabric/ScreenContainerNativeComponent.d.ts +6 -0
- package/lib/typescript/fabric/ScreenNativeComponent.d.ts +62 -0
- package/lib/typescript/fabric/ScreenNavigationContainerNativeComponent.d.ts +6 -0
- package/lib/typescript/fabric/ScreenStackHeaderConfigNativeComponent.d.ts +34 -0
- package/lib/typescript/fabric/ScreenStackHeaderSubviewNativeComponent.d.ts +9 -0
- package/lib/typescript/fabric/ScreenStackNativeComponent.d.ts +9 -0
- package/lib/typescript/fabric/SearchBarNativeComponent.d.ts +46 -0
- package/lib/typescript/index.d.ts +3 -3
- package/lib/typescript/native-stack/types.d.ts +64 -10
- package/lib/typescript/native-stack/utils/SafeAreaProviderCompat.d.ts +1 -1
- package/lib/typescript/native-stack/utils/getDefaultHeaderHeight.d.ts +1 -1
- package/lib/typescript/native-stack/views/HeaderConfig.d.ts +1 -1
- package/lib/typescript/native-stack/views/NativeStackView.d.ts +1 -1
- package/lib/typescript/reanimated/ReanimatedNativeStackScreen.d.ts +1 -1
- package/lib/typescript/reanimated/ReanimatedScreen.d.ts +1 -1
- package/lib/typescript/reanimated/ReanimatedTransitionProgressContext.d.ts +1 -1
- package/lib/typescript/types.d.ts +90 -11
- package/lib/typescript/useTransitionProgress.d.ts +3 -3
- package/lib/typescript/utils.d.ts +1 -0
- package/native-stack/README.md +59 -1
- package/package.json +11 -14
- package/src/fabric/FullWindowOverlayNativeComponent.ts +6 -0
- package/src/fabric/ScreenContainerNativeComponent.ts +6 -0
- package/src/fabric/ScreenNativeComponent.ts +97 -0
- package/src/fabric/ScreenNavigationContainerNativeComponent.ts +9 -0
- package/src/fabric/ScreenStackHeaderConfigNativeComponent.ts +43 -0
- package/src/fabric/ScreenStackHeaderSubviewNativeComponent.ts +20 -0
- package/src/fabric/ScreenStackNativeComponent.ts +12 -0
- package/src/fabric/SearchBarNativeComponent.ts +73 -0
- package/src/index.native.tsx +109 -14
- package/src/index.tsx +5 -3
- package/src/native-stack/navigators/createNativeStackNavigator.tsx +23 -19
- package/src/native-stack/types.tsx +55 -0
- package/src/native-stack/views/FontProcessor.tsx +1 -0
- package/src/native-stack/views/HeaderConfig.tsx +3 -1
- package/src/native-stack/views/NativeStackView.tsx +14 -2
- package/src/types.tsx +84 -2
- package/src/utils.ts +6 -0
- package/createNativeStackNavigator/README.md +0 -522
- package/createNativeStackNavigator/package.json +0 -6
- package/lib/commonjs/createNativeStackNavigator.js +0 -374
- package/lib/commonjs/createNativeStackNavigator.js.map +0 -1
- package/lib/module/createNativeStackNavigator.js +0 -366
- package/lib/module/createNativeStackNavigator.js.map +0 -1
- package/lib/typescript/createNativeStackNavigator.d.ts +0 -51
- package/src/createNativeStackNavigator.tsx +0 -594
- package/src/fabric/FullWindowOverlayNativeComponent.js +0 -19
- package/src/fabric/ScreenContainerNativeComponent.js +0 -19
- package/src/fabric/ScreenNativeComponent.js +0 -97
- package/src/fabric/ScreenNavigationContainerNativeComponent.js +0 -19
- package/src/fabric/ScreenStackHeaderConfigNativeComponent.js +0 -54
- package/src/fabric/ScreenStackHeaderSubviewNativeComponent.js +0 -31
- package/src/fabric/ScreenStackNativeComponent.js +0 -23
- package/src/fabric/SearchBarNativeComponent.js +0 -62
- /package/android/src/main/res/{anim → base/anim}/rns_default_enter_in.xml +0 -0
- /package/android/src/main/res/{anim → base/anim}/rns_default_enter_out.xml +0 -0
- /package/android/src/main/res/{anim → base/anim}/rns_default_exit_in.xml +0 -0
- /package/android/src/main/res/{anim → base/anim}/rns_default_exit_out.xml +0 -0
- /package/android/src/main/res/{anim → base/anim}/rns_fade_from_bottom.xml +0 -0
- /package/android/src/main/res/{anim → base/anim}/rns_fade_in.xml +0 -0
- /package/android/src/main/res/{anim → base/anim}/rns_fade_out.xml +0 -0
- /package/android/src/main/res/{anim → base/anim}/rns_fade_to_bottom.xml +0 -0
- /package/android/src/main/res/{anim → base/anim}/rns_no_animation_20.xml +0 -0
- /package/android/src/main/res/{anim → base/anim}/rns_no_animation_250.xml +0 -0
- /package/android/src/main/res/{anim → base/anim}/rns_no_animation_350.xml +0 -0
- /package/android/src/main/res/{anim → base/anim}/rns_no_animation_medium.xml +0 -0
- /package/android/src/main/res/{anim → base/anim}/rns_slide_in_from_bottom.xml +0 -0
- /package/android/src/main/res/{anim → base/anim}/rns_slide_in_from_left.xml +0 -0
- /package/android/src/main/res/{anim → base/anim}/rns_slide_in_from_right.xml +0 -0
- /package/android/src/main/res/{anim → base/anim}/rns_slide_out_to_bottom.xml +0 -0
- /package/android/src/main/res/{anim → base/anim}/rns_slide_out_to_left.xml +0 -0
- /package/android/src/main/res/{anim → base/anim}/rns_slide_out_to_right.xml +0 -0
package/ios/RNSScreen.mm
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
#import "RNSScreenContainer.h"
|
|
5
5
|
#import "RNSScreenWindowTraits.h"
|
|
6
6
|
|
|
7
|
-
#ifdef
|
|
7
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
8
8
|
#import <React/RCTConversions.h>
|
|
9
9
|
#import <React/RCTFabricComponentsPlugins.h>
|
|
10
10
|
#import <React/RCTRootComponentView.h>
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
#import "RNSScreenStackHeaderConfig.h"
|
|
26
26
|
|
|
27
27
|
@interface RNSScreenView ()
|
|
28
|
-
#ifdef
|
|
28
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
29
29
|
<RCTRNSScreenViewProtocol, UIAdaptivePresentationControllerDelegate>
|
|
30
30
|
#else
|
|
31
31
|
<UIAdaptivePresentationControllerDelegate, RCTInvalidating>
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
|
|
35
35
|
@implementation RNSScreenView {
|
|
36
36
|
__weak RCTBridge *_bridge;
|
|
37
|
-
#ifdef
|
|
37
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
38
38
|
RCTSurfaceTouchHandler *_touchHandler;
|
|
39
39
|
facebook::react::RNSScreenShadowNode::ConcreteState::Shared _state;
|
|
40
40
|
// on fabric, they are not available by default so we need them exposed here too
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
#endif
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
#ifdef
|
|
48
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
49
49
|
- (instancetype)initWithFrame:(CGRect)frame
|
|
50
50
|
{
|
|
51
51
|
if (self = [super initWithFrame:frame]) {
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
|
|
58
58
|
return self;
|
|
59
59
|
}
|
|
60
|
-
#endif //
|
|
60
|
+
#endif // RCT_NEW_ARCH_ENABLED
|
|
61
61
|
|
|
62
62
|
- (instancetype)initWithBridge:(RCTBridge *)bridge
|
|
63
63
|
{
|
|
@@ -82,6 +82,9 @@
|
|
|
82
82
|
_hasStatusBarHiddenSet = NO;
|
|
83
83
|
_hasOrientationSet = NO;
|
|
84
84
|
_hasHomeIndicatorHiddenSet = NO;
|
|
85
|
+
#if !TARGET_OS_TV
|
|
86
|
+
_sheetExpandsWhenScrolledToEdge = YES;
|
|
87
|
+
#endif // !TARGET_OS_TV
|
|
85
88
|
}
|
|
86
89
|
|
|
87
90
|
- (UIViewController *)reactViewController
|
|
@@ -89,7 +92,7 @@
|
|
|
89
92
|
return _controller;
|
|
90
93
|
}
|
|
91
94
|
|
|
92
|
-
#ifdef
|
|
95
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
93
96
|
- (NSArray<UIView *> *)reactSubviews
|
|
94
97
|
{
|
|
95
98
|
return _reactSubviews;
|
|
@@ -98,7 +101,7 @@
|
|
|
98
101
|
|
|
99
102
|
- (void)updateBounds
|
|
100
103
|
{
|
|
101
|
-
#ifdef
|
|
104
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
102
105
|
if (_state != nullptr) {
|
|
103
106
|
auto newState = facebook::react::RNSScreenState{RCTSizeFromCGSize(self.bounds.size)};
|
|
104
107
|
_state->updateState(std::move(newState));
|
|
@@ -158,7 +161,7 @@
|
|
|
158
161
|
// https://developer.apple.com/documentation/uikit/uiviewcontroller/1621426-presentationcontroller?language=objc
|
|
159
162
|
_controller.presentationController.delegate = self;
|
|
160
163
|
} else if (_stackPresentation != RNSScreenStackPresentationPush) {
|
|
161
|
-
#ifdef
|
|
164
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
162
165
|
// TODO: on Fabric, same controllers can be used as modals and then recycled and used a push which would result in
|
|
163
166
|
// this error. It would be good to check if it doesn't leak in such case.
|
|
164
167
|
#else
|
|
@@ -277,7 +280,7 @@
|
|
|
277
280
|
|
|
278
281
|
- (void)notifyDismissedWithCount:(int)dismissCount
|
|
279
282
|
{
|
|
280
|
-
#ifdef
|
|
283
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
281
284
|
// If screen is already unmounted then there will be no event emitter
|
|
282
285
|
// it will be cleaned in prepareForRecycle
|
|
283
286
|
if (_eventEmitter != nullptr) {
|
|
@@ -299,7 +302,7 @@
|
|
|
299
302
|
|
|
300
303
|
- (void)notifyDismissCancelledWithDismissCount:(int)dismissCount
|
|
301
304
|
{
|
|
302
|
-
#ifdef
|
|
305
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
303
306
|
// If screen is already unmounted then there will be no event emitter
|
|
304
307
|
// it will be cleaned in prepareForRecycle
|
|
305
308
|
if (_eventEmitter != nullptr) {
|
|
@@ -316,7 +319,7 @@
|
|
|
316
319
|
|
|
317
320
|
- (void)notifyWillAppear
|
|
318
321
|
{
|
|
319
|
-
#ifdef
|
|
322
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
320
323
|
// If screen is already unmounted then there will be no event emitter
|
|
321
324
|
// it will be cleaned in prepareForRecycle
|
|
322
325
|
if (_eventEmitter != nullptr) {
|
|
@@ -339,7 +342,7 @@
|
|
|
339
342
|
if (_hideKeyboardOnSwipe) {
|
|
340
343
|
[self endEditing:YES];
|
|
341
344
|
}
|
|
342
|
-
#ifdef
|
|
345
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
343
346
|
// If screen is already unmounted then there will be no event emitter
|
|
344
347
|
// it will be cleaned in prepareForRecycle
|
|
345
348
|
if (_eventEmitter != nullptr) {
|
|
@@ -355,7 +358,7 @@
|
|
|
355
358
|
|
|
356
359
|
- (void)notifyAppear
|
|
357
360
|
{
|
|
358
|
-
#ifdef
|
|
361
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
359
362
|
// If screen is already unmounted then there will be no event emitter
|
|
360
363
|
// it will be cleaned in prepareForRecycle
|
|
361
364
|
if (_eventEmitter != nullptr) {
|
|
@@ -375,7 +378,7 @@
|
|
|
375
378
|
|
|
376
379
|
- (void)notifyDisappear
|
|
377
380
|
{
|
|
378
|
-
#ifdef
|
|
381
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
379
382
|
// If screen is already unmounted then there will be no event emitter
|
|
380
383
|
// it will be cleaned in prepareForRecycle
|
|
381
384
|
if (_eventEmitter != nullptr) {
|
|
@@ -391,7 +394,7 @@
|
|
|
391
394
|
|
|
392
395
|
- (BOOL)isMountedUnderScreenOrReactRoot
|
|
393
396
|
{
|
|
394
|
-
#ifdef
|
|
397
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
395
398
|
#define RNS_EXPECTED_VIEW RCTRootComponentView
|
|
396
399
|
#else
|
|
397
400
|
#define RNS_EXPECTED_VIEW RCTRootView
|
|
@@ -412,7 +415,7 @@
|
|
|
412
415
|
// root application window.
|
|
413
416
|
if (self.window != nil && ![self isMountedUnderScreenOrReactRoot]) {
|
|
414
417
|
if (_touchHandler == nil) {
|
|
415
|
-
#ifdef
|
|
418
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
416
419
|
_touchHandler = [RCTSurfaceTouchHandler new];
|
|
417
420
|
#else
|
|
418
421
|
_touchHandler = [[RCTTouchHandler alloc] initWithBridge:_bridge];
|
|
@@ -424,7 +427,7 @@
|
|
|
424
427
|
}
|
|
425
428
|
}
|
|
426
429
|
|
|
427
|
-
#ifdef
|
|
430
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
428
431
|
- (RCTSurfaceTouchHandler *)touchHandler
|
|
429
432
|
#else
|
|
430
433
|
- (RCTTouchHandler *)touchHandler
|
|
@@ -449,7 +452,7 @@
|
|
|
449
452
|
|
|
450
453
|
- (void)notifyTransitionProgress:(double)progress closing:(BOOL)closing goingForward:(BOOL)goingForward
|
|
451
454
|
{
|
|
452
|
-
#ifdef
|
|
455
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
453
456
|
if (_eventEmitter != nullptr) {
|
|
454
457
|
std::dynamic_pointer_cast<const facebook::react::RNSScreenEventEmitter>(_eventEmitter)
|
|
455
458
|
->onTransitionProgress(facebook::react::RNSScreenEventEmitter::OnTransitionProgress{
|
|
@@ -484,7 +487,7 @@
|
|
|
484
487
|
// pulling down starting at some touchable item. Without "reset" the touchable
|
|
485
488
|
// will never go back from highlighted state even when the modal start sliding
|
|
486
489
|
// down.
|
|
487
|
-
#ifdef
|
|
490
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
488
491
|
[_touchHandler setEnabled:NO];
|
|
489
492
|
[_touchHandler setEnabled:YES];
|
|
490
493
|
#else
|
|
@@ -514,8 +517,62 @@
|
|
|
514
517
|
return self.stackPresentation != RNSScreenStackPresentationPush;
|
|
515
518
|
}
|
|
516
519
|
|
|
520
|
+
#if !TARGET_OS_TV
|
|
521
|
+
/**
|
|
522
|
+
* Updates settings for sheet presentation controller.
|
|
523
|
+
* Note that this method should not be called inside `stackPresentation` setter, because on Paper we don't have
|
|
524
|
+
* guarantee that values of all related props had been updated earlier.
|
|
525
|
+
*/
|
|
526
|
+
- (void)updatePresentationStyle
|
|
527
|
+
{
|
|
528
|
+
#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && defined(__IPHONE_15_0) && \
|
|
529
|
+
__IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_15_0
|
|
530
|
+
if (@available(iOS 15.0, *)) {
|
|
531
|
+
UISheetPresentationController *sheet = _controller.sheetPresentationController;
|
|
532
|
+
if (_stackPresentation == RNSScreenStackPresentationFormSheet && sheet != nil) {
|
|
533
|
+
sheet.prefersScrollingExpandsWhenScrolledToEdge = _sheetExpandsWhenScrolledToEdge;
|
|
534
|
+
sheet.prefersGrabberVisible = _sheetGrabberVisible;
|
|
535
|
+
sheet.preferredCornerRadius =
|
|
536
|
+
_sheetCornerRadius < 0 ? UISheetPresentationControllerAutomaticDimension : _sheetCornerRadius;
|
|
537
|
+
|
|
538
|
+
if (_sheetLargestUndimmedDetent == RNSScreenDetentTypeMedium) {
|
|
539
|
+
sheet.largestUndimmedDetentIdentifier = UISheetPresentationControllerDetentIdentifierMedium;
|
|
540
|
+
} else if (_sheetLargestUndimmedDetent == RNSScreenDetentTypeLarge) {
|
|
541
|
+
sheet.largestUndimmedDetentIdentifier = UISheetPresentationControllerDetentIdentifierLarge;
|
|
542
|
+
} else if (_sheetLargestUndimmedDetent == RNSScreenDetentTypeAll) {
|
|
543
|
+
sheet.largestUndimmedDetentIdentifier = nil;
|
|
544
|
+
} else {
|
|
545
|
+
RCTLogError(@"Unhandled value of sheetLargestUndimmedDetent passed");
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
if (_sheetAllowedDetents == RNSScreenDetentTypeMedium) {
|
|
549
|
+
sheet.detents = @[ UISheetPresentationControllerDetent.mediumDetent ];
|
|
550
|
+
if (sheet.selectedDetentIdentifier != UISheetPresentationControllerDetentIdentifierMedium) {
|
|
551
|
+
[sheet animateChanges:^{
|
|
552
|
+
sheet.selectedDetentIdentifier = UISheetPresentationControllerDetentIdentifierMedium;
|
|
553
|
+
}];
|
|
554
|
+
}
|
|
555
|
+
} else if (_sheetAllowedDetents == RNSScreenDetentTypeLarge) {
|
|
556
|
+
sheet.detents = @[ UISheetPresentationControllerDetent.largeDetent ];
|
|
557
|
+
if (sheet.selectedDetentIdentifier != UISheetPresentationControllerDetentIdentifierLarge) {
|
|
558
|
+
[sheet animateChanges:^{
|
|
559
|
+
sheet.selectedDetentIdentifier = UISheetPresentationControllerDetentIdentifierLarge;
|
|
560
|
+
}];
|
|
561
|
+
}
|
|
562
|
+
} else if (_sheetAllowedDetents == RNSScreenDetentTypeAll) {
|
|
563
|
+
sheet.detents =
|
|
564
|
+
@[ UISheetPresentationControllerDetent.mediumDetent, UISheetPresentationControllerDetent.largeDetent ];
|
|
565
|
+
} else {
|
|
566
|
+
RCTLogError(@"Unhandled value of sheetAllowedDetents passed");
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
#endif // Check for max allowed iOS version
|
|
571
|
+
}
|
|
572
|
+
#endif // !TARGET_OS_TV
|
|
573
|
+
|
|
517
574
|
#pragma mark - Fabric specific
|
|
518
|
-
#ifdef
|
|
575
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
519
576
|
|
|
520
577
|
+ (facebook::react::ComponentDescriptorProvider)componentDescriptorProvider
|
|
521
578
|
{
|
|
@@ -613,6 +670,19 @@
|
|
|
613
670
|
if (newScreenProps.homeIndicatorHidden != oldScreenProps.homeIndicatorHidden) {
|
|
614
671
|
[self setHomeIndicatorHidden:newScreenProps.homeIndicatorHidden];
|
|
615
672
|
}
|
|
673
|
+
|
|
674
|
+
[self setSheetGrabberVisible:newScreenProps.sheetGrabberVisible];
|
|
675
|
+
[self setSheetCornerRadius:newScreenProps.sheetCornerRadius];
|
|
676
|
+
[self setSheetExpandsWhenScrolledToEdge:newScreenProps.sheetExpandsWhenScrolledToEdge];
|
|
677
|
+
|
|
678
|
+
if (newScreenProps.sheetAllowedDetents != oldScreenProps.sheetAllowedDetents) {
|
|
679
|
+
[self setSheetAllowedDetents:[RNSConvert RNSScreenDetentTypeFromAllowedDetents:newScreenProps.sheetAllowedDetents]];
|
|
680
|
+
}
|
|
681
|
+
|
|
682
|
+
if (newScreenProps.sheetLargestUndimmedDetent != oldScreenProps.sheetLargestUndimmedDetent) {
|
|
683
|
+
[self setSheetLargestUndimmedDetent:
|
|
684
|
+
[RNSConvert RNSScreenDetentTypeFromLargestUndimmedDetent:newScreenProps.sheetLargestUndimmedDetent]];
|
|
685
|
+
}
|
|
616
686
|
#endif // !TARGET_OS_TV
|
|
617
687
|
|
|
618
688
|
// Notice that we compare against _stackPresentation, not oldScreenProps.stackPresentation.
|
|
@@ -658,9 +728,24 @@
|
|
|
658
728
|
// Explanation taken from `reactSetFrame`, which is old arch equivalent of this code.
|
|
659
729
|
}
|
|
660
730
|
|
|
731
|
+
- (void)finalizeUpdates:(RNComponentViewUpdateMask)updateMask
|
|
732
|
+
{
|
|
733
|
+
#if !TARGET_OS_TV
|
|
734
|
+
[self updatePresentationStyle];
|
|
735
|
+
#endif // !TARGET_OS_TV
|
|
736
|
+
}
|
|
737
|
+
|
|
661
738
|
#pragma mark - Paper specific
|
|
662
739
|
#else
|
|
663
740
|
|
|
741
|
+
- (void)didSetProps:(NSArray<NSString *> *)changedProps
|
|
742
|
+
{
|
|
743
|
+
[super didSetProps:changedProps];
|
|
744
|
+
#if !TARGET_OS_TV
|
|
745
|
+
[self updatePresentationStyle];
|
|
746
|
+
#endif // !TARGET_OS_TV
|
|
747
|
+
}
|
|
748
|
+
|
|
664
749
|
- (void)setPointerEvents:(RCTPointerEvents)pointerEvents
|
|
665
750
|
{
|
|
666
751
|
// pointer events settings are managed by the parent screen container, we ignore
|
|
@@ -690,7 +775,7 @@
|
|
|
690
775
|
|
|
691
776
|
@end
|
|
692
777
|
|
|
693
|
-
#ifdef
|
|
778
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
694
779
|
Class<RCTComponentViewProtocol> RNSScreenCls(void)
|
|
695
780
|
{
|
|
696
781
|
return RNSScreenView.class;
|
|
@@ -721,7 +806,7 @@ Class<RCTComponentViewProtocol> RNSScreenCls(void)
|
|
|
721
806
|
self.view = view;
|
|
722
807
|
_fakeView = [UIView new];
|
|
723
808
|
_shouldNotify = YES;
|
|
724
|
-
#ifdef
|
|
809
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
725
810
|
_initialView = (RNSScreenView *)view;
|
|
726
811
|
#endif
|
|
727
812
|
}
|
|
@@ -810,7 +895,7 @@ Class<RCTComponentViewProtocol> RNSScreenCls(void)
|
|
|
810
895
|
- (void)viewDidDisappear:(BOOL)animated
|
|
811
896
|
{
|
|
812
897
|
[super viewDidDisappear:animated];
|
|
813
|
-
#ifdef
|
|
898
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
814
899
|
[self resetViewToScreen];
|
|
815
900
|
#endif
|
|
816
901
|
if (self.parentViewController == nil && self.presentingViewController == nil) {
|
|
@@ -832,7 +917,7 @@ Class<RCTComponentViewProtocol> RNSScreenCls(void)
|
|
|
832
917
|
|
|
833
918
|
_isSwiping = NO;
|
|
834
919
|
_shouldNotify = YES;
|
|
835
|
-
#ifdef
|
|
920
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
836
921
|
#else
|
|
837
922
|
[self traverseForScrollView:self.screenView];
|
|
838
923
|
#endif
|
|
@@ -852,7 +937,7 @@ Class<RCTComponentViewProtocol> RNSScreenCls(void)
|
|
|
852
937
|
BOOL isPresentedAsNativeModal = self.parentViewController == nil && self.presentingViewController != nil;
|
|
853
938
|
|
|
854
939
|
if (isDisplayedWithinUINavController || isPresentedAsNativeModal) {
|
|
855
|
-
#ifdef
|
|
940
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
856
941
|
[self.screenView updateBounds];
|
|
857
942
|
#else
|
|
858
943
|
if (!CGRectEqualToRect(_lastViewFrame, self.screenView.frame)) {
|
|
@@ -1074,7 +1159,7 @@ Class<RCTComponentViewProtocol> RNSScreenCls(void)
|
|
|
1074
1159
|
// when we want to check props of ScreenView, we need to get them from _initialView
|
|
1075
1160
|
- (RNSScreenView *)screenView
|
|
1076
1161
|
{
|
|
1077
|
-
#ifdef
|
|
1162
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
1078
1163
|
return _initialView;
|
|
1079
1164
|
#else
|
|
1080
1165
|
return (RNSScreenView *)self.view;
|
|
@@ -1101,7 +1186,7 @@ Class<RCTComponentViewProtocol> RNSScreenCls(void)
|
|
|
1101
1186
|
|
|
1102
1187
|
BOOL wasSearchBarActive = prevNavigationItem.searchController.active;
|
|
1103
1188
|
|
|
1104
|
-
#ifdef
|
|
1189
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
1105
1190
|
BOOL shouldHideHeader = !config.show;
|
|
1106
1191
|
#else
|
|
1107
1192
|
BOOL shouldHideHeader = config.hide;
|
|
@@ -1118,7 +1203,7 @@ Class<RCTComponentViewProtocol> RNSScreenCls(void)
|
|
|
1118
1203
|
#endif
|
|
1119
1204
|
}
|
|
1120
1205
|
|
|
1121
|
-
#ifdef
|
|
1206
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
1122
1207
|
#pragma mark - Fabric specific
|
|
1123
1208
|
|
|
1124
1209
|
- (void)setViewToSnapshot:(UIView *)snapshot
|
|
@@ -1197,6 +1282,12 @@ RCT_EXPORT_VIEW_PROPERTY(statusBarAnimation, UIStatusBarAnimation)
|
|
|
1197
1282
|
RCT_EXPORT_VIEW_PROPERTY(statusBarHidden, BOOL)
|
|
1198
1283
|
RCT_EXPORT_VIEW_PROPERTY(statusBarStyle, RNSStatusBarStyle)
|
|
1199
1284
|
RCT_EXPORT_VIEW_PROPERTY(homeIndicatorHidden, BOOL)
|
|
1285
|
+
|
|
1286
|
+
RCT_EXPORT_VIEW_PROPERTY(sheetAllowedDetents, RNSScreenDetentType);
|
|
1287
|
+
RCT_EXPORT_VIEW_PROPERTY(sheetLargestUndimmedDetent, RNSScreenDetentType);
|
|
1288
|
+
RCT_EXPORT_VIEW_PROPERTY(sheetGrabberVisible, BOOL);
|
|
1289
|
+
RCT_EXPORT_VIEW_PROPERTY(sheetCornerRadius, CGFloat);
|
|
1290
|
+
RCT_EXPORT_VIEW_PROPERTY(sheetExpandsWhenScrolledToEdge, BOOL);
|
|
1200
1291
|
#endif
|
|
1201
1292
|
|
|
1202
1293
|
#if !TARGET_OS_TV
|
|
@@ -1309,6 +1400,16 @@ RCT_ENUM_CONVERTER(
|
|
|
1309
1400
|
RNSStatusBarStyleAuto,
|
|
1310
1401
|
integerValue)
|
|
1311
1402
|
|
|
1403
|
+
RCT_ENUM_CONVERTER(
|
|
1404
|
+
RNSScreenDetentType,
|
|
1405
|
+
(@{
|
|
1406
|
+
@"large" : @(RNSScreenDetentTypeLarge),
|
|
1407
|
+
@"medium" : @(RNSScreenDetentTypeMedium),
|
|
1408
|
+
@"all" : @(RNSScreenDetentTypeAll),
|
|
1409
|
+
}),
|
|
1410
|
+
RNSScreenDetentTypeAll,
|
|
1411
|
+
integerValue)
|
|
1412
|
+
|
|
1312
1413
|
+ (UIInterfaceOrientationMask)UIInterfaceOrientationMask:(id)json
|
|
1313
1414
|
{
|
|
1314
1415
|
json = [self NSString:json];
|
package/ios/RNSScreenContainer.h
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#ifdef
|
|
1
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
2
2
|
#import <React/RCTViewComponentView.h>
|
|
3
3
|
#else
|
|
4
4
|
#endif
|
|
@@ -29,7 +29,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
29
29
|
@end
|
|
30
30
|
|
|
31
31
|
@interface RNSScreenContainerView :
|
|
32
|
-
#ifdef
|
|
32
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
33
33
|
RCTViewComponentView <RNSScreenContainerDelegate>
|
|
34
34
|
#else
|
|
35
35
|
UIView <RNSScreenContainerDelegate, RCTInvalidating>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#import "RNSScreenContainer.h"
|
|
2
2
|
#import "RNSScreen.h"
|
|
3
3
|
|
|
4
|
-
#ifdef
|
|
4
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
5
5
|
#import <React/RCTConversions.h>
|
|
6
6
|
#import <React/RCTFabricComponentsPlugins.h>
|
|
7
7
|
#import <react/renderer/components/rnscreens/ComponentDescriptors.h>
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
- (instancetype)init
|
|
59
59
|
{
|
|
60
60
|
if (self = [super init]) {
|
|
61
|
-
#ifdef
|
|
61
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
62
62
|
static const auto defaultProps = std::make_shared<const facebook::react::RNSScreenContainerProps>();
|
|
63
63
|
_props = defaultProps;
|
|
64
64
|
#endif
|
|
@@ -234,7 +234,7 @@
|
|
|
234
234
|
[super layoutSubviews];
|
|
235
235
|
_controller.view.frame = self.bounds;
|
|
236
236
|
for (RNSScreenView *subview in _reactSubviews) {
|
|
237
|
-
#ifdef
|
|
237
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
238
238
|
facebook::react::LayoutMetrics screenLayoutMetrics = subview.newLayoutMetrics;
|
|
239
239
|
screenLayoutMetrics.frame = RCTRectFromCGRect(CGRectMake(0, 0, self.bounds.size.width, self.bounds.size.height));
|
|
240
240
|
[subview updateLayoutMetrics:screenLayoutMetrics oldLayoutMetrics:subview.oldLayoutMetrics];
|
|
@@ -246,7 +246,7 @@
|
|
|
246
246
|
}
|
|
247
247
|
|
|
248
248
|
#pragma mark-- Fabric specific
|
|
249
|
-
#ifdef
|
|
249
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
250
250
|
|
|
251
251
|
- (void)mountChildComponentView:(UIView<RCTComponentViewProtocol> *)childComponentView index:(NSInteger)index
|
|
252
252
|
{
|
|
@@ -321,7 +321,7 @@
|
|
|
321
321
|
|
|
322
322
|
@end
|
|
323
323
|
|
|
324
|
-
#ifdef
|
|
324
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
325
325
|
Class<RCTComponentViewProtocol> RNSScreenContainerCls(void)
|
|
326
326
|
{
|
|
327
327
|
return RNSScreenContainerView.class;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
#import "RNSScreen.h"
|
|
3
3
|
#import "RNSScreenContainer.h"
|
|
4
4
|
|
|
5
|
-
#ifdef
|
|
5
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
6
6
|
#import <React/RCTFabricComponentsPlugins.h>
|
|
7
7
|
#import <react/renderer/components/rnscreens/ComponentDescriptors.h>
|
|
8
8
|
#import <react/renderer/components/rnscreens/Props.h>
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
#pragma mark-- Fabric specific
|
|
39
|
-
#ifdef
|
|
39
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
40
40
|
+ (facebook::react::ComponentDescriptorProvider)componentDescriptorProvider
|
|
41
41
|
{
|
|
42
42
|
return facebook::react::concreteComponentDescriptorProvider<
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
|
|
47
47
|
@end
|
|
48
48
|
|
|
49
|
-
#ifdef
|
|
49
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
50
50
|
Class<RCTComponentViewProtocol> RNSScreenNavigationContainerCls(void)
|
|
51
51
|
{
|
|
52
52
|
return RNSScreenNavigationContainerView.class;
|
package/ios/RNSScreenStack.h
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#ifdef
|
|
1
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
2
2
|
#import <React/RCTViewComponentView.h>
|
|
3
3
|
#else
|
|
4
4
|
#import <React/RCTUIManagerObserverCoordinator.h>
|
|
@@ -14,7 +14,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
14
14
|
@end
|
|
15
15
|
|
|
16
16
|
@interface RNSScreenStackView :
|
|
17
|
-
#ifdef
|
|
17
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
18
18
|
RCTViewComponentView <RNSScreenContainerDelegate>
|
|
19
19
|
#else
|
|
20
20
|
UIView <RNSScreenContainerDelegate, RCTInvalidating>
|
|
@@ -23,10 +23,10 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
23
23
|
- (void)markChildUpdated;
|
|
24
24
|
- (void)didUpdateChildren;
|
|
25
25
|
|
|
26
|
-
#ifdef
|
|
26
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
27
27
|
#else
|
|
28
28
|
@property (nonatomic, copy) RCTDirectEventBlock onFinishTransitioning;
|
|
29
|
-
#endif //
|
|
29
|
+
#endif // RCT_NEW_ARCH_ENABLED
|
|
30
30
|
|
|
31
31
|
@end
|
|
32
32
|
|