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
|
@@ -1,57 +1,74 @@
|
|
|
1
|
-
#ifdef
|
|
1
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
2
2
|
#import <React/RCTConversions.h>
|
|
3
3
|
#import <React/RCTFabricComponentsPlugins.h>
|
|
4
|
+
#import <React/RCTImageComponentView.h>
|
|
4
5
|
#import <React/UIView+React.h>
|
|
6
|
+
#import <react/renderer/components/image/ImageProps.h>
|
|
5
7
|
#import <react/renderer/components/rnscreens/ComponentDescriptors.h>
|
|
6
8
|
#import <react/renderer/components/rnscreens/EventEmitters.h>
|
|
7
9
|
#import <react/renderer/components/rnscreens/Props.h>
|
|
8
10
|
#import <react/renderer/components/rnscreens/RCTComponentViewHelpers.h>
|
|
11
|
+
#import "RCTImageComponentView+RNSScreenStackHeaderConfig.h"
|
|
9
12
|
#else
|
|
10
|
-
#import <React/RCTBridge.h>
|
|
11
|
-
#import <React/RCTImageLoader.h>
|
|
12
|
-
#import <React/RCTImageSource.h>
|
|
13
13
|
#import <React/RCTImageView.h>
|
|
14
14
|
#import <React/RCTShadowView.h>
|
|
15
15
|
#import <React/RCTUIManager.h>
|
|
16
16
|
#import <React/RCTUIManagerUtils.h>
|
|
17
17
|
#endif
|
|
18
|
+
#import <React/RCTBridge.h>
|
|
18
19
|
#import <React/RCTFont.h>
|
|
20
|
+
#import <React/RCTImageLoader.h>
|
|
21
|
+
#import <React/RCTImageSource.h>
|
|
19
22
|
#import "RNSScreen.h"
|
|
20
23
|
#import "RNSScreenStackHeaderConfig.h"
|
|
21
24
|
#import "RNSSearchBar.h"
|
|
22
25
|
#import "RNSUIBarButtonItem.h"
|
|
23
26
|
|
|
24
|
-
#ifdef
|
|
25
|
-
|
|
27
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
28
|
+
namespace rct = facebook::react;
|
|
29
|
+
#endif // RCT_NEW_ARCH_ENABLED
|
|
30
|
+
|
|
31
|
+
#ifndef RCT_NEW_ARCH_ENABLED
|
|
26
32
|
// Some RN private method hacking below. Couldn't figure out better way to access image data
|
|
27
33
|
// of a given RCTImageView. See more comments in the code section processing SubviewTypeBackButton
|
|
28
34
|
@interface RCTImageView (Private)
|
|
29
35
|
- (UIImage *)image;
|
|
30
36
|
@end
|
|
37
|
+
#endif // !RCT_NEW_ARCH_ENABLED
|
|
31
38
|
|
|
32
39
|
@interface RCTImageLoader (Private)
|
|
33
40
|
- (id<RCTImageCache>)imageCache;
|
|
34
41
|
@end
|
|
35
|
-
|
|
42
|
+
|
|
43
|
+
@implementation NSString (RNSStringUtil)
|
|
44
|
+
|
|
45
|
+
+ (BOOL)RNSisBlank:(NSString *)string
|
|
46
|
+
{
|
|
47
|
+
if (string == nil) {
|
|
48
|
+
return YES;
|
|
49
|
+
}
|
|
50
|
+
return [[string stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]] length] == 0;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
@end
|
|
36
54
|
|
|
37
55
|
@implementation RNSScreenStackHeaderConfig {
|
|
38
56
|
NSMutableArray<RNSScreenStackHeaderSubview *> *_reactSubviews;
|
|
39
|
-
#ifdef
|
|
57
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
40
58
|
BOOL _initialPropsSet;
|
|
41
59
|
#else
|
|
42
60
|
#endif
|
|
43
61
|
}
|
|
44
62
|
|
|
45
|
-
#ifdef
|
|
63
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
46
64
|
- (instancetype)initWithFrame:(CGRect)frame
|
|
47
65
|
{
|
|
48
66
|
if (self = [super initWithFrame:frame]) {
|
|
49
|
-
static const auto defaultProps = std::make_shared<const
|
|
67
|
+
static const auto defaultProps = std::make_shared<const rct::RNSScreenStackHeaderConfigProps>();
|
|
50
68
|
_props = defaultProps;
|
|
51
|
-
self.hidden = YES;
|
|
52
69
|
_show = YES;
|
|
53
70
|
_translucent = NO;
|
|
54
|
-
|
|
71
|
+
[self initProps];
|
|
55
72
|
}
|
|
56
73
|
return self;
|
|
57
74
|
}
|
|
@@ -59,14 +76,20 @@
|
|
|
59
76
|
- (instancetype)init
|
|
60
77
|
{
|
|
61
78
|
if (self = [super init]) {
|
|
62
|
-
self.hidden = YES;
|
|
63
79
|
_translucent = YES;
|
|
64
|
-
|
|
80
|
+
[self initProps];
|
|
65
81
|
}
|
|
66
82
|
return self;
|
|
67
83
|
}
|
|
68
84
|
#endif
|
|
69
85
|
|
|
86
|
+
- (void)initProps
|
|
87
|
+
{
|
|
88
|
+
self.hidden = YES;
|
|
89
|
+
_reactSubviews = [NSMutableArray new];
|
|
90
|
+
_backTitleVisible = YES;
|
|
91
|
+
}
|
|
92
|
+
|
|
70
93
|
- (UIView *)reactSuperview
|
|
71
94
|
{
|
|
72
95
|
return _screenView;
|
|
@@ -243,14 +266,15 @@
|
|
|
243
266
|
|
|
244
267
|
+ (UIImage *)loadBackButtonImageInViewController:(UIViewController *)vc withConfig:(RNSScreenStackHeaderConfig *)config
|
|
245
268
|
{
|
|
246
|
-
#ifdef RN_FABRIC_ENABLED
|
|
247
|
-
@throw([NSException exceptionWithName:@"UNIMPLEMENTED" reason:@"Implement" userInfo:nil]);
|
|
248
|
-
#else
|
|
249
269
|
BOOL hasBackButtonImage = NO;
|
|
250
270
|
for (RNSScreenStackHeaderSubview *subview in config.reactSubviews) {
|
|
251
271
|
if (subview.type == RNSScreenStackHeaderSubviewTypeBackButton && subview.subviews.count > 0) {
|
|
252
272
|
hasBackButtonImage = YES;
|
|
273
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
274
|
+
RCTImageComponentView *imageView = subview.subviews[0];
|
|
275
|
+
#else
|
|
253
276
|
RCTImageView *imageView = subview.subviews[0];
|
|
277
|
+
#endif // RCT_NEW_ARCH_ENABLED
|
|
254
278
|
if (imageView.image == nil) {
|
|
255
279
|
// This is yet another workaround for loading custom back icon. It turns out that under
|
|
256
280
|
// certain circumstances image attribute can be null despite the app running in production
|
|
@@ -259,14 +283,16 @@
|
|
|
259
283
|
// does not populate the frame of the image view before the loading start. The latter result
|
|
260
284
|
// in the image attribute not being updated. We manually set frame to the size of an image
|
|
261
285
|
// in order to trigger proper reload that'd update the image attribute.
|
|
262
|
-
RCTImageSource *
|
|
286
|
+
RCTImageSource *imageSource = [RNSScreenStackHeaderConfig imageSourceFromImageView:imageView];
|
|
263
287
|
[imageView reactSetFrame:CGRectMake(
|
|
264
288
|
imageView.frame.origin.x,
|
|
265
289
|
imageView.frame.origin.y,
|
|
266
|
-
|
|
267
|
-
|
|
290
|
+
imageSource.size.width,
|
|
291
|
+
imageSource.size.height)];
|
|
268
292
|
}
|
|
293
|
+
|
|
269
294
|
UIImage *image = imageView.image;
|
|
295
|
+
|
|
270
296
|
// IMPORTANT!!!
|
|
271
297
|
// image can be nil in DEV MODE ONLY
|
|
272
298
|
//
|
|
@@ -280,12 +306,19 @@
|
|
|
280
306
|
if (image == nil) {
|
|
281
307
|
// in DEV MODE we try to load from cache (we use private API for that as it is not exposed
|
|
282
308
|
// publically in headers).
|
|
283
|
-
RCTImageSource *
|
|
284
|
-
RCTImageLoader *
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
309
|
+
RCTImageSource *imageSource = [RNSScreenStackHeaderConfig imageSourceFromImageView:imageView];
|
|
310
|
+
RCTImageLoader *imageLoader = [subview.bridge moduleForClass:[RCTImageLoader class]];
|
|
311
|
+
|
|
312
|
+
image = [imageLoader.imageCache
|
|
313
|
+
imageForUrl:imageSource.request.URL.absoluteString
|
|
314
|
+
size:imageSource.size
|
|
315
|
+
scale:imageSource.scale
|
|
316
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
317
|
+
resizeMode:resizeModeFromCppEquiv(
|
|
318
|
+
std::static_pointer_cast<const rct::ImageProps>(imageView.props)->resizeMode)];
|
|
319
|
+
#else
|
|
320
|
+
resizeMode:imageView.resizeMode];
|
|
321
|
+
#endif // RCT_NEW_ARCH_ENABLED
|
|
289
322
|
}
|
|
290
323
|
if (image == nil) {
|
|
291
324
|
// This will be triggered if the image is not in the cache yet. What we do is we wait until
|
|
@@ -312,7 +345,6 @@
|
|
|
312
345
|
}
|
|
313
346
|
}
|
|
314
347
|
}
|
|
315
|
-
#endif // RN_FABRIC_ENABLED
|
|
316
348
|
return nil;
|
|
317
349
|
}
|
|
318
350
|
|
|
@@ -343,7 +375,7 @@
|
|
|
343
375
|
}
|
|
344
376
|
|
|
345
377
|
// TODO: implement blurEffect on Fabric
|
|
346
|
-
#ifdef
|
|
378
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
347
379
|
#else
|
|
348
380
|
if (config.blurEffect) {
|
|
349
381
|
appearance.backgroundEffect = [UIBlurEffect effectWithStyle:config.blurEffect];
|
|
@@ -404,19 +436,15 @@
|
|
|
404
436
|
appearance.largeTitleTextAttributes = largeAttrs;
|
|
405
437
|
}
|
|
406
438
|
|
|
407
|
-
#ifdef RN_FABRIC_ENABLED
|
|
408
|
-
[appearance setBackIndicatorImage:nil transitionMaskImage:nil];
|
|
409
|
-
#else
|
|
410
439
|
UIImage *backButtonImage = [self loadBackButtonImageInViewController:vc withConfig:config];
|
|
411
440
|
if (backButtonImage) {
|
|
412
441
|
[appearance setBackIndicatorImage:backButtonImage transitionMaskImage:backButtonImage];
|
|
413
442
|
} else if (appearance.backIndicatorImage) {
|
|
414
443
|
[appearance setBackIndicatorImage:nil transitionMaskImage:nil];
|
|
415
444
|
}
|
|
416
|
-
#endif // RN_FABRIC_ENABLED
|
|
417
445
|
return appearance;
|
|
418
446
|
}
|
|
419
|
-
#endif
|
|
447
|
+
#endif // Check for >= iOS 13.0
|
|
420
448
|
|
|
421
449
|
+ (void)updateViewController:(UIViewController *)vc
|
|
422
450
|
withConfig:(RNSScreenStackHeaderConfig *)config
|
|
@@ -430,7 +458,7 @@
|
|
|
430
458
|
currentIndex > 0 ? [navctr.viewControllers objectAtIndex:currentIndex - 1].navigationItem : nil;
|
|
431
459
|
|
|
432
460
|
BOOL wasHidden = navctr.navigationBarHidden;
|
|
433
|
-
#ifdef
|
|
461
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
434
462
|
BOOL shouldHide = config == nil || !config.show;
|
|
435
463
|
#else
|
|
436
464
|
BOOL shouldHide = config == nil || config.hide;
|
|
@@ -460,32 +488,15 @@
|
|
|
460
488
|
}
|
|
461
489
|
|
|
462
490
|
#if !TARGET_OS_TV
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
[config.backTitle stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
|
|
473
|
-
|
|
474
|
-
// When an whitespace only back title is passed set back button mode to minimal.
|
|
475
|
-
if (config.backTitle != nil && [trimmedBackTitle length] == 0) {
|
|
476
|
-
navitem.backButtonDisplayMode = UINavigationItemBackButtonDisplayModeMinimal;
|
|
477
|
-
}
|
|
478
|
-
} else if (
|
|
479
|
-
config.backTitle != nil || config.backTitleFontFamily || config.backTitleFontSize ||
|
|
480
|
-
config.disableBackButtonMenu) {
|
|
481
|
-
RNSUIBarButtonItem *backBarButtonItem = [[RNSUIBarButtonItem alloc] initWithTitle:config.backTitle ?: prevItem.title
|
|
482
|
-
style:UIBarButtonItemStylePlain
|
|
483
|
-
target:nil
|
|
484
|
-
action:nil];
|
|
485
|
-
|
|
486
|
-
[backBarButtonItem setMenuHidden:config.disableBackButtonMenu];
|
|
487
|
-
|
|
488
|
-
prevItem.backBarButtonItem = backBarButtonItem;
|
|
491
|
+
const auto isBackTitleBlank = [NSString RNSisBlank:config.backTitle] == YES;
|
|
492
|
+
NSString *resolvedBackTitle = isBackTitleBlank ? prevItem.title : config.backTitle;
|
|
493
|
+
RNSUIBarButtonItem *backBarButtonItem = [[RNSUIBarButtonItem alloc] initWithTitle:resolvedBackTitle
|
|
494
|
+
style:UIBarButtonItemStylePlain
|
|
495
|
+
target:nil
|
|
496
|
+
action:nil];
|
|
497
|
+
[backBarButtonItem setMenuHidden:config.disableBackButtonMenu];
|
|
498
|
+
|
|
499
|
+
if (config.isBackTitleVisible) {
|
|
489
500
|
if (config.backTitleFontFamily || config.backTitleFontSize) {
|
|
490
501
|
NSMutableDictionary *attrs = [NSMutableDictionary new];
|
|
491
502
|
NSNumber *size = config.backTitleFontSize ?: @17;
|
|
@@ -500,11 +511,18 @@
|
|
|
500
511
|
} else {
|
|
501
512
|
attrs[NSFontAttributeName] = [UIFont boldSystemFontOfSize:[size floatValue]];
|
|
502
513
|
}
|
|
503
|
-
[self setTitleAttibutes:attrs forButton:
|
|
514
|
+
[self setTitleAttibutes:attrs forButton:backBarButtonItem];
|
|
504
515
|
}
|
|
505
516
|
} else {
|
|
506
|
-
|
|
517
|
+
// back button title should be not visible next to back button,
|
|
518
|
+
// but it should still appear in back menu (if one is enabled)
|
|
519
|
+
|
|
520
|
+
// When backBarButtonItem's title is null, back menu will use value
|
|
521
|
+
// of backButtonTitle
|
|
522
|
+
[backBarButtonItem setTitle:nil];
|
|
523
|
+
prevItem.backButtonTitle = resolvedBackTitle;
|
|
507
524
|
}
|
|
525
|
+
prevItem.backBarButtonItem = backBarButtonItem;
|
|
508
526
|
|
|
509
527
|
if (@available(iOS 11.0, *)) {
|
|
510
528
|
if (config.largeTitle) {
|
|
@@ -594,9 +612,6 @@
|
|
|
594
612
|
break;
|
|
595
613
|
}
|
|
596
614
|
case RNSScreenStackHeaderSubviewTypeBackButton: {
|
|
597
|
-
#ifdef RN_FABRIC_ENABLED
|
|
598
|
-
RCTLogWarn(@"Back button subview is not yet Fabric compatible in react-native-screens");
|
|
599
|
-
#endif
|
|
600
615
|
break;
|
|
601
616
|
}
|
|
602
617
|
}
|
|
@@ -654,7 +669,7 @@
|
|
|
654
669
|
[self updateViewControllerIfNeeded];
|
|
655
670
|
}
|
|
656
671
|
|
|
657
|
-
#ifdef
|
|
672
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
658
673
|
#pragma mark - Fabric specific
|
|
659
674
|
|
|
660
675
|
- (void)mountChildComponentView:(UIView<RCTComponentViewProtocol> *)childComponentView index:(NSInteger)index
|
|
@@ -683,6 +698,39 @@
|
|
|
683
698
|
[childComponentView removeFromSuperview];
|
|
684
699
|
}
|
|
685
700
|
|
|
701
|
+
static RCTResizeMode resizeModeFromCppEquiv(rct::ImageResizeMode resizeMode)
|
|
702
|
+
{
|
|
703
|
+
switch (resizeMode) {
|
|
704
|
+
case rct::ImageResizeMode::Cover:
|
|
705
|
+
return RCTResizeModeCover;
|
|
706
|
+
case rct::ImageResizeMode::Contain:
|
|
707
|
+
return RCTResizeModeContain;
|
|
708
|
+
case rct::ImageResizeMode::Stretch:
|
|
709
|
+
return RCTResizeModeStretch;
|
|
710
|
+
case rct::ImageResizeMode::Center:
|
|
711
|
+
return RCTResizeModeCenter;
|
|
712
|
+
case rct::ImageResizeMode::Repeat:
|
|
713
|
+
return RCTResizeModeRepeat;
|
|
714
|
+
}
|
|
715
|
+
}
|
|
716
|
+
|
|
717
|
+
/**
|
|
718
|
+
* Fabric implementation of helper method for +loadBackButtonImageInViewController:withConfig:
|
|
719
|
+
* There is corresponding Paper implementation (with different parameter type) in Paper specific section.
|
|
720
|
+
*/
|
|
721
|
+
+ (RCTImageSource *)imageSourceFromImageView:(RCTImageComponentView *)view
|
|
722
|
+
{
|
|
723
|
+
auto const imageProps = *std::static_pointer_cast<const rct::ImageProps>(view.props);
|
|
724
|
+
rct::ImageSource cppImageSource = imageProps.sources.at(0);
|
|
725
|
+
auto imageSize = CGSize{cppImageSource.size.width, cppImageSource.size.height};
|
|
726
|
+
NSURLRequest *request =
|
|
727
|
+
[NSURLRequest requestWithURL:[NSURL URLWithString:RCTNSStringFromStringNilIfEmpty(cppImageSource.uri)]];
|
|
728
|
+
RCTImageSource *imageSource = [[RCTImageSource alloc] initWithURLRequest:request
|
|
729
|
+
size:imageSize
|
|
730
|
+
scale:cppImageSource.scale];
|
|
731
|
+
return imageSource;
|
|
732
|
+
}
|
|
733
|
+
|
|
686
734
|
#pragma mark - RCTComponentViewProtocol
|
|
687
735
|
|
|
688
736
|
- (void)prepareForRecycle
|
|
@@ -691,10 +739,9 @@
|
|
|
691
739
|
_initialPropsSet = NO;
|
|
692
740
|
}
|
|
693
741
|
|
|
694
|
-
+ (
|
|
742
|
+
+ (rct::ComponentDescriptorProvider)componentDescriptorProvider
|
|
695
743
|
{
|
|
696
|
-
return
|
|
697
|
-
facebook::react::RNSScreenStackHeaderConfigComponentDescriptor>();
|
|
744
|
+
return rct::concreteComponentDescriptorProvider<rct::RNSScreenStackHeaderConfigComponentDescriptor>();
|
|
698
745
|
}
|
|
699
746
|
|
|
700
747
|
- (NSNumber *)getFontSizePropValue:(int)value
|
|
@@ -704,24 +751,20 @@
|
|
|
704
751
|
return nil;
|
|
705
752
|
}
|
|
706
753
|
|
|
707
|
-
- (UISemanticContentAttribute)getDirectionPropValue:(
|
|
754
|
+
- (UISemanticContentAttribute)getDirectionPropValue:(rct::RNSScreenStackHeaderConfigDirection)direction
|
|
708
755
|
{
|
|
709
756
|
switch (direction) {
|
|
710
|
-
case
|
|
757
|
+
case rct::RNSScreenStackHeaderConfigDirection::Rtl:
|
|
711
758
|
return UISemanticContentAttributeForceRightToLeft;
|
|
712
|
-
case
|
|
759
|
+
case rct::RNSScreenStackHeaderConfigDirection::Ltr:
|
|
713
760
|
return UISemanticContentAttributeForceLeftToRight;
|
|
714
761
|
}
|
|
715
762
|
}
|
|
716
763
|
|
|
717
|
-
- (void)updateProps:(
|
|
718
|
-
oldProps:(facebook::react::Props::Shared const &)oldProps
|
|
764
|
+
- (void)updateProps:(rct::Props::Shared const &)props oldProps:(rct::Props::Shared const &)oldProps
|
|
719
765
|
{
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
const auto &oldScreenProps =
|
|
723
|
-
*std::static_pointer_cast<const facebook::react::RNSScreenStackHeaderConfigProps>(_props);
|
|
724
|
-
const auto &newScreenProps = *std::static_pointer_cast<const facebook::react::RNSScreenStackHeaderConfigProps>(props);
|
|
766
|
+
const auto &oldScreenProps = *std::static_pointer_cast<const rct::RNSScreenStackHeaderConfigProps>(_props);
|
|
767
|
+
const auto &newScreenProps = *std::static_pointer_cast<const rct::RNSScreenStackHeaderConfigProps>(props);
|
|
725
768
|
|
|
726
769
|
BOOL needsNavigationControllerLayout = !_initialPropsSet;
|
|
727
770
|
|
|
@@ -767,6 +810,8 @@
|
|
|
767
810
|
_direction = [self getDirectionPropValue:newScreenProps.direction];
|
|
768
811
|
}
|
|
769
812
|
|
|
813
|
+
_backTitleVisible = newScreenProps.backTitleVisible;
|
|
814
|
+
|
|
770
815
|
// We cannot compare SharedColor because it is shared value.
|
|
771
816
|
// We could compare color value, but it is more performant to just assign new value
|
|
772
817
|
_titleColor = RCTUIColorFromSharedColor(newScreenProps.titleColor);
|
|
@@ -781,7 +826,9 @@
|
|
|
781
826
|
}
|
|
782
827
|
|
|
783
828
|
_initialPropsSet = YES;
|
|
784
|
-
_props = std::static_pointer_cast<
|
|
829
|
+
_props = std::static_pointer_cast<rct::RNSScreenStackHeaderConfigProps const>(props);
|
|
830
|
+
|
|
831
|
+
[super updateProps:props oldProps:oldProps];
|
|
785
832
|
}
|
|
786
833
|
|
|
787
834
|
#else
|
|
@@ -799,10 +846,19 @@
|
|
|
799
846
|
}
|
|
800
847
|
}
|
|
801
848
|
|
|
849
|
+
/**
|
|
850
|
+
* Paper implementation of helper method for +loadBackButtonImageInViewController:withConfig:
|
|
851
|
+
* There is corresponding Fabric implementation (with different parameter type) in Fabric specific section.
|
|
852
|
+
*/
|
|
853
|
+
+ (RCTImageSource *)imageSourceFromImageView:(RCTImageView *)view
|
|
854
|
+
{
|
|
855
|
+
return view.imageSources[0];
|
|
856
|
+
}
|
|
857
|
+
|
|
802
858
|
#endif
|
|
803
859
|
@end
|
|
804
860
|
|
|
805
|
-
#ifdef
|
|
861
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
806
862
|
Class<RCTComponentViewProtocol> RNSScreenStackHeaderConfigCls(void)
|
|
807
863
|
{
|
|
808
864
|
return RNSScreenStackHeaderConfig.class;
|
|
@@ -827,6 +883,7 @@ RCT_EXPORT_VIEW_PROPERTY(backTitle, NSString)
|
|
|
827
883
|
RCT_EXPORT_VIEW_PROPERTY(backTitleFontFamily, NSString)
|
|
828
884
|
RCT_EXPORT_VIEW_PROPERTY(backTitleFontSize, NSNumber)
|
|
829
885
|
RCT_EXPORT_VIEW_PROPERTY(backgroundColor, UIColor)
|
|
886
|
+
RCT_EXPORT_VIEW_PROPERTY(backTitleVisible, BOOL)
|
|
830
887
|
RCT_EXPORT_VIEW_PROPERTY(blurEffect, UIBlurEffectStyle)
|
|
831
888
|
RCT_EXPORT_VIEW_PROPERTY(color, UIColor)
|
|
832
889
|
RCT_EXPORT_VIEW_PROPERTY(direction, UISemanticContentAttribute)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
#ifdef
|
|
2
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
3
3
|
#import <React/RCTViewComponentView.h>
|
|
4
4
|
#endif
|
|
5
5
|
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
NS_ASSUME_NONNULL_BEGIN
|
|
11
11
|
|
|
12
12
|
@interface RNSScreenStackHeaderSubview :
|
|
13
|
-
#ifdef
|
|
13
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
14
14
|
RCTViewComponentView
|
|
15
15
|
#else
|
|
16
16
|
UIView
|
|
@@ -20,13 +20,12 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
20
20
|
|
|
21
21
|
@property (nonatomic, weak) UIView *reactSuperview;
|
|
22
22
|
|
|
23
|
-
#ifdef RN_FABRIC_ENABLED
|
|
24
|
-
#else
|
|
25
23
|
@property (nonatomic, weak) RCTBridge *bridge;
|
|
26
24
|
|
|
25
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
26
|
+
#else
|
|
27
27
|
- (instancetype)initWithBridge:(RCTBridge *)bridge;
|
|
28
|
-
|
|
29
|
-
#endif
|
|
28
|
+
#endif // RCT_NEW_ARCH_ENABLED
|
|
30
29
|
|
|
31
30
|
@end
|
|
32
31
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#import "RNSScreenStackHeaderSubview.h"
|
|
2
2
|
#import "RNSConvert.h"
|
|
3
3
|
|
|
4
|
-
#ifdef
|
|
4
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
5
5
|
#import <react/renderer/components/rnscreens/ComponentDescriptors.h>
|
|
6
6
|
#import <react/renderer/components/rnscreens/EventEmitters.h>
|
|
7
7
|
#import <react/renderer/components/rnscreens/RCTComponentViewHelpers.h>
|
|
@@ -10,11 +10,15 @@
|
|
|
10
10
|
#import <React/RCTFabricComponentsPlugins.h>
|
|
11
11
|
#endif
|
|
12
12
|
|
|
13
|
+
@interface RCTBridge (Private)
|
|
14
|
+
+ (RCTBridge *)currentBridge;
|
|
15
|
+
@end
|
|
16
|
+
|
|
13
17
|
@implementation RNSScreenStackHeaderSubview
|
|
14
18
|
|
|
15
19
|
#pragma mark - Common
|
|
16
20
|
|
|
17
|
-
#ifdef
|
|
21
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
18
22
|
|
|
19
23
|
#pragma mark - Fabric specific
|
|
20
24
|
|
|
@@ -40,13 +44,8 @@
|
|
|
40
44
|
{
|
|
41
45
|
const auto &newHeaderSubviewProps =
|
|
42
46
|
*std::static_pointer_cast<const facebook::react::RNSScreenStackHeaderSubviewProps>(props);
|
|
43
|
-
const auto &oldHeaderSubviewProps =
|
|
44
|
-
*std::static_pointer_cast<const facebook::react::RNSScreenStackHeaderSubviewProps>(_props);
|
|
45
|
-
|
|
46
|
-
if (newHeaderSubviewProps.type != oldHeaderSubviewProps.type) {
|
|
47
|
-
_type = [RNSConvert RNSScreenStackHeaderSubviewTypeFromCppEquivalent:newHeaderSubviewProps.type];
|
|
48
|
-
}
|
|
49
47
|
|
|
48
|
+
[self setType:[RNSConvert RNSScreenStackHeaderSubviewTypeFromCppEquivalent:newHeaderSubviewProps.type]];
|
|
50
49
|
[super updateProps:props oldProps:oldProps];
|
|
51
50
|
}
|
|
52
51
|
|
|
@@ -93,7 +92,17 @@
|
|
|
93
92
|
[super reactSetFrame:CGRectMake(0, 0, frame.size.width, frame.size.height)];
|
|
94
93
|
}
|
|
95
94
|
|
|
96
|
-
#endif //
|
|
95
|
+
#endif // RCT_NEW_ARCH_ENABLED
|
|
96
|
+
|
|
97
|
+
- (RCTBridge *)bridge
|
|
98
|
+
{
|
|
99
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
100
|
+
return [RCTBridge currentBridge];
|
|
101
|
+
#else
|
|
102
|
+
return _bridge;
|
|
103
|
+
#endif // RCT_NEW_ARCH_ENABLED
|
|
104
|
+
}
|
|
105
|
+
|
|
97
106
|
@end
|
|
98
107
|
|
|
99
108
|
@implementation RNSScreenStackHeaderSubviewManager
|
|
@@ -102,7 +111,7 @@ RCT_EXPORT_MODULE()
|
|
|
102
111
|
|
|
103
112
|
RCT_EXPORT_VIEW_PROPERTY(type, RNSScreenStackHeaderSubviewType)
|
|
104
113
|
|
|
105
|
-
#ifdef
|
|
114
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
106
115
|
#else
|
|
107
116
|
- (UIView *)view
|
|
108
117
|
{
|
|
@@ -112,7 +121,7 @@ RCT_EXPORT_VIEW_PROPERTY(type, RNSScreenStackHeaderSubviewType)
|
|
|
112
121
|
|
|
113
122
|
@end
|
|
114
123
|
|
|
115
|
-
#ifdef
|
|
124
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
116
125
|
Class<RCTComponentViewProtocol> RNSScreenStackHeaderSubviewCls(void)
|
|
117
126
|
{
|
|
118
127
|
return RNSScreenStackHeaderSubview.class;
|
|
@@ -174,8 +174,27 @@
|
|
|
174
174
|
}
|
|
175
175
|
}
|
|
176
176
|
if (newOrientation != UIInterfaceOrientationUnknown) {
|
|
177
|
-
|
|
178
|
-
|
|
177
|
+
if (@available(iOS 16.0, *)) {
|
|
178
|
+
NSArray *array = [[[UIApplication sharedApplication] connectedScenes] allObjects];
|
|
179
|
+
UIWindowScene *scene = (UIWindowScene *)array[0];
|
|
180
|
+
UIWindowSceneGeometryPreferencesIOS *geometryPreferences =
|
|
181
|
+
[[UIWindowSceneGeometryPreferencesIOS alloc] initWithInterfaceOrientations:orientationMask];
|
|
182
|
+
[scene requestGeometryUpdateWithPreferences:geometryPreferences
|
|
183
|
+
errorHandler:^(NSError *_Nonnull error){
|
|
184
|
+
}];
|
|
185
|
+
|
|
186
|
+
// `attemptRotationToDeviceOrientation` is deprecated for modern OS versions
|
|
187
|
+
// so we need to use `setNeedsUpdateOfSupportedInterfaceOrientations`
|
|
188
|
+
UIViewController *topController = [UIApplication sharedApplication].keyWindow.rootViewController;
|
|
189
|
+
while (topController.presentedViewController) {
|
|
190
|
+
topController = topController.presentedViewController;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
[topController setNeedsUpdateOfSupportedInterfaceOrientations];
|
|
194
|
+
} else {
|
|
195
|
+
[[UIDevice currentDevice] setValue:@(newOrientation) forKey:@"orientation"];
|
|
196
|
+
[UIViewController attemptRotationToDeviceOrientation];
|
|
197
|
+
}
|
|
179
198
|
}
|
|
180
199
|
});
|
|
181
200
|
#endif
|
package/ios/RNSSearchBar.h
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
#import <UIKit/UIKit.h>
|
|
2
2
|
|
|
3
|
-
#ifdef
|
|
3
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
4
4
|
#import <React/RCTViewComponentView.h>
|
|
5
|
+
#import <react/renderer/components/rnscreens/RCTComponentViewHelpers.h>
|
|
5
6
|
#endif
|
|
6
7
|
|
|
7
8
|
#import <React/RCTBridge.h>
|
|
@@ -9,8 +10,8 @@
|
|
|
9
10
|
#import <React/RCTViewManager.h>
|
|
10
11
|
|
|
11
12
|
@interface RNSSearchBar :
|
|
12
|
-
#ifdef
|
|
13
|
-
RCTViewComponentView <UISearchBarDelegate>
|
|
13
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
14
|
+
RCTViewComponentView <UISearchBarDelegate, RCTRNSSearchBarViewProtocol>
|
|
14
15
|
#else
|
|
15
16
|
UIView <UISearchBarDelegate>
|
|
16
17
|
#endif
|
|
@@ -19,7 +20,7 @@
|
|
|
19
20
|
|
|
20
21
|
@property (nonatomic, retain) UISearchController *controller;
|
|
21
22
|
|
|
22
|
-
#ifdef
|
|
23
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
23
24
|
#else
|
|
24
25
|
@property (nonatomic, copy) RCTBubblingEventBlock onChangeText;
|
|
25
26
|
@property (nonatomic, copy) RCTBubblingEventBlock onCancelButtonPress;
|