react-native-screens 3.22.0 → 3.23.0
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/android/src/main/java/com/swmansion/rnscreens/SearchBarManager.kt +2 -0
- package/ios/RNSConvert.h +2 -0
- package/ios/RNSConvert.mm +12 -0
- package/ios/RNSEnums.h +6 -0
- package/ios/RNSFullWindowOverlay.mm +11 -0
- package/ios/RNSScreen.h +10 -2
- package/ios/RNSScreen.mm +44 -16
- package/ios/RNSScreenContainer.h +2 -2
- package/ios/RNSScreenContainer.mm +2 -2
- package/ios/RNSScreenNavigationContainer.h +1 -1
- package/ios/RNSScreenNavigationContainer.mm +4 -4
- package/ios/RNSScreenStack.h +1 -1
- package/ios/RNSScreenStack.mm +3 -5
- package/ios/RNSScreenStackHeaderConfig.mm +7 -1
- package/ios/RNSScreenWindowTraits.mm +5 -5
- package/ios/RNSSearchBar.h +5 -1
- package/ios/RNSSearchBar.mm +32 -0
- package/ios/UIViewController+RNScreens.mm +7 -7
- package/lib/commonjs/fabric/ScreenNativeComponent.js.map +1 -1
- package/lib/commonjs/fabric/SearchBarNativeComponent.js.map +1 -1
- package/lib/commonjs/index.native.js +20 -1
- package/lib/commonjs/index.native.js.map +1 -1
- package/lib/commonjs/native-stack/types.js.map +1 -1
- package/lib/commonjs/native-stack/utils/getDefaultHeaderHeight.js +10 -6
- package/lib/commonjs/native-stack/utils/getDefaultHeaderHeight.js.map +1 -1
- package/lib/commonjs/native-stack/views/NativeStackView.js +35 -8
- package/lib/commonjs/native-stack/views/NativeStackView.js.map +1 -1
- package/lib/commonjs/types.js.map +1 -1
- package/lib/module/fabric/ScreenNativeComponent.js.map +1 -1
- package/lib/module/fabric/SearchBarNativeComponent.js.map +1 -1
- package/lib/module/index.native.js +20 -1
- package/lib/module/index.native.js.map +1 -1
- package/lib/module/native-stack/types.js.map +1 -1
- package/lib/module/native-stack/utils/getDefaultHeaderHeight.js +10 -6
- package/lib/module/native-stack/utils/getDefaultHeaderHeight.js.map +1 -1
- package/lib/module/native-stack/views/NativeStackView.js +35 -8
- package/lib/module/native-stack/views/NativeStackView.js.map +1 -1
- package/lib/module/types.js.map +1 -1
- package/lib/typescript/fabric/ScreenNativeComponent.d.ts +1 -0
- package/lib/typescript/fabric/SearchBarNativeComponent.d.ts +2 -0
- package/lib/typescript/native-stack/types.d.ts +6 -0
- package/lib/typescript/native-stack/utils/getDefaultHeaderHeight.d.ts +1 -1
- package/lib/typescript/types.d.ts +19 -0
- package/native-stack/README.md +12 -1
- package/package.json +1 -1
- package/src/fabric/ScreenNativeComponent.ts +1 -0
- package/src/fabric/SearchBarNativeComponent.ts +3 -0
- package/src/index.native.tsx +22 -0
- package/src/native-stack/types.tsx +4 -0
- package/src/native-stack/utils/getDefaultHeaderHeight.tsx +11 -7
- package/src/native-stack/views/NativeStackView.tsx +36 -6
- package/src/types.tsx +19 -0
|
@@ -97,6 +97,8 @@ class SearchBarManager : ViewGroupManager<SearchBarView>() {
|
|
|
97
97
|
view.shouldShowHintSearchIcon = shouldShowHintSearchIcon ?: true
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
+
fun setPlacement(view: SearchBarView, placeholder: String?) = Unit
|
|
101
|
+
|
|
100
102
|
override fun receiveCommand(root: SearchBarView, commandId: String?, args: ReadableArray?) {
|
|
101
103
|
when (commandId) {
|
|
102
104
|
"focus" -> root.handleFocusJsRequest()
|
package/ios/RNSConvert.h
CHANGED
|
@@ -31,6 +31,8 @@
|
|
|
31
31
|
+ (UITextAutocapitalizationType)UITextAutocapitalizationTypeFromCppEquivalent:
|
|
32
32
|
(facebook::react::RNSSearchBarAutoCapitalize)autoCapitalize;
|
|
33
33
|
|
|
34
|
+
+ (RNSSearchBarPlacement)RNSScreenSearchBarPlacementFromCppEquivalent:(facebook::react::RNSSearchBarPlacement)placement;
|
|
35
|
+
|
|
34
36
|
@end
|
|
35
37
|
|
|
36
38
|
#endif // RCT_NEW_ARCH_ENABLED
|
package/ios/RNSConvert.mm
CHANGED
|
@@ -141,6 +141,18 @@
|
|
|
141
141
|
}
|
|
142
142
|
}
|
|
143
143
|
|
|
144
|
+
+ (RNSSearchBarPlacement)RNSScreenSearchBarPlacementFromCppEquivalent:(facebook::react::RNSSearchBarPlacement)placement
|
|
145
|
+
{
|
|
146
|
+
switch (placement) {
|
|
147
|
+
case facebook::react::RNSSearchBarPlacement::Stacked:
|
|
148
|
+
return RNSSearchBarPlacementStacked;
|
|
149
|
+
case facebook::react::RNSSearchBarPlacement::Automatic:
|
|
150
|
+
return RNSSearchBarPlacementAutomatic;
|
|
151
|
+
case facebook::react::RNSSearchBarPlacement::Inline:
|
|
152
|
+
return RNSSearchBarPlacementInline;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
144
156
|
@end
|
|
145
157
|
|
|
146
158
|
#endif // RCT_NEW_ARCH_ENABLED
|
package/ios/RNSEnums.h
CHANGED
|
@@ -63,3 +63,9 @@ typedef NS_ENUM(NSInteger, RNSScreenDetentType) {
|
|
|
63
63
|
RNSScreenDetentTypeLarge,
|
|
64
64
|
RNSScreenDetentTypeAll,
|
|
65
65
|
};
|
|
66
|
+
|
|
67
|
+
typedef NS_ENUM(NSInteger, RNSSearchBarPlacement) {
|
|
68
|
+
RNSSearchBarPlacementAutomatic,
|
|
69
|
+
RNSSearchBarPlacementInline,
|
|
70
|
+
RNSSearchBarPlacementStacked,
|
|
71
|
+
};
|
|
@@ -15,6 +15,14 @@
|
|
|
15
15
|
|
|
16
16
|
@implementation RNSFullWindowOverlayContainer
|
|
17
17
|
|
|
18
|
+
- (instancetype)initWithFrame:(CGRect)frame
|
|
19
|
+
{
|
|
20
|
+
if (self = [super initWithFrame:frame]) {
|
|
21
|
+
self.accessibilityViewIsModal = YES;
|
|
22
|
+
}
|
|
23
|
+
return self;
|
|
24
|
+
}
|
|
25
|
+
|
|
18
26
|
- (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event
|
|
19
27
|
{
|
|
20
28
|
for (UIView *view in [self subviews]) {
|
|
@@ -127,6 +135,9 @@
|
|
|
127
135
|
[_touchHandler detachFromView:_container];
|
|
128
136
|
}
|
|
129
137
|
} else {
|
|
138
|
+
if (_container != nil) {
|
|
139
|
+
UIAccessibilityPostNotification(UIAccessibilityLayoutChangedNotification, _container);
|
|
140
|
+
}
|
|
130
141
|
if (_touchHandler == nil) {
|
|
131
142
|
#ifdef RCT_NEW_ARCH_ENABLED
|
|
132
143
|
_touchHandler = [RCTSurfaceTouchHandler new];
|
package/ios/RNSScreen.h
CHANGED
|
@@ -27,7 +27,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
27
27
|
|
|
28
28
|
@class RNSScreenView;
|
|
29
29
|
|
|
30
|
-
@interface RNSScreen : UIViewController <
|
|
30
|
+
@interface RNSScreen : UIViewController <RNSViewControllerDelegate>
|
|
31
31
|
|
|
32
32
|
- (instancetype)initWithView:(UIView *)view;
|
|
33
33
|
- (UIViewController *)findChildVCForConfigAndTrait:(RNSWindowTrait)trait includingModals:(BOOL)includingModals;
|
|
@@ -40,6 +40,8 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
40
40
|
|
|
41
41
|
@end
|
|
42
42
|
|
|
43
|
+
@class RNSScreenStackHeaderConfig;
|
|
44
|
+
|
|
43
45
|
@interface RNSScreenView :
|
|
44
46
|
#ifdef RCT_NEW_ARCH_ENABLED
|
|
45
47
|
RCTViewComponentView
|
|
@@ -88,7 +90,8 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
88
90
|
// we recreate the behavior of `reactSetFrame` on new architecture
|
|
89
91
|
@property (nonatomic) facebook::react::LayoutMetrics oldLayoutMetrics;
|
|
90
92
|
@property (nonatomic) facebook::react::LayoutMetrics newLayoutMetrics;
|
|
91
|
-
@property (weak, nonatomic)
|
|
93
|
+
@property (weak, nonatomic) RNSScreenStackHeaderConfig *config;
|
|
94
|
+
@property (nonatomic, readonly) BOOL hasHeaderConfig;
|
|
92
95
|
#else
|
|
93
96
|
@property (nonatomic, copy) RCTDirectEventBlock onAppear;
|
|
94
97
|
@property (nonatomic, copy) RCTDirectEventBlock onDisappear;
|
|
@@ -97,6 +100,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
97
100
|
@property (nonatomic, copy) RCTDirectEventBlock onWillDisappear;
|
|
98
101
|
@property (nonatomic, copy) RCTDirectEventBlock onNativeDismissCancelled;
|
|
99
102
|
@property (nonatomic, copy) RCTDirectEventBlock onTransitionProgress;
|
|
103
|
+
@property (nonatomic, copy) RCTDirectEventBlock onGestureCancel;
|
|
100
104
|
#endif // RCT_NEW_ARCH_ENABLED
|
|
101
105
|
|
|
102
106
|
- (void)notifyFinishTransitioning;
|
|
@@ -108,12 +112,16 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
108
112
|
- (void)notifyDisappear;
|
|
109
113
|
- (void)updateBounds;
|
|
110
114
|
- (void)notifyDismissedWithCount:(int)dismissCount;
|
|
115
|
+
- (instancetype)initWithFrame:(CGRect)frame;
|
|
111
116
|
#endif
|
|
112
117
|
|
|
113
118
|
- (void)notifyTransitionProgress:(double)progress closing:(BOOL)closing goingForward:(BOOL)goingForward;
|
|
114
119
|
- (void)notifyDismissCancelledWithDismissCount:(int)dismissCount;
|
|
115
120
|
- (BOOL)isModal;
|
|
116
121
|
|
|
122
|
+
/// Looks for header configuration in instance's `reactSubviews` and returns it. If not present returns `nil`.
|
|
123
|
+
- (RNSScreenStackHeaderConfig *_Nullable)findHeaderConfig;
|
|
124
|
+
|
|
117
125
|
@end
|
|
118
126
|
|
|
119
127
|
@interface UIView (RNSScreen)
|
package/ios/RNSScreen.mm
CHANGED
|
@@ -54,7 +54,6 @@
|
|
|
54
54
|
_reactSubviews = [NSMutableArray new];
|
|
55
55
|
[self initCommonProps];
|
|
56
56
|
}
|
|
57
|
-
|
|
58
57
|
return self;
|
|
59
58
|
}
|
|
60
59
|
#endif // RCT_NEW_ARCH_ENABLED
|
|
@@ -392,6 +391,20 @@
|
|
|
392
391
|
#endif
|
|
393
392
|
}
|
|
394
393
|
|
|
394
|
+
- (void)notifyGestureCancel
|
|
395
|
+
{
|
|
396
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
397
|
+
if (_eventEmitter != nullptr) {
|
|
398
|
+
std::dynamic_pointer_cast<const facebook::react::RNSScreenEventEmitter>(_eventEmitter)
|
|
399
|
+
->onGestureCancel(facebook::react::RNSScreenEventEmitter::OnGestureCancel{});
|
|
400
|
+
}
|
|
401
|
+
#else
|
|
402
|
+
if (self.onGestureCancel) {
|
|
403
|
+
self.onGestureCancel(nil);
|
|
404
|
+
}
|
|
405
|
+
#endif
|
|
406
|
+
}
|
|
407
|
+
|
|
395
408
|
- (BOOL)isMountedUnderScreenOrReactRoot
|
|
396
409
|
{
|
|
397
410
|
#ifdef RCT_NEW_ARCH_ENABLED
|
|
@@ -517,6 +530,16 @@
|
|
|
517
530
|
return self.stackPresentation != RNSScreenStackPresentationPush;
|
|
518
531
|
}
|
|
519
532
|
|
|
533
|
+
- (RNSScreenStackHeaderConfig *_Nullable)findHeaderConfig
|
|
534
|
+
{
|
|
535
|
+
for (UIView *view in self.reactSubviews) {
|
|
536
|
+
if ([view isKindOfClass:RNSScreenStackHeaderConfig.class]) {
|
|
537
|
+
return (RNSScreenStackHeaderConfig *)view;
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
return nil;
|
|
541
|
+
}
|
|
542
|
+
|
|
520
543
|
#if !TARGET_OS_TV
|
|
521
544
|
/**
|
|
522
545
|
* Updates settings for sheet presentation controller.
|
|
@@ -574,6 +597,11 @@
|
|
|
574
597
|
#pragma mark - Fabric specific
|
|
575
598
|
#ifdef RCT_NEW_ARCH_ENABLED
|
|
576
599
|
|
|
600
|
+
- (BOOL)hasHeaderConfig
|
|
601
|
+
{
|
|
602
|
+
return _config != nil;
|
|
603
|
+
}
|
|
604
|
+
|
|
577
605
|
+ (facebook::react::ComponentDescriptorProvider)componentDescriptorProvider
|
|
578
606
|
{
|
|
579
607
|
return facebook::react::concreteComponentDescriptorProvider<facebook::react::RNSScreenComponentDescriptor>();
|
|
@@ -581,12 +609,12 @@
|
|
|
581
609
|
|
|
582
610
|
- (void)mountChildComponentView:(UIView<RCTComponentViewProtocol> *)childComponentView index:(NSInteger)index
|
|
583
611
|
{
|
|
584
|
-
[super mountChildComponentView:childComponentView index:index];
|
|
585
612
|
if ([childComponentView isKindOfClass:[RNSScreenStackHeaderConfig class]]) {
|
|
586
|
-
_config = childComponentView;
|
|
587
|
-
|
|
613
|
+
_config = (RNSScreenStackHeaderConfig *)childComponentView;
|
|
614
|
+
_config.screenView = self;
|
|
588
615
|
}
|
|
589
616
|
[_reactSubviews insertObject:childComponentView atIndex:index];
|
|
617
|
+
[super mountChildComponentView:childComponentView index:index];
|
|
590
618
|
}
|
|
591
619
|
|
|
592
620
|
- (void)unmountChildComponentView:(UIView<RCTComponentViewProtocol> *)childComponentView index:(NSInteger)index
|
|
@@ -716,10 +744,10 @@
|
|
|
716
744
|
_newLayoutMetrics = layoutMetrics;
|
|
717
745
|
_oldLayoutMetrics = oldLayoutMetrics;
|
|
718
746
|
UIViewController *parentVC = self.reactViewController.parentViewController;
|
|
719
|
-
if (parentVC != nil && ![parentVC isKindOfClass:[
|
|
747
|
+
if (parentVC != nil && ![parentVC isKindOfClass:[RNSNavigationController class]]) {
|
|
720
748
|
[super updateLayoutMetrics:layoutMetrics oldLayoutMetrics:oldLayoutMetrics];
|
|
721
749
|
}
|
|
722
|
-
// when screen is mounted under
|
|
750
|
+
// when screen is mounted under RNSNavigationController it's size is controller
|
|
723
751
|
// by the navigation controller itself. That is, it is set to fill space of
|
|
724
752
|
// the controller. In that case we ignore react layout system from managing
|
|
725
753
|
// the screen dimensions and we wait for the screen VC to update and then we
|
|
@@ -756,10 +784,10 @@
|
|
|
756
784
|
{
|
|
757
785
|
_reactFrame = frame;
|
|
758
786
|
UIViewController *parentVC = self.reactViewController.parentViewController;
|
|
759
|
-
if (parentVC != nil && ![parentVC isKindOfClass:[
|
|
787
|
+
if (parentVC != nil && ![parentVC isKindOfClass:[RNSNavigationController class]]) {
|
|
760
788
|
[super reactSetFrame:frame];
|
|
761
789
|
}
|
|
762
|
-
// when screen is mounted under
|
|
790
|
+
// when screen is mounted under RNSNavigationController it's size is controller
|
|
763
791
|
// by the navigation controller itself. That is, it is set to fill space of
|
|
764
792
|
// the controller. In that case we ignore react layout system from managing
|
|
765
793
|
// the screen dimensions and we wait for the screen VC to update and then we
|
|
@@ -886,6 +914,8 @@ Class<RCTComponentViewProtocol> RNSScreenCls(void)
|
|
|
886
914
|
// or successfully swiped back
|
|
887
915
|
[self.screenView notifyAppear];
|
|
888
916
|
[self notifyTransitionProgress:1.0 closing:NO goingForward:_goingForward];
|
|
917
|
+
} else {
|
|
918
|
+
[self.screenView notifyGestureCancel];
|
|
889
919
|
}
|
|
890
920
|
|
|
891
921
|
_isSwiping = NO;
|
|
@@ -928,12 +958,11 @@ Class<RCTComponentViewProtocol> RNSScreenCls(void)
|
|
|
928
958
|
[super viewDidLayoutSubviews];
|
|
929
959
|
|
|
930
960
|
// The below code makes the screen view adapt dimensions provided by the system. We take these
|
|
931
|
-
// into account only when the view is mounted under
|
|
961
|
+
// into account only when the view is mounted under RNSNavigationController in which case system
|
|
932
962
|
// provides additional padding to account for possible header, and in the case when screen is
|
|
933
963
|
// shown as a native modal, as the final dimensions of the modal on iOS 12+ are shorter than the
|
|
934
964
|
// screen size
|
|
935
|
-
BOOL isDisplayedWithinUINavController =
|
|
936
|
-
[self.parentViewController isKindOfClass:[RNScreensNavigationController class]];
|
|
965
|
+
BOOL isDisplayedWithinUINavController = [self.parentViewController isKindOfClass:[RNSNavigationController class]];
|
|
937
966
|
BOOL isPresentedAsNativeModal = self.parentViewController == nil && self.presentingViewController != nil;
|
|
938
967
|
|
|
939
968
|
if (isDisplayedWithinUINavController || isPresentedAsNativeModal) {
|
|
@@ -1048,7 +1077,7 @@ Class<RCTComponentViewProtocol> RNSScreenCls(void)
|
|
|
1048
1077
|
if (lastViewController == nil) {
|
|
1049
1078
|
return selfOrNil;
|
|
1050
1079
|
} else {
|
|
1051
|
-
if ([lastViewController conformsToProtocol:@protocol(
|
|
1080
|
+
if ([lastViewController conformsToProtocol:@protocol(RNSViewControllerDelegate)]) {
|
|
1052
1081
|
// If there is a child (should be VC of ScreenContainer or ScreenStack), that has a child that could provide the
|
|
1053
1082
|
// trait, we recursively go into its findChildVCForConfig, and if one of the children has the trait set, we return
|
|
1054
1083
|
// it, otherwise we return self if this VC has config, and nil if it doesn't we use
|
|
@@ -1178,12 +1207,10 @@ Class<RCTComponentViewProtocol> RNSScreenCls(void)
|
|
|
1178
1207
|
|
|
1179
1208
|
// we need to check whether reactSubviews array is empty, because on Fabric child nodes are unmounted first ->
|
|
1180
1209
|
// reactSubviews array may be empty
|
|
1181
|
-
|
|
1182
|
-
|
|
1210
|
+
RNSScreenStackHeaderConfig *config = [self.screenView findHeaderConfig];
|
|
1211
|
+
if (currentIndex > 0 && config != nil) {
|
|
1183
1212
|
UINavigationItem *prevNavigationItem =
|
|
1184
1213
|
[self.navigationController.viewControllers objectAtIndex:currentIndex - 1].navigationItem;
|
|
1185
|
-
RNSScreenStackHeaderConfig *config = ((RNSScreenStackHeaderConfig *)self.screenView.reactSubviews[0]);
|
|
1186
|
-
|
|
1187
1214
|
BOOL wasSearchBarActive = prevNavigationItem.searchController.active;
|
|
1188
1215
|
|
|
1189
1216
|
#ifdef RCT_NEW_ARCH_ENABLED
|
|
@@ -1275,6 +1302,7 @@ RCT_EXPORT_VIEW_PROPERTY(onNativeDismissCancelled, RCTDirectEventBlock);
|
|
|
1275
1302
|
RCT_EXPORT_VIEW_PROPERTY(onTransitionProgress, RCTDirectEventBlock);
|
|
1276
1303
|
RCT_EXPORT_VIEW_PROPERTY(onWillAppear, RCTDirectEventBlock);
|
|
1277
1304
|
RCT_EXPORT_VIEW_PROPERTY(onWillDisappear, RCTDirectEventBlock);
|
|
1305
|
+
RCT_EXPORT_VIEW_PROPERTY(onGestureCancel, RCTDirectEventBlock);
|
|
1278
1306
|
|
|
1279
1307
|
#if !TARGET_OS_TV
|
|
1280
1308
|
RCT_EXPORT_VIEW_PROPERTY(screenOrientation, UIInterfaceOrientationMask)
|
package/ios/RNSScreenContainer.h
CHANGED
|
@@ -14,11 +14,11 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
14
14
|
|
|
15
15
|
@end
|
|
16
16
|
|
|
17
|
-
@protocol
|
|
17
|
+
@protocol RNSViewControllerDelegate
|
|
18
18
|
|
|
19
19
|
@end
|
|
20
20
|
|
|
21
|
-
@interface
|
|
21
|
+
@interface RNSViewController : UIViewController <RNSViewControllerDelegate>
|
|
22
22
|
|
|
23
23
|
- (UIViewController *)findActiveChildVC;
|
|
24
24
|
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
#import <react/renderer/components/rnscreens/Props.h>
|
|
9
9
|
#endif
|
|
10
10
|
|
|
11
|
-
@implementation
|
|
11
|
+
@implementation RNSViewController
|
|
12
12
|
|
|
13
13
|
#if !TARGET_OS_TV
|
|
14
14
|
- (UIViewController *)childViewControllerForStatusBarStyle
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
|
|
73
73
|
- (void)setupController
|
|
74
74
|
{
|
|
75
|
-
_controller = [[
|
|
75
|
+
_controller = [[RNSViewController alloc] init];
|
|
76
76
|
[self addSubview:_controller.view];
|
|
77
77
|
}
|
|
78
78
|
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
#import <react/renderer/components/rnscreens/Props.h>
|
|
9
9
|
#endif
|
|
10
10
|
|
|
11
|
-
@implementation
|
|
11
|
+
@implementation RNSContainerNavigationController
|
|
12
12
|
|
|
13
13
|
@end
|
|
14
14
|
|
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
|
|
17
17
|
- (void)setupController
|
|
18
18
|
{
|
|
19
|
-
self.controller = [[
|
|
20
|
-
[(
|
|
19
|
+
self.controller = [[RNSContainerNavigationController alloc] init];
|
|
20
|
+
[(RNSContainerNavigationController *)self.controller setNavigationBarHidden:YES animated:NO];
|
|
21
21
|
[self addSubview:self.controller.view];
|
|
22
22
|
}
|
|
23
23
|
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
if (screen.activityState == RNSActivityStateOnTop) {
|
|
28
28
|
// there should never be more than one screen with `RNSActivityStateOnTop`
|
|
29
29
|
// since this component should be used for `tabs` and `drawer` navigators
|
|
30
|
-
[(
|
|
30
|
+
[(RNSContainerNavigationController *)self.controller setViewControllers:@[ screen.controller ] animated:NO];
|
|
31
31
|
[screen notifyFinishTransitioning];
|
|
32
32
|
}
|
|
33
33
|
}
|
package/ios/RNSScreenStack.h
CHANGED
package/ios/RNSScreenStack.mm
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
#ifdef RCT_NEW_ARCH_ENABLED
|
|
2
|
+
#import <React/RCTFabricComponentsPlugins.h>
|
|
2
3
|
#import <React/RCTMountingTransactionObserving.h>
|
|
3
4
|
#import <React/RCTSurfaceTouchHandler.h>
|
|
4
5
|
#import <React/UIView+React.h>
|
|
@@ -6,9 +7,6 @@
|
|
|
6
7
|
#import <react/renderer/components/rnscreens/EventEmitters.h>
|
|
7
8
|
#import <react/renderer/components/rnscreens/Props.h>
|
|
8
9
|
#import <react/renderer/components/rnscreens/RCTComponentViewHelpers.h>
|
|
9
|
-
|
|
10
|
-
#import <React/RCTFabricComponentsPlugins.h>
|
|
11
|
-
|
|
12
10
|
#else
|
|
13
11
|
#import <React/RCTBridge.h>
|
|
14
12
|
#import <React/RCTRootContentView.h>
|
|
@@ -41,7 +39,7 @@
|
|
|
41
39
|
|
|
42
40
|
@end
|
|
43
41
|
|
|
44
|
-
@implementation
|
|
42
|
+
@implementation RNSNavigationController
|
|
45
43
|
|
|
46
44
|
#if !TARGET_OS_TV
|
|
47
45
|
- (UIViewController *)childViewControllerForStatusBarStyle
|
|
@@ -128,7 +126,7 @@
|
|
|
128
126
|
{
|
|
129
127
|
_reactSubviews = [NSMutableArray new];
|
|
130
128
|
_presentedModals = [NSMutableArray new];
|
|
131
|
-
_controller = [
|
|
129
|
+
_controller = [RNSNavigationController new];
|
|
132
130
|
_controller.delegate = self;
|
|
133
131
|
#if !TARGET_OS_TV
|
|
134
132
|
[self setupGestureHandlers];
|
|
@@ -606,8 +606,14 @@ namespace rct = facebook::react;
|
|
|
606
606
|
RNSSearchBar *searchBar = subview.subviews[0];
|
|
607
607
|
navitem.searchController = searchBar.controller;
|
|
608
608
|
navitem.hidesSearchBarWhenScrolling = searchBar.hideWhenScrolling;
|
|
609
|
+
#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && defined(__IPHONE_16_0) && \
|
|
610
|
+
__IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_16_0
|
|
611
|
+
if (@available(iOS 16.0, *)) {
|
|
612
|
+
navitem.preferredSearchBarPlacement = [searchBar placementAsUINavigationItemSearchBarPlacement];
|
|
613
|
+
}
|
|
614
|
+
#endif /* Check for iOS 16.0 */
|
|
609
615
|
}
|
|
610
|
-
#endif
|
|
616
|
+
#endif /* !TARGET_OS_TV */
|
|
611
617
|
}
|
|
612
618
|
break;
|
|
613
619
|
}
|
|
@@ -242,12 +242,12 @@
|
|
|
242
242
|
inViewController:(UIViewController *)vc
|
|
243
243
|
{
|
|
244
244
|
UIViewController *lastViewController = [[vc childViewControllers] lastObject];
|
|
245
|
-
if ([lastViewController conformsToProtocol:@protocol(
|
|
245
|
+
if ([lastViewController conformsToProtocol:@protocol(RNSViewControllerDelegate)]) {
|
|
246
246
|
UIViewController *vc = nil;
|
|
247
|
-
if ([lastViewController isKindOfClass:[
|
|
248
|
-
vc = [(
|
|
249
|
-
} else if ([lastViewController isKindOfClass:[
|
|
250
|
-
vc = [(
|
|
247
|
+
if ([lastViewController isKindOfClass:[RNSViewController class]]) {
|
|
248
|
+
vc = [(RNSViewController *)lastViewController findActiveChildVC];
|
|
249
|
+
} else if ([lastViewController isKindOfClass:[RNSNavigationController class]]) {
|
|
250
|
+
vc = [(RNSNavigationController *)lastViewController topViewController];
|
|
251
251
|
}
|
|
252
252
|
return [vc isKindOfClass:[RNSScreen class]] &&
|
|
253
253
|
[(RNSScreen *)vc findChildVCForConfigAndTrait:trait includingModals:includingModals] != nil;
|
package/ios/RNSSearchBar.h
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
#import <React/RCTBridge.h>
|
|
9
9
|
#import <React/RCTComponent.h>
|
|
10
10
|
#import <React/RCTViewManager.h>
|
|
11
|
+
#import "RNSEnums.h"
|
|
11
12
|
|
|
12
13
|
@interface RNSSearchBar :
|
|
13
14
|
#ifdef RCT_NEW_ARCH_ENABLED
|
|
@@ -17,9 +18,12 @@
|
|
|
17
18
|
#endif
|
|
18
19
|
|
|
19
20
|
@property (nonatomic) BOOL hideWhenScrolling;
|
|
20
|
-
|
|
21
|
+
@property (nonatomic) RNSSearchBarPlacement placement;
|
|
21
22
|
@property (nonatomic, retain) UISearchController *controller;
|
|
22
23
|
|
|
24
|
+
- (UINavigationItemSearchBarPlacement)placementAsUINavigationItemSearchBarPlacement API_AVAILABLE(ios(16.0))
|
|
25
|
+
API_UNAVAILABLE(tvos, watchos);
|
|
26
|
+
|
|
23
27
|
#ifdef RCT_NEW_ARCH_ENABLED
|
|
24
28
|
#else
|
|
25
29
|
@property (nonatomic, copy) RCTBubblingEventBlock onChangeText;
|
package/ios/RNSSearchBar.mm
CHANGED
|
@@ -49,6 +49,7 @@
|
|
|
49
49
|
_controller = [[UISearchController alloc] initWithSearchResultsController:nil];
|
|
50
50
|
_controller.searchBar.delegate = self;
|
|
51
51
|
_hideWhenScrolling = YES;
|
|
52
|
+
_placement = RNSSearchBarPlacementStacked;
|
|
52
53
|
}
|
|
53
54
|
|
|
54
55
|
- (void)emitOnFocusEvent
|
|
@@ -208,6 +209,18 @@
|
|
|
208
209
|
#endif
|
|
209
210
|
}
|
|
210
211
|
|
|
212
|
+
- (UINavigationItemSearchBarPlacement)placementAsUINavigationItemSearchBarPlacement
|
|
213
|
+
{
|
|
214
|
+
switch (_placement) {
|
|
215
|
+
case RNSSearchBarPlacementStacked:
|
|
216
|
+
return UINavigationItemSearchBarPlacementStacked;
|
|
217
|
+
case RNSSearchBarPlacementAutomatic:
|
|
218
|
+
return UINavigationItemSearchBarPlacementAutomatic;
|
|
219
|
+
case RNSSearchBarPlacementInline:
|
|
220
|
+
return UINavigationItemSearchBarPlacementInline;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
|
|
211
224
|
#pragma mark delegate methods
|
|
212
225
|
|
|
213
226
|
- (void)searchBarTextDidBeginEditing:(UISearchBar *)searchBar
|
|
@@ -326,6 +339,10 @@
|
|
|
326
339
|
[self setTextColor:RCTUIColorFromSharedColor(newScreenProps.textColor)];
|
|
327
340
|
}
|
|
328
341
|
|
|
342
|
+
if (oldScreenProps.placement != newScreenProps.placement) {
|
|
343
|
+
self.placement = [RNSConvert RNSScreenSearchBarPlacementFromCppEquivalent:newScreenProps.placement];
|
|
344
|
+
}
|
|
345
|
+
|
|
329
346
|
[super updateProps:props oldProps:oldProps];
|
|
330
347
|
}
|
|
331
348
|
|
|
@@ -372,6 +389,7 @@ RCT_EXPORT_VIEW_PROPERTY(barTintColor, UIColor)
|
|
|
372
389
|
RCT_EXPORT_VIEW_PROPERTY(tintColor, UIColor)
|
|
373
390
|
RCT_EXPORT_VIEW_PROPERTY(textColor, UIColor)
|
|
374
391
|
RCT_EXPORT_VIEW_PROPERTY(cancelButtonText, NSString)
|
|
392
|
+
RCT_EXPORT_VIEW_PROPERTY(placement, RNSSearchBarPlacement)
|
|
375
393
|
|
|
376
394
|
RCT_EXPORT_VIEW_PROPERTY(onChangeText, RCTBubblingEventBlock)
|
|
377
395
|
RCT_EXPORT_VIEW_PROPERTY(onCancelButtonPress, RCTBubblingEventBlock)
|
|
@@ -424,3 +442,17 @@ RCT_EXPORT_METHOD(setText : (NSNumber *_Nonnull)reactTag text : (NSString *)text
|
|
|
424
442
|
#endif /* !RCT_NEW_ARCH_ENABLED */
|
|
425
443
|
|
|
426
444
|
@end
|
|
445
|
+
|
|
446
|
+
@implementation RCTConvert (RNSScreen)
|
|
447
|
+
|
|
448
|
+
RCT_ENUM_CONVERTER(
|
|
449
|
+
RNSSearchBarPlacement,
|
|
450
|
+
(@{
|
|
451
|
+
@"automatic" : @(RNSSearchBarPlacementAutomatic),
|
|
452
|
+
@"inline" : @(RNSSearchBarPlacementInline),
|
|
453
|
+
@"stacked" : @(RNSSearchBarPlacementStacked),
|
|
454
|
+
}),
|
|
455
|
+
RNSSearchBarPlacementStacked,
|
|
456
|
+
integerValue)
|
|
457
|
+
|
|
458
|
+
@end
|
|
@@ -8,39 +8,39 @@
|
|
|
8
8
|
#if !TARGET_OS_TV
|
|
9
9
|
- (UIViewController *)reactNativeScreensChildViewControllerForStatusBarStyle
|
|
10
10
|
{
|
|
11
|
-
UIViewController *childVC = [self
|
|
11
|
+
UIViewController *childVC = [self findChildRNSScreensViewController];
|
|
12
12
|
return childVC ?: [self reactNativeScreensChildViewControllerForStatusBarStyle];
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
- (UIViewController *)reactNativeScreensChildViewControllerForStatusBarHidden
|
|
16
16
|
{
|
|
17
|
-
UIViewController *childVC = [self
|
|
17
|
+
UIViewController *childVC = [self findChildRNSScreensViewController];
|
|
18
18
|
return childVC ?: [self reactNativeScreensChildViewControllerForStatusBarHidden];
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
- (UIStatusBarAnimation)reactNativeScreensPreferredStatusBarUpdateAnimation
|
|
22
22
|
{
|
|
23
|
-
UIViewController *childVC = [self
|
|
23
|
+
UIViewController *childVC = [self findChildRNSScreensViewController];
|
|
24
24
|
return childVC ? childVC.preferredStatusBarUpdateAnimation
|
|
25
25
|
: [self reactNativeScreensPreferredStatusBarUpdateAnimation];
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
- (UIInterfaceOrientationMask)reactNativeScreensSupportedInterfaceOrientations
|
|
29
29
|
{
|
|
30
|
-
UIViewController *childVC = [self
|
|
30
|
+
UIViewController *childVC = [self findChildRNSScreensViewController];
|
|
31
31
|
return childVC ? childVC.supportedInterfaceOrientations : [self reactNativeScreensSupportedInterfaceOrientations];
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
- (UIViewController *)reactNativeScreensChildViewControllerForHomeIndicatorAutoHidden
|
|
35
35
|
{
|
|
36
|
-
UIViewController *childVC = [self
|
|
36
|
+
UIViewController *childVC = [self findChildRNSScreensViewController];
|
|
37
37
|
return childVC ?: [self reactNativeScreensChildViewControllerForHomeIndicatorAutoHidden];
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
- (UIViewController *)
|
|
40
|
+
- (UIViewController *)findChildRNSScreensViewController
|
|
41
41
|
{
|
|
42
42
|
UIViewController *lastViewController = [[self childViewControllers] lastObject];
|
|
43
|
-
if ([lastViewController conformsToProtocol:@protocol(
|
|
43
|
+
if ([lastViewController conformsToProtocol:@protocol(RNSViewControllerDelegate)]) {
|
|
44
44
|
return lastViewController;
|
|
45
45
|
}
|
|
46
46
|
return nil;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_codegenNativeComponent","_interopRequireDefault","require","obj","__esModule","default","_default","codegenNativeComponent","interfaceOnly","exports"],"sources":["ScreenNativeComponent.ts"],"sourcesContent":["import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';\nimport type { ViewProps, ColorValue } from 'react-native';\nimport type {\n BubblingEventHandler,\n WithDefault,\n Int32,\n Float,\n Double,\n} from 'react-native/Libraries/Types/CodegenTypes';\n\n// eslint-disable-next-line @typescript-eslint/ban-types\ntype ScreenEvent = Readonly<{}>;\n\ntype ScreenDismissedEvent = Readonly<{\n dismissCount: Int32;\n}>;\n\ntype TransitionProgressEvent = Readonly<{\n progress: Double;\n closing: Int32;\n goingForward: Int32;\n}>;\n\ntype GestureResponseDistanceType = Readonly<{\n start: Float;\n end: Float;\n top: Float;\n bottom: Float;\n}>;\n\ntype StackPresentation =\n | 'push'\n | 'modal'\n | 'transparentModal'\n | 'fullScreenModal'\n | 'formSheet'\n | 'containedModal'\n | 'containedTransparentModal';\n\ntype StackAnimation =\n | 'default'\n | 'flip'\n | 'simple_push'\n | 'none'\n | 'fade'\n | 'slide_from_right'\n | 'slide_from_left'\n | 'slide_from_bottom'\n | 'fade_from_bottom';\n\ntype SwipeDirection = 'vertical' | 'horizontal';\n\ntype ReplaceAnimation = 'pop' | 'push';\n\ntype SheetDetentTypes = 'large' | 'medium' | 'all';\n\nexport interface NativeProps extends ViewProps {\n onAppear?: BubblingEventHandler<ScreenEvent>;\n onDisappear?: BubblingEventHandler<ScreenEvent>;\n onDismissed?: BubblingEventHandler<ScreenDismissedEvent>;\n onNativeDismissCancelled?: BubblingEventHandler<ScreenDismissedEvent>;\n onWillAppear?: BubblingEventHandler<ScreenEvent>;\n onWillDisappear?: BubblingEventHandler<ScreenEvent>;\n onTransitionProgress?: BubblingEventHandler<TransitionProgressEvent>;\n sheetAllowedDetents?: WithDefault<SheetDetentTypes, 'large'>;\n sheetLargestUndimmedDetent?: WithDefault<SheetDetentTypes, 'all'>;\n sheetGrabberVisible?: WithDefault<boolean, false>;\n sheetCornerRadius?: WithDefault<Float, -1.0>;\n sheetExpandsWhenScrolledToEdge?: WithDefault<boolean, false>;\n customAnimationOnSwipe?: boolean;\n fullScreenSwipeEnabled?: boolean;\n homeIndicatorHidden?: boolean;\n preventNativeDismiss?: boolean;\n gestureEnabled?: WithDefault<boolean, true>;\n statusBarColor?: ColorValue;\n statusBarHidden?: boolean;\n screenOrientation?: string;\n statusBarAnimation?: string;\n statusBarStyle?: string;\n statusBarTranslucent?: boolean;\n gestureResponseDistance?: GestureResponseDistanceType;\n stackPresentation?: WithDefault<StackPresentation, 'push'>;\n stackAnimation?: WithDefault<StackAnimation, 'default'>;\n transitionDuration?: WithDefault<Int32, 350>;\n replaceAnimation?: WithDefault<ReplaceAnimation, 'pop'>;\n swipeDirection?: WithDefault<SwipeDirection, 'horizontal'>;\n hideKeyboardOnSwipe?: boolean;\n activityState?: WithDefault<Float, -1.0>;\n navigationBarColor?: ColorValue;\n navigationBarHidden?: boolean;\n nativeBackButtonDismissalEnabled?: boolean;\n onHeaderBackButtonClicked?: BubblingEventHandler<ScreenEvent>;\n}\n\nexport default codegenNativeComponent<NativeProps>('RNSScreen', {\n interfaceOnly: true,\n});\n"],"mappings":";;;;;;AAAA,IAAAA,uBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA6F,SAAAD,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAU7F;AAAA,IAAAG,QAAA,
|
|
1
|
+
{"version":3,"names":["_codegenNativeComponent","_interopRequireDefault","require","obj","__esModule","default","_default","codegenNativeComponent","interfaceOnly","exports"],"sources":["ScreenNativeComponent.ts"],"sourcesContent":["import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';\nimport type { ViewProps, ColorValue } from 'react-native';\nimport type {\n BubblingEventHandler,\n WithDefault,\n Int32,\n Float,\n Double,\n} from 'react-native/Libraries/Types/CodegenTypes';\n\n// eslint-disable-next-line @typescript-eslint/ban-types\ntype ScreenEvent = Readonly<{}>;\n\ntype ScreenDismissedEvent = Readonly<{\n dismissCount: Int32;\n}>;\n\ntype TransitionProgressEvent = Readonly<{\n progress: Double;\n closing: Int32;\n goingForward: Int32;\n}>;\n\ntype GestureResponseDistanceType = Readonly<{\n start: Float;\n end: Float;\n top: Float;\n bottom: Float;\n}>;\n\ntype StackPresentation =\n | 'push'\n | 'modal'\n | 'transparentModal'\n | 'fullScreenModal'\n | 'formSheet'\n | 'containedModal'\n | 'containedTransparentModal';\n\ntype StackAnimation =\n | 'default'\n | 'flip'\n | 'simple_push'\n | 'none'\n | 'fade'\n | 'slide_from_right'\n | 'slide_from_left'\n | 'slide_from_bottom'\n | 'fade_from_bottom';\n\ntype SwipeDirection = 'vertical' | 'horizontal';\n\ntype ReplaceAnimation = 'pop' | 'push';\n\ntype SheetDetentTypes = 'large' | 'medium' | 'all';\n\nexport interface NativeProps extends ViewProps {\n onAppear?: BubblingEventHandler<ScreenEvent>;\n onDisappear?: BubblingEventHandler<ScreenEvent>;\n onDismissed?: BubblingEventHandler<ScreenDismissedEvent>;\n onNativeDismissCancelled?: BubblingEventHandler<ScreenDismissedEvent>;\n onWillAppear?: BubblingEventHandler<ScreenEvent>;\n onWillDisappear?: BubblingEventHandler<ScreenEvent>;\n onTransitionProgress?: BubblingEventHandler<TransitionProgressEvent>;\n onGestureCancel?: BubblingEventHandler<ScreenEvent>;\n sheetAllowedDetents?: WithDefault<SheetDetentTypes, 'large'>;\n sheetLargestUndimmedDetent?: WithDefault<SheetDetentTypes, 'all'>;\n sheetGrabberVisible?: WithDefault<boolean, false>;\n sheetCornerRadius?: WithDefault<Float, -1.0>;\n sheetExpandsWhenScrolledToEdge?: WithDefault<boolean, false>;\n customAnimationOnSwipe?: boolean;\n fullScreenSwipeEnabled?: boolean;\n homeIndicatorHidden?: boolean;\n preventNativeDismiss?: boolean;\n gestureEnabled?: WithDefault<boolean, true>;\n statusBarColor?: ColorValue;\n statusBarHidden?: boolean;\n screenOrientation?: string;\n statusBarAnimation?: string;\n statusBarStyle?: string;\n statusBarTranslucent?: boolean;\n gestureResponseDistance?: GestureResponseDistanceType;\n stackPresentation?: WithDefault<StackPresentation, 'push'>;\n stackAnimation?: WithDefault<StackAnimation, 'default'>;\n transitionDuration?: WithDefault<Int32, 350>;\n replaceAnimation?: WithDefault<ReplaceAnimation, 'pop'>;\n swipeDirection?: WithDefault<SwipeDirection, 'horizontal'>;\n hideKeyboardOnSwipe?: boolean;\n activityState?: WithDefault<Float, -1.0>;\n navigationBarColor?: ColorValue;\n navigationBarHidden?: boolean;\n nativeBackButtonDismissalEnabled?: boolean;\n onHeaderBackButtonClicked?: BubblingEventHandler<ScreenEvent>;\n}\n\nexport default codegenNativeComponent<NativeProps>('RNSScreen', {\n interfaceOnly: true,\n});\n"],"mappings":";;;;;;AAAA,IAAAA,uBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA6F,SAAAD,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAU7F;AAAA,IAAAG,QAAA,GAqFe,IAAAC,+BAAsB,EAAc,WAAW,EAAE;EAC9DC,aAAa,EAAE;AACjB,CAAC,CAAC;AAAAC,OAAA,CAAAJ,OAAA,GAAAC,QAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_codegenNativeComponent","_interopRequireDefault","require","_codegenNativeCommands","obj","__esModule","default","Commands","codegenNativeCommands","supportedCommands","exports","_default","codegenNativeComponent"],"sources":["SearchBarNativeComponent.ts"],"sourcesContent":["/* eslint-disable */\nimport codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';\nimport type { ViewProps, ColorValue, HostComponent } from 'react-native';\nimport type {\n WithDefault,\n BubblingEventHandler,\n} from 'react-native/Libraries/Types/CodegenTypes';\nimport codegenNativeCommands from 'react-native/Libraries/Utilities/codegenNativeCommands';\n\ntype SearchBarEvent = Readonly<{}>;\n\ntype SearchButtonPressedEvent = Readonly<{\n text?: string;\n}>;\n\ntype ChangeTextEvent = Readonly<{\n text?: string;\n}>;\n\ntype AutoCapitalizeType = 'none' | 'words' | 'sentences' | 'characters';\n\ninterface NativeProps extends ViewProps {\n onFocus?: BubblingEventHandler<SearchBarEvent> | null;\n onBlur?: BubblingEventHandler<SearchBarEvent> | null;\n onSearchButtonPress?: BubblingEventHandler<SearchButtonPressedEvent> | null;\n onCancelButtonPress?: BubblingEventHandler<SearchBarEvent> | null;\n onChangeText?: BubblingEventHandler<ChangeTextEvent> | null;\n hideWhenScrolling?: boolean;\n autoCapitalize?: WithDefault<AutoCapitalizeType, 'none'>;\n placeholder?: string;\n obscureBackground?: boolean;\n hideNavigationBar?: boolean;\n cancelButtonText?: string;\n // TODO: implement these on iOS\n barTintColor?: ColorValue;\n tintColor?: ColorValue;\n textColor?: ColorValue;\n\n // Android only\n disableBackButtonOverride?: boolean;\n // TODO: consider creating enum here\n inputType?: string;\n onClose?: BubblingEventHandler<SearchBarEvent> | null;\n onOpen?: BubblingEventHandler<SearchBarEvent> | null;\n hintTextColor?: ColorValue;\n headerIconColor?: ColorValue;\n shouldShowHintSearchIcon?: WithDefault<boolean, true>;\n}\n\ntype ComponentType = HostComponent<NativeProps>;\n\ninterface NativeCommands {\n blur: (viewRef: React.ElementRef<ComponentType>) => void;\n focus: (viewRef: React.ElementRef<ComponentType>) => void;\n clearText: (viewRef: React.ElementRef<ComponentType>) => void;\n toggleCancelButton: (\n viewRef: React.ElementRef<ComponentType>,\n flag: boolean\n ) => void;\n setText: (viewRef: React.ElementRef<ComponentType>, text: string) => void;\n}\n\nexport const Commands: NativeCommands = codegenNativeCommands<NativeCommands>({\n supportedCommands: [\n 'blur',\n 'focus',\n 'clearText',\n 'toggleCancelButton',\n 'setText',\n ],\n});\n\nexport default codegenNativeComponent<NativeProps>('RNSSearchBar', {});\n"],"mappings":";;;;;;AACA,IAAAA,uBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAMA,IAAAC,sBAAA,GAAAF,sBAAA,CAAAC,OAAA;AAA2F,SAAAD,uBAAAG,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAP3F;;
|
|
1
|
+
{"version":3,"names":["_codegenNativeComponent","_interopRequireDefault","require","_codegenNativeCommands","obj","__esModule","default","Commands","codegenNativeCommands","supportedCommands","exports","_default","codegenNativeComponent"],"sources":["SearchBarNativeComponent.ts"],"sourcesContent":["/* eslint-disable */\nimport codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';\nimport type { ViewProps, ColorValue, HostComponent } from 'react-native';\nimport type {\n WithDefault,\n BubblingEventHandler,\n} from 'react-native/Libraries/Types/CodegenTypes';\nimport codegenNativeCommands from 'react-native/Libraries/Utilities/codegenNativeCommands';\n\ntype SearchBarEvent = Readonly<{}>;\n\ntype SearchButtonPressedEvent = Readonly<{\n text?: string;\n}>;\n\ntype ChangeTextEvent = Readonly<{\n text?: string;\n}>;\n\ntype SearchBarPlacement = 'automatic' | 'inline' | 'stacked';\n\ntype AutoCapitalizeType = 'none' | 'words' | 'sentences' | 'characters';\n\ninterface NativeProps extends ViewProps {\n onFocus?: BubblingEventHandler<SearchBarEvent> | null;\n onBlur?: BubblingEventHandler<SearchBarEvent> | null;\n onSearchButtonPress?: BubblingEventHandler<SearchButtonPressedEvent> | null;\n onCancelButtonPress?: BubblingEventHandler<SearchBarEvent> | null;\n onChangeText?: BubblingEventHandler<ChangeTextEvent> | null;\n hideWhenScrolling?: boolean;\n autoCapitalize?: WithDefault<AutoCapitalizeType, 'none'>;\n placeholder?: string;\n placement?: WithDefault<SearchBarPlacement, 'stacked'>;\n obscureBackground?: boolean;\n hideNavigationBar?: boolean;\n cancelButtonText?: string;\n // TODO: implement these on iOS\n barTintColor?: ColorValue;\n tintColor?: ColorValue;\n textColor?: ColorValue;\n\n // Android only\n disableBackButtonOverride?: boolean;\n // TODO: consider creating enum here\n inputType?: string;\n onClose?: BubblingEventHandler<SearchBarEvent> | null;\n onOpen?: BubblingEventHandler<SearchBarEvent> | null;\n hintTextColor?: ColorValue;\n headerIconColor?: ColorValue;\n shouldShowHintSearchIcon?: WithDefault<boolean, true>;\n}\n\ntype ComponentType = HostComponent<NativeProps>;\n\ninterface NativeCommands {\n blur: (viewRef: React.ElementRef<ComponentType>) => void;\n focus: (viewRef: React.ElementRef<ComponentType>) => void;\n clearText: (viewRef: React.ElementRef<ComponentType>) => void;\n toggleCancelButton: (\n viewRef: React.ElementRef<ComponentType>,\n flag: boolean\n ) => void;\n setText: (viewRef: React.ElementRef<ComponentType>, text: string) => void;\n}\n\nexport const Commands: NativeCommands = codegenNativeCommands<NativeCommands>({\n supportedCommands: [\n 'blur',\n 'focus',\n 'clearText',\n 'toggleCancelButton',\n 'setText',\n ],\n});\n\nexport default codegenNativeComponent<NativeProps>('RNSSearchBar', {});\n"],"mappings":";;;;;;AACA,IAAAA,uBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAMA,IAAAC,sBAAA,GAAAF,sBAAA,CAAAC,OAAA;AAA2F,SAAAD,uBAAAG,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAP3F;;AAiEO,MAAMG,QAAwB,GAAG,IAAAC,8BAAqB,EAAiB;EAC5EC,iBAAiB,EAAE,CACjB,MAAM,EACN,OAAO,EACP,WAAW,EACX,oBAAoB,EACpB,SAAS;AAEb,CAAC,CAAC;AAACC,OAAA,CAAAH,QAAA,GAAAA,QAAA;AAAA,IAAAI,QAAA,GAEY,IAAAC,+BAAsB,EAAc,cAAc,EAAE,CAAC,CAAC,CAAC;AAAAF,OAAA,CAAAJ,OAAA,GAAAK,QAAA"}
|
|
@@ -157,6 +157,16 @@ class InnerScreen extends _react.default.Component {
|
|
|
157
157
|
freezeOnBlur = ENABLE_FREEZE,
|
|
158
158
|
...rest
|
|
159
159
|
} = this.props;
|
|
160
|
+
|
|
161
|
+
// To maintain default behaviour of formSheet stack presentation style & and to have resonable
|
|
162
|
+
// defaults for new medium-detent iOS API we need to set defaults here
|
|
163
|
+
const {
|
|
164
|
+
sheetAllowedDetents = 'large',
|
|
165
|
+
sheetLargestUndimmedDetent = 'all',
|
|
166
|
+
sheetGrabberVisible = false,
|
|
167
|
+
sheetCornerRadius = -1.0,
|
|
168
|
+
sheetExpandsWhenScrolledToEdge = true
|
|
169
|
+
} = rest;
|
|
160
170
|
if (enabled && isPlatformSupported) {
|
|
161
171
|
var _gestureResponseDista, _gestureResponseDista2, _gestureResponseDista3, _gestureResponseDista4;
|
|
162
172
|
AnimatedNativeScreen = AnimatedNativeScreen || _reactNative.Animated.createAnimatedComponent(ScreensNativeModules.NativeScreen);
|
|
@@ -169,6 +179,7 @@ class InnerScreen extends _react.default.Component {
|
|
|
169
179
|
children,
|
|
170
180
|
isNativeStack,
|
|
171
181
|
gestureResponseDistance,
|
|
182
|
+
onGestureCancel,
|
|
172
183
|
...props
|
|
173
184
|
} = rest;
|
|
174
185
|
if (active !== undefined && activityState === undefined) {
|
|
@@ -190,6 +201,11 @@ class InnerScreen extends _react.default.Component {
|
|
|
190
201
|
freeze: freezeOnBlur && activityState === 0
|
|
191
202
|
}, /*#__PURE__*/_react.default.createElement(AnimatedNativeScreen, _extends({}, props, {
|
|
192
203
|
activityState: activityState,
|
|
204
|
+
sheetAllowedDetents: sheetAllowedDetents,
|
|
205
|
+
sheetLargestUndimmedDetent: sheetLargestUndimmedDetent,
|
|
206
|
+
sheetGrabberVisible: sheetGrabberVisible,
|
|
207
|
+
sheetCornerRadius: sheetCornerRadius,
|
|
208
|
+
sheetExpandsWhenScrolledToEdge: sheetExpandsWhenScrolledToEdge,
|
|
193
209
|
gestureResponseDistance: {
|
|
194
210
|
start: (_gestureResponseDista = gestureResponseDistance === null || gestureResponseDistance === void 0 ? void 0 : gestureResponseDistance.start) !== null && _gestureResponseDista !== void 0 ? _gestureResponseDista : -1,
|
|
195
211
|
end: (_gestureResponseDista2 = gestureResponseDistance === null || gestureResponseDistance === void 0 ? void 0 : gestureResponseDistance.end) !== null && _gestureResponseDista2 !== void 0 ? _gestureResponseDista2 : -1,
|
|
@@ -208,7 +224,10 @@ class InnerScreen extends _react.default.Component {
|
|
|
208
224
|
}
|
|
209
225
|
}], {
|
|
210
226
|
useNativeDriver: true
|
|
211
|
-
})
|
|
227
|
+
}),
|
|
228
|
+
onGestureCancel: onGestureCancel !== null && onGestureCancel !== void 0 ? onGestureCancel : () => {
|
|
229
|
+
// for internal use
|
|
230
|
+
}
|
|
212
231
|
}), !isNativeStack ?
|
|
213
232
|
// see comment of this prop in types.tsx for information why it is needed
|
|
214
233
|
children : /*#__PURE__*/_react.default.createElement(_TransitionProgressContext.default.Provider, {
|