react-native-screens 3.12.0 → 3.14.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.
Files changed (141) hide show
  1. package/README.md +2 -2
  2. package/RNScreens.podspec +5 -4
  3. package/android/build.gradle +18 -1
  4. package/android/src/main/java/com/swmansion/rnscreens/ScreenStack.kt +8 -4
  5. package/android/src/main/java/com/swmansion/rnscreens/ScreenViewManager.kt +24 -6
  6. package/android/src/main/java/com/swmansion/rnscreens/ScreenWindowTraits.kt +18 -20
  7. package/android/src/main/jni/Android.mk +1 -2
  8. package/android/src/paper/java/com/facebook/react/viewmanagers/RNSScreenManagerDelegate.java +39 -14
  9. package/android/src/paper/java/com/facebook/react/viewmanagers/RNSScreenManagerInterface.java +15 -6
  10. package/android/src/paper/java/com/facebook/react/viewmanagers/RNSScreenStackHeaderConfigManagerDelegate.java +3 -3
  11. package/android/src/paper/java/com/facebook/react/viewmanagers/RNSScreenStackHeaderConfigManagerInterface.java +1 -1
  12. package/common/cpp/Android.mk +1 -2
  13. package/createNativeStackNavigator/README.md +4 -0
  14. package/ios/RNSConvert.h +30 -0
  15. package/ios/RNSConvert.mm +120 -0
  16. package/ios/RNSEnums.h +59 -0
  17. package/ios/RNSFullWindowOverlay.h +17 -2
  18. package/ios/RNSFullWindowOverlay.mm +199 -0
  19. package/ios/RNSScreen.h +70 -79
  20. package/ios/{RNSScreen.m → RNSScreen.mm} +679 -302
  21. package/ios/RNSScreenContainer.h +15 -1
  22. package/ios/{RNSScreenContainer.m → RNSScreenContainer.mm} +99 -8
  23. package/ios/{RNSScreenNavigationContainer.m → RNSScreenNavigationContainer.mm} +22 -0
  24. package/ios/RNSScreenStack.h +19 -3
  25. package/ios/{RNSScreenStack.m → RNSScreenStack.mm} +387 -124
  26. package/ios/{RNSScreenStackAnimator.m → RNSScreenStackAnimator.mm} +19 -14
  27. package/ios/RNSScreenStackHeaderConfig.h +20 -21
  28. package/ios/{RNSScreenStackHeaderConfig.m → RNSScreenStackHeaderConfig.mm} +232 -117
  29. package/ios/RNSScreenStackHeaderSubview.h +45 -0
  30. package/ios/RNSScreenStackHeaderSubview.mm +137 -0
  31. package/ios/RNSScreenViewEvent.h +12 -0
  32. package/ios/RNSScreenViewEvent.mm +59 -0
  33. package/ios/{RNSScreenWindowTraits.m → RNSScreenWindowTraits.mm} +3 -2
  34. package/ios/RNSSearchBar.h +14 -1
  35. package/ios/RNSSearchBar.mm +351 -0
  36. package/ios/{UIViewController+RNScreens.m → UIViewController+RNScreens.mm} +0 -0
  37. package/ios/{UIWindow+RNScreens.m → UIWindow+RNScreens.mm} +0 -0
  38. package/lib/commonjs/fabric/FullWindowOverlay.js +26 -0
  39. package/lib/commonjs/fabric/FullWindowOverlay.js.map +1 -0
  40. package/lib/commonjs/fabric/FullWindowOverlayNativeComponent.js +21 -0
  41. package/lib/commonjs/fabric/FullWindowOverlayNativeComponent.js.map +1 -0
  42. package/lib/commonjs/fabric/Screen.js +10 -8
  43. package/lib/commonjs/fabric/Screen.js.map +1 -1
  44. package/lib/commonjs/fabric/ScreenContainer.js +28 -0
  45. package/lib/commonjs/fabric/ScreenContainer.js.map +1 -0
  46. package/lib/commonjs/fabric/ScreenContainerNativeComponent.js +21 -0
  47. package/lib/commonjs/fabric/ScreenContainerNativeComponent.js.map +1 -0
  48. package/lib/commonjs/fabric/ScreenNativeComponent.js.map +1 -1
  49. package/lib/commonjs/fabric/ScreenNavigationContainer.js +28 -0
  50. package/lib/commonjs/fabric/ScreenNavigationContainer.js.map +1 -0
  51. package/lib/commonjs/fabric/ScreenNavigationContainerNativeComponent.js +21 -0
  52. package/lib/commonjs/fabric/ScreenNavigationContainerNativeComponent.js.map +1 -0
  53. package/lib/commonjs/fabric/ScreenStack.js +6 -7
  54. package/lib/commonjs/fabric/ScreenStack.js.map +1 -1
  55. package/lib/commonjs/fabric/ScreenStackHeaderConfigNativeComponent.js.map +1 -1
  56. package/lib/commonjs/fabric/ScreenStackHeaderSubview.js +4 -1
  57. package/lib/commonjs/fabric/ScreenStackHeaderSubview.js.map +1 -1
  58. package/lib/commonjs/fabric/ScreenStackNativeComponent.js.map +1 -1
  59. package/lib/commonjs/fabric/SearchBar.js +37 -0
  60. package/lib/commonjs/fabric/SearchBar.js.map +1 -0
  61. package/lib/commonjs/fabric/SearchBarNativeComponent.js +25 -0
  62. package/lib/commonjs/fabric/SearchBarNativeComponent.js.map +1 -0
  63. package/lib/commonjs/fabric/index.js +32 -0
  64. package/lib/commonjs/fabric/index.js.map +1 -1
  65. package/lib/commonjs/index.native.js +5 -18
  66. package/lib/commonjs/index.native.js.map +1 -1
  67. package/lib/commonjs/native-stack/views/NativeStackView.js +30 -0
  68. package/lib/commonjs/native-stack/views/NativeStackView.js.map +1 -1
  69. package/lib/commonjs/reanimated/ReanimatedNativeStackScreen.js +8 -2
  70. package/lib/commonjs/reanimated/ReanimatedNativeStackScreen.js.map +1 -1
  71. package/lib/module/fabric/FullWindowOverlay.js +15 -0
  72. package/lib/module/fabric/FullWindowOverlay.js.map +1 -0
  73. package/lib/module/fabric/FullWindowOverlayNativeComponent.js +9 -0
  74. package/lib/module/fabric/FullWindowOverlayNativeComponent.js.map +1 -0
  75. package/lib/module/fabric/Screen.js +8 -3
  76. package/lib/module/fabric/Screen.js.map +1 -1
  77. package/lib/module/fabric/ScreenContainer.js +17 -0
  78. package/lib/module/fabric/ScreenContainer.js.map +1 -0
  79. package/lib/module/fabric/ScreenContainerNativeComponent.js +9 -0
  80. package/lib/module/fabric/ScreenContainerNativeComponent.js.map +1 -0
  81. package/lib/module/fabric/ScreenNativeComponent.js.map +1 -1
  82. package/lib/module/fabric/ScreenNavigationContainer.js +17 -0
  83. package/lib/module/fabric/ScreenNavigationContainer.js.map +1 -0
  84. package/lib/module/fabric/ScreenNavigationContainerNativeComponent.js +9 -0
  85. package/lib/module/fabric/ScreenNavigationContainerNativeComponent.js.map +1 -0
  86. package/lib/module/fabric/ScreenStack.js +5 -2
  87. package/lib/module/fabric/ScreenStack.js.map +1 -1
  88. package/lib/module/fabric/ScreenStackHeaderConfigNativeComponent.js.map +1 -1
  89. package/lib/module/fabric/ScreenStackHeaderSubview.js +4 -1
  90. package/lib/module/fabric/ScreenStackHeaderSubview.js.map +1 -1
  91. package/lib/module/fabric/ScreenStackNativeComponent.js.map +1 -1
  92. package/lib/module/fabric/SearchBar.js +24 -0
  93. package/lib/module/fabric/SearchBar.js.map +1 -0
  94. package/lib/module/fabric/SearchBarNativeComponent.js +11 -0
  95. package/lib/module/fabric/SearchBarNativeComponent.js.map +1 -0
  96. package/lib/module/fabric/index.js +5 -1
  97. package/lib/module/fabric/index.js.map +1 -1
  98. package/lib/module/index.native.js +6 -20
  99. package/lib/module/index.native.js.map +1 -1
  100. package/lib/module/native-stack/views/NativeStackView.js +30 -0
  101. package/lib/module/native-stack/views/NativeStackView.js.map +1 -1
  102. package/lib/module/reanimated/ReanimatedNativeStackScreen.js +7 -2
  103. package/lib/module/reanimated/ReanimatedNativeStackScreen.js.map +1 -1
  104. package/lib/typescript/native-stack/types.d.ts +12 -0
  105. package/lib/typescript/reanimated/ReanimatedNativeStackScreen.d.ts +1 -1
  106. package/lib/typescript/reanimated/ReanimatedScreen.d.ts +1 -1
  107. package/lib/typescript/types.d.ts +24 -0
  108. package/native-stack/README.md +21 -0
  109. package/package.json +3 -4
  110. package/src/fabric/FullWindowOverlay.js +13 -0
  111. package/src/fabric/FullWindowOverlayNativeComponent.js +19 -0
  112. package/src/fabric/Screen.js +5 -2
  113. package/src/fabric/ScreenContainer.js +16 -0
  114. package/src/fabric/ScreenContainerNativeComponent.js +19 -0
  115. package/src/fabric/ScreenNativeComponent.js +41 -8
  116. package/src/fabric/ScreenNavigationContainer.js +16 -0
  117. package/src/fabric/ScreenNavigationContainerNativeComponent.js +19 -0
  118. package/src/fabric/ScreenStack.js +4 -2
  119. package/src/fabric/ScreenStackHeaderConfigNativeComponent.js +1 -1
  120. package/src/fabric/ScreenStackHeaderSubview.js +3 -1
  121. package/src/fabric/ScreenStackNativeComponent.js +4 -0
  122. package/src/fabric/SearchBar.js +20 -0
  123. package/src/fabric/SearchBarNativeComponent.js +62 -0
  124. package/src/fabric/index.js +8 -0
  125. package/src/index.native.tsx +13 -19
  126. package/src/native-stack/types.tsx +12 -0
  127. package/src/native-stack/views/NativeStackView.tsx +27 -0
  128. package/src/reanimated/ReanimatedNativeStackScreen.tsx +6 -0
  129. package/src/types.tsx +25 -0
  130. package/ios/RNSFullWindowOverlay.m +0 -105
  131. package/ios/RNSScreenComponentView.h +0 -23
  132. package/ios/RNSScreenComponentView.mm +0 -159
  133. package/ios/RNSScreenController.h +0 -10
  134. package/ios/RNSScreenController.mm +0 -79
  135. package/ios/RNSScreenStackComponentView.h +0 -15
  136. package/ios/RNSScreenStackComponentView.mm +0 -295
  137. package/ios/RNSScreenStackHeaderConfigComponentView.h +0 -42
  138. package/ios/RNSScreenStackHeaderConfigComponentView.mm +0 -662
  139. package/ios/RNSScreenStackHeaderSubviewComponentView.h +0 -14
  140. package/ios/RNSScreenStackHeaderSubviewComponentView.mm +0 -77
  141. package/ios/RNSSearchBar.m +0 -198
@@ -19,7 +19,28 @@ type ScreenDismissedEvent = $ReadOnly<{|
19
19
  dismissCount: Int32,
20
20
  |}>;
21
21
 
22
- type StackPresentation = 'push' | 'modal' | 'transparentModal';
22
+ type TransitionProgressEvent = $ReadOnly<{|
23
+ progress: Double,
24
+ closing: Int32,
25
+ goingForward: Int32,
26
+ |}>;
27
+
28
+ type GestureResponseDistanceType = $ReadOnly<{|
29
+ start: Float,
30
+ end: Float,
31
+ top: Float,
32
+ bottom: Float,
33
+ |}>;
34
+
35
+ type StackPresentation =
36
+ | 'push'
37
+ | 'modal'
38
+ | 'transparentModal'
39
+ | 'fullScreenModal'
40
+ | 'formSheet'
41
+ | 'containedModal'
42
+ | 'containedTransparentModal';
43
+
23
44
  type StackAnimation =
24
45
  | 'default'
25
46
  | 'flip'
@@ -31,6 +52,8 @@ type StackAnimation =
31
52
  | 'slide_from_bottom'
32
53
  | 'fade_from_bottom';
33
54
 
55
+ type SwipeDirection = 'vertical' | 'horizontal';
56
+
34
57
  type ReplaceAnimation = 'pop' | 'push';
35
58
 
36
59
  export type NativeProps = $ReadOnly<{|
@@ -38,23 +61,33 @@ export type NativeProps = $ReadOnly<{|
38
61
  onAppear?: ?BubblingEventHandler<ScreenEvent>,
39
62
  onDisappear?: ?BubblingEventHandler<ScreenEvent>,
40
63
  onDismissed?: ?BubblingEventHandler<ScreenDismissedEvent>,
64
+ onNativeDismissCancelled?: ?BubblingEventHandler<ScreenDismissedEvent>,
41
65
  onWillAppear?: ?BubblingEventHandler<ScreenEvent>,
42
66
  onWillDisappear?: ?BubblingEventHandler<ScreenEvent>,
43
- // TODO: implement this props on iOS
44
- stackPresentation?: WithDefault<StackPresentation, 'push'>,
45
- stackAnimation?: WithDefault<StackAnimation, 'default'>,
67
+ onTransitionProgress?: ?BubblingEventHandler<TransitionProgressEvent>,
68
+ customAnimationOnSwipe?: boolean,
69
+ fullScreenSwipeEnabled?: boolean,
70
+ homeIndicatorHidden?: boolean,
71
+ preventNativeDismiss?: boolean,
46
72
  gestureEnabled?: WithDefault<boolean, true>,
47
- replaceAnimation?: WithDefault<ReplaceAnimation, 'pop'>,
73
+ statusBarColor?: ColorValue,
74
+ statusBarHidden?: boolean,
48
75
  screenOrientation?: string,
49
76
  statusBarAnimation?: string,
50
- statusBarColor?: ColorValue,
51
77
  statusBarStyle?: string,
52
78
  statusBarTranslucent?: boolean,
53
- statusBarHidden?: boolean,
79
+ gestureResponseDistance?: GestureResponseDistanceType,
80
+ stackPresentation?: WithDefault<StackPresentation, 'push'>,
81
+ stackAnimation?: WithDefault<StackAnimation, 'default'>,
82
+ transitionDuration?: WithDefault<Int32, 350>,
83
+ replaceAnimation?: WithDefault<ReplaceAnimation, 'pop'>,
84
+ swipeDirection?: WithDefault<SwipeDirection, 'horizontal'>,
85
+ hideKeyboardOnSwipe?: boolean,
86
+ activityState?: WithDefault<Float, -1.0>,
87
+ // TODO: implement these props on iOS
54
88
  navigationBarColor?: ColorValue,
55
89
  navigationBarHidden?: boolean,
56
90
  nativeBackButtonDismissalEnabled?: boolean,
57
- activityState?: WithDefault<Int32, -1>,
58
91
  |}>;
59
92
 
60
93
  type ComponentType = HostComponent<NativeProps>;
@@ -0,0 +1,16 @@
1
+ import React from 'react';
2
+ import ScreenNavigationContainerNativeComponent from './ScreenNavigationContainerNativeComponent';
3
+
4
+ function ScreenNavigationContainer(props) {
5
+ return (
6
+ <ScreenNavigationContainerNativeComponent
7
+ {...props}
8
+ style={[
9
+ { flex: 1, alignItems: 'center', justifyContent: 'center' },
10
+ props.style,
11
+ ]}
12
+ />
13
+ );
14
+ }
15
+
16
+ export default ScreenNavigationContainer;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * @flow strict-local
3
+ * @format
4
+ */
5
+ /* eslint-disable */
6
+ import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
7
+ import type { ViewProps } from 'react-native/Libraries/Components/View/ViewPropTypes';
8
+ import type { HostComponent } from 'react-native/Libraries/Renderer/shims/ReactNativeTypes';
9
+
10
+ type NativeProps = $ReadOnly<{|
11
+ ...ViewProps,
12
+ |}>;
13
+
14
+ type ComponentType = HostComponent<NativeProps>;
15
+
16
+ export default (codegenNativeComponent<NativeProps>(
17
+ 'RNSScreenNavigationContainer',
18
+ {}
19
+ ): ComponentType);
@@ -1,8 +1,10 @@
1
- import * as React from 'react';
1
+ import React from 'react';
2
2
  import ScreenStackNativeComponent from './ScreenStackNativeComponent';
3
3
 
4
- export default function ScreenStack(props) {
4
+ function ScreenStack(props) {
5
5
  return (
6
6
  <ScreenStackNativeComponent {...props} style={[{ flex: 1 }, props.style]} />
7
7
  );
8
8
  }
9
+
10
+ export default ScreenStack;
@@ -41,9 +41,9 @@ export type NativeProps = $ReadOnly<{|
41
41
  titleColor?: ColorValue,
42
42
  disableBackButtonMenu?: boolean,
43
43
  hideBackButton?: boolean,
44
+ backButtonInCustomView?: boolean,
44
45
  // TODO: implement this props on iOS
45
46
  topInsetEnabled?: boolean,
46
- backButtonInCustomView?: boolean,
47
47
  |}>;
48
48
 
49
49
  type ComponentType = HostComponent<NativeProps>;
@@ -13,8 +13,10 @@ const styles = StyleSheet.create({
13
13
  },
14
14
  });
15
15
 
16
- export default function ScreenStackHeaderSubview(props) {
16
+ function ScreenStackHeaderSubview(props) {
17
17
  return (
18
18
  <NativeScreenStackHeaderSubview {...props} style={styles.headerSubview} />
19
19
  );
20
20
  }
21
+
22
+ export default ScreenStackHeaderSubview;
@@ -6,9 +6,13 @@
6
6
  import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
7
7
  import type { ViewProps } from 'react-native/Libraries/Components/View/ViewPropTypes';
8
8
  import type { HostComponent } from 'react-native/Libraries/Renderer/shims/ReactNativeTypes';
9
+ import type { DirectEventHandler } from 'react-native/Libraries/Types/CodegenTypes';
10
+
11
+ type FinishTransitioningEvent = $ReadOnly<{||}>;
9
12
 
10
13
  type NativeProps = $ReadOnly<{|
11
14
  ...ViewProps,
15
+ onFinishTransitioning?: ?DirectEventHandler<FinishTransitioningEvent>,
12
16
  |}>;
13
17
 
14
18
  type ComponentType = HostComponent<NativeProps>;
@@ -0,0 +1,20 @@
1
+ import React from 'react';
2
+ import SearchBarNativeComponent from './SearchBarNativeComponent';
3
+ import { StyleSheet } from 'react-native';
4
+
5
+ const styles = StyleSheet.create({
6
+ headerSubview: {
7
+ position: 'absolute',
8
+ top: 0,
9
+ right: 0,
10
+ flexDirection: 'row',
11
+ alignItems: 'center',
12
+ justifyContent: 'center',
13
+ },
14
+ });
15
+
16
+ function SearchBar(props) {
17
+ return <SearchBarNativeComponent {...props} style={styles.headerSubview} />;
18
+ }
19
+
20
+ export default SearchBar;
@@ -0,0 +1,62 @@
1
+ /**
2
+ * @flow strict-local
3
+ * @format
4
+ */
5
+ /* eslint-disable */
6
+ import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
7
+ import type { ViewProps } from 'react-native/Libraries/Components/View/ViewPropTypes';
8
+ import type { HostComponent } from 'react-native/Libraries/Renderer/shims/ReactNativeTypes';
9
+ import { ColorValue } from 'react-native/Libraries/StyleSheet/StyleSheet';
10
+ import type {
11
+ WithDefault,
12
+ BubblingEventHandler,
13
+ } from 'react-native/Libraries/Types/CodegenTypes';
14
+ import { tintColor } from 'react-native/Libraries/Components/View/ReactNativeStyleAttributes';
15
+
16
+ type SearchBarEvent = $ReadOnly<{||}>;
17
+
18
+ type SearchButtonPressedEvent = $ReadOnly<{|
19
+ text?: string,
20
+ |}>;
21
+
22
+ type ChangeTextEvent = $ReadOnly<{|
23
+ text?: string,
24
+ |}>;
25
+
26
+ type AutoCapitalizeType = 'none' | 'words' | 'sentences' | 'characters';
27
+
28
+ type NativeProps = $ReadOnly<{|
29
+ ...ViewProps,
30
+ onFocus?: ?BubblingEventHandler<SearchBarEvent>,
31
+ onBlur?: ?BubblingEventHandler<SearchBarEvent>,
32
+ onSearchButtonPress?: ?BubblingEventHandler<SearchButtonPressedEvent>,
33
+ onCancelButtonPress?: ?BubblingEventHandler<SearchBarEvent>,
34
+ onChangeText?: ?BubblingEventHandler<ChangeTextEvent>,
35
+ hideWhenScrolling?: boolean,
36
+ autoCapitalize?: WithDefault<AutoCapitalizeType, 'none'>,
37
+ placeholder?: string,
38
+ obscureBackground?: boolean,
39
+ hideNavigationBar?: boolean,
40
+ cancelButtonText?: string,
41
+ // TODO: implement these on iOS
42
+ barTintColor?: ColorValue,
43
+ tintColor?: ColorValue,
44
+ textColor?: ColorValue,
45
+
46
+ // Android only
47
+ disableBackButtonOverride?: boolean,
48
+ // TODO: consider creating enum here
49
+ inputType?: string,
50
+ onClose?: ?BubblingEventHandler<SearchBarEvent>,
51
+ onOpen?: ?BubblingEventHandler<SearchBarEvent>,
52
+ hintTextColor?: ColorValue,
53
+ headerIconColor?: ColorValue,
54
+ shouldShowHintSearchIcon?: WithDefault<boolean, true>,
55
+ |}>;
56
+
57
+ type ComponentType = HostComponent<NativeProps>;
58
+
59
+ export default (codegenNativeComponent<NativeProps>(
60
+ 'RNSSearchBar',
61
+ {}
62
+ ): ComponentType);
@@ -2,10 +2,18 @@ import Screen from './Screen';
2
2
  import ScreenStackHeaderSubview from './ScreenStackHeaderSubview';
3
3
  import ScreenStackHeaderConfig from './ScreenStackHeaderConfigNativeComponent';
4
4
  import ScreenStack from './ScreenStack';
5
+ import SearchBar from './SearchBar';
6
+ import ScreenContainer from './ScreenContainer';
7
+ import ScreenNavigationContainer from './ScreenNavigationContainer';
8
+ import FullWindowOverlay from './FullWindowOverlay';
5
9
 
6
10
  export {
7
11
  Screen,
8
12
  ScreenStackHeaderSubview,
9
13
  ScreenStackHeaderConfig,
10
14
  ScreenStack,
15
+ SearchBar,
16
+ ScreenContainer,
17
+ ScreenNavigationContainer,
18
+ FullWindowOverlay,
11
19
  };
@@ -11,9 +11,6 @@ import {
11
11
  ViewProps,
12
12
  } from 'react-native';
13
13
  import { Freeze } from 'react-freeze';
14
- // @ts-ignore Getting private component
15
- // eslint-disable-next-line import/default
16
- import processColor from 'react-native/Libraries/StyleSheet/processColor';
17
14
  import { version } from 'react-native/package.json';
18
15
 
19
16
  import TransitionProgressContext from './TransitionProgressContext';
@@ -106,6 +103,7 @@ const ScreensNativeModules = {
106
103
  get NativeScreenContainer() {
107
104
  NativeScreenContainerValue =
108
105
  NativeScreenContainerValue ||
106
+ FabricComponents.ScreenContainer ||
109
107
  requireNativeComponent('RNSScreenContainer');
110
108
  return NativeScreenContainerValue;
111
109
  },
@@ -114,7 +112,8 @@ const ScreensNativeModules = {
114
112
  NativeScreenNavigationContainerValue =
115
113
  NativeScreenNavigationContainerValue ||
116
114
  (Platform.OS === 'ios'
117
- ? requireNativeComponent('RNSScreenNavigationContainer')
115
+ ? FabricComponents.ScreenNavigationContainer ||
116
+ requireNativeComponent('RNSScreenNavigationContainer')
118
117
  : this.NativeScreenContainer);
119
118
  return NativeScreenNavigationContainerValue;
120
119
  },
@@ -144,13 +143,18 @@ const ScreensNativeModules = {
144
143
  },
145
144
 
146
145
  get NativeSearchBar() {
147
- NativeSearchBar = NativeSearchBar || requireNativeComponent('RNSSearchBar');
146
+ NativeSearchBar =
147
+ NativeSearchBar ||
148
+ FabricComponents.SearchBar ||
149
+ requireNativeComponent('RNSSearchBar');
148
150
  return NativeSearchBar;
149
151
  },
150
152
 
151
153
  get NativeFullWindowOverlay() {
152
154
  NativeFullWindowOverlay =
153
- NativeFullWindowOverlay || requireNativeComponent('RNSFullWindowOverlay');
155
+ NativeFullWindowOverlay ||
156
+ FabricComponents.FullWindowOverlay ||
157
+ requireNativeComponent('RNSFullWindowOverlay');
154
158
  return NativeFullWindowOverlay;
155
159
  },
156
160
  };
@@ -233,15 +237,9 @@ class Screen extends React.Component<ScreenProps> {
233
237
  const { enabled = ENABLE_SCREENS, ...rest } = this.props;
234
238
 
235
239
  if (enabled && isPlatformSupported) {
236
- if (!AnimatedNativeScreen) {
237
- if (ENABLE_FABRIC) {
238
- AnimatedNativeScreen = ScreensNativeModules.NativeScreen;
239
- } else {
240
- AnimatedNativeScreen = Animated.createAnimatedComponent(
241
- ScreensNativeModules.NativeScreen
242
- ) as React.ComponentType<ScreenProps>;
243
- }
244
- }
240
+ AnimatedNativeScreen =
241
+ AnimatedNativeScreen ||
242
+ Animated.createAnimatedComponent(ScreensNativeModules.NativeScreen);
245
243
 
246
244
  let {
247
245
  // Filter out active prop in this case because it is unused and
@@ -251,7 +249,6 @@ class Screen extends React.Component<ScreenProps> {
251
249
  activityState,
252
250
  children,
253
251
  isNativeStack,
254
- statusBarColor,
255
252
  ...props
256
253
  } = rest;
257
254
 
@@ -262,8 +259,6 @@ class Screen extends React.Component<ScreenProps> {
262
259
  activityState = active !== 0 ? 2 : 0; // in the new version, we need one of the screens to have value of 2 after the transition
263
260
  }
264
261
 
265
- const processedColor = processColor(statusBarColor);
266
-
267
262
  const handleRef = (ref: ViewConfig) => {
268
263
  if (!ENABLE_FABRIC) {
269
264
  if (ref?.viewConfig?.validAttributes?.style) {
@@ -280,7 +275,6 @@ class Screen extends React.Component<ScreenProps> {
280
275
  <MaybeFreeze freeze={activityState === 0}>
281
276
  <AnimatedNativeScreen
282
277
  {...props}
283
- statusBarColor={processedColor}
284
278
  activityState={activityState}
285
279
  // This prevents showing blank screen when navigating between multiple screens with freezing
286
280
  // https://github.com/software-mansion/react-native-screens/pull/1208
@@ -111,6 +111,12 @@ export type NativeStackNavigationOptions = {
111
111
  * @platform ios
112
112
  */
113
113
  gestureEnabled?: boolean;
114
+ /**
115
+ * Use it to restrict the distance from the edges of screen in which the gesture should be recognized. To be used alongside `fullScreenSwipeEnabled`.
116
+ *
117
+ * @platform ios
118
+ */
119
+ gestureResponseDistance?: ScreenProps['gestureResponseDistance'];
114
120
  /**
115
121
  * Title to display in the back button.
116
122
  * Only supported on iOS.
@@ -249,6 +255,12 @@ export type NativeStackNavigationOptions = {
249
255
  * @platform ios
250
256
  */
251
257
  homeIndicatorHidden?: boolean;
258
+ /**
259
+ * Whether the keyboard should hide when swiping to the previous screen. Defaults to `false`.
260
+ *
261
+ * @platform ios
262
+ */
263
+ hideKeyboardOnSwipe?: boolean;
252
264
  /**
253
265
  * Boolean indicating whether, when the Android default back button is clicked, the `pop` action should be performed on the native side or on the JS side to be able to prevent it.
254
266
  * Unfortunately the same behavior is not available on iOS since the behavior of native back button cannot be changed there.
@@ -151,6 +151,7 @@ const RouteView = ({
151
151
  const {
152
152
  gestureEnabled,
153
153
  headerShown,
154
+ hideKeyboardOnSwipe,
154
155
  homeIndicatorHidden,
155
156
  nativeBackButtonDismissalEnabled = false,
156
157
  navigationBarColor,
@@ -169,6 +170,7 @@ const RouteView = ({
169
170
  let {
170
171
  customAnimationOnSwipe,
171
172
  fullScreenSwipeEnabled,
173
+ gestureResponseDistance,
172
174
  stackAnimation,
173
175
  stackPresentation = 'push',
174
176
  } = options;
@@ -190,6 +192,29 @@ const RouteView = ({
190
192
  }
191
193
  }
192
194
 
195
+ if (gestureResponseDistance === undefined) {
196
+ // default values, required for unification of Fabric & Paper implementation
197
+ gestureResponseDistance = {
198
+ start: -1,
199
+ end: -1,
200
+ top: -1,
201
+ bottom: -1,
202
+ };
203
+ } else {
204
+ if (gestureResponseDistance.start === undefined) {
205
+ gestureResponseDistance.start = -1;
206
+ }
207
+ if (gestureResponseDistance.end === undefined) {
208
+ gestureResponseDistance.end = -1;
209
+ }
210
+ if (gestureResponseDistance.top === undefined) {
211
+ gestureResponseDistance.top = -1;
212
+ }
213
+ if (gestureResponseDistance.bottom === undefined) {
214
+ gestureResponseDistance.bottom = -1;
215
+ }
216
+ }
217
+
193
218
  if (index === 0) {
194
219
  // first screen should always be treated as `push`, it resolves problems with no header animation
195
220
  // for navigator with first screen as `modal` and the next as `push`
@@ -218,8 +243,10 @@ const RouteView = ({
218
243
  style={StyleSheet.absoluteFill}
219
244
  customAnimationOnSwipe={customAnimationOnSwipe}
220
245
  fullScreenSwipeEnabled={fullScreenSwipeEnabled}
246
+ hideKeyboardOnSwipe={hideKeyboardOnSwipe}
221
247
  homeIndicatorHidden={homeIndicatorHidden}
222
248
  gestureEnabled={isAndroid ? false : gestureEnabled}
249
+ gestureResponseDistance={gestureResponseDistance}
223
250
  nativeBackButtonDismissalEnabled={nativeBackButtonDismissalEnabled}
224
251
  navigationBarColor={navigationBarColor}
225
252
  navigationBarHidden={navigationBarHidden}
@@ -14,6 +14,9 @@ const AnimatedScreen = Animated.createAnimatedComponent(
14
14
  (Screen as unknown) as React.ComponentClass
15
15
  );
16
16
 
17
+ // @ts-expect-error nativeFabricUIManager is not yet included in the RN types
18
+ const ENABLE_FABRIC = !!global?.nativeFabricUIManager;
19
+
17
20
  const ReanimatedNativeStackScreen = React.forwardRef<
18
21
  typeof AnimatedScreen,
19
22
  ScreenProps
@@ -39,6 +42,9 @@ const ReanimatedNativeStackScreen = React.forwardRef<
39
42
  // This should not be necessary, but is not properly managed by `react-native-reanimated`
40
43
  // @ts-ignore wrong type
41
44
  Platform.OS === 'android'
45
+ ? 'onTransitionProgress'
46
+ : // for some reason there is a difference in required event name between architectures
47
+ ENABLE_FABRIC
42
48
  ? 'onTransitionProgress'
43
49
  : 'topTransitionProgress',
44
50
  ]
package/src/types.tsx CHANGED
@@ -70,6 +70,13 @@ export type TransitionProgressEventType = {
70
70
  goingForward: number;
71
71
  };
72
72
 
73
+ export type GestureResponseDistanceType = {
74
+ start?: number;
75
+ end?: number;
76
+ top?: number;
77
+ bottom?: number;
78
+ };
79
+
73
80
  export interface ScreenProps extends ViewProps {
74
81
  active?: 0 | 1 | Animated.AnimatedInterpolation;
75
82
  activityState?: 0 | 1 | 2 | Animated.AnimatedInterpolation;
@@ -102,12 +109,24 @@ export interface ScreenProps extends ViewProps {
102
109
  * @platform ios
103
110
  */
104
111
  gestureEnabled?: boolean;
112
+ /**
113
+ * Use it to restrict the distance from the edges of screen in which the gesture should be recognized. To be used alongside `fullScreenSwipeEnabled`.
114
+ *
115
+ * @platform ios
116
+ */
117
+ gestureResponseDistance?: GestureResponseDistanceType;
105
118
  /**
106
119
  * Whether the home indicator should be hidden on this screen. Defaults to `false`.
107
120
  *
108
121
  * @platform ios
109
122
  */
110
123
  homeIndicatorHidden?: boolean;
124
+ /**
125
+ * Whether the keyboard should hide when swiping to the previous screen. Defaults to `false`.
126
+ *
127
+ * @platform ios
128
+ */
129
+ hideKeyboardOnSwipe?: boolean;
111
130
  /**
112
131
  * Boolean indicating whether, when the Android default back button is clicked, the `pop` action should be performed on the native side or on the JS side to be able to prevent it.
113
132
  * Unfortunately the same behavior is not available on iOS since the behavior of native back button cannot be changed there.
@@ -425,6 +444,12 @@ export interface SearchBarProps {
425
444
  * The search field background color
426
445
  */
427
446
  barTintColor?: string;
447
+ /**
448
+ * The color for the cursor caret and cancel button text.
449
+ *
450
+ * @platform ios
451
+ */
452
+ tintColor?: string;
428
453
  /**
429
454
  * The text to be used instead of default `Cancel` button text
430
455
  *
@@ -1,105 +0,0 @@
1
- #import <UIKit/UIKit.h>
2
-
3
- #import "RNSFullWindowOverlay.h"
4
-
5
- #import <React/RCTTouchHandler.h>
6
-
7
- @implementation RNSFullWindowOverlayContainer
8
-
9
- - (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event
10
- {
11
- for (UIView *view in [self subviews]) {
12
- if (view.userInteractionEnabled && [view pointInside:[self convertPoint:point toView:view] withEvent:event]) {
13
- return YES;
14
- }
15
- }
16
- return NO;
17
- }
18
-
19
- @end
20
-
21
- @implementation RNSFullWindowOverlay {
22
- __weak RCTBridge *_bridge;
23
- RNSFullWindowOverlayContainer *_container;
24
- CGRect _reactFrame;
25
- RCTTouchHandler *_touchHandler;
26
- }
27
-
28
- - (instancetype)initWithBridge:(RCTBridge *)bridge
29
- {
30
- if (self = [super init]) {
31
- _bridge = bridge;
32
- _reactFrame = CGRectNull;
33
- _container = self.container;
34
- [self show];
35
- }
36
-
37
- return self;
38
- }
39
-
40
- - (void)reactSetFrame:(CGRect)frame
41
- {
42
- _reactFrame = frame;
43
- [_container setFrame:frame];
44
- }
45
-
46
- - (void)addSubview:(UIView *)view
47
- {
48
- [_container addSubview:view];
49
- }
50
-
51
- - (RNSFullWindowOverlayContainer *)container
52
- {
53
- if (_container == nil) {
54
- _container = [[RNSFullWindowOverlayContainer alloc] initWithFrame:_reactFrame];
55
- }
56
-
57
- return _container;
58
- }
59
-
60
- - (void)show
61
- {
62
- UIWindow *window = RCTSharedApplication().delegate.window;
63
- [window addSubview:_container];
64
- }
65
-
66
- - (void)hide
67
- {
68
- if (!_container) {
69
- return;
70
- }
71
-
72
- [_container removeFromSuperview];
73
- }
74
-
75
- - (void)didMoveToWindow
76
- {
77
- if (self.window == nil) {
78
- [self hide];
79
- [_touchHandler detachFromView:_container];
80
- } else {
81
- if (_touchHandler == nil) {
82
- _touchHandler = [[RCTTouchHandler alloc] initWithBridge:_bridge];
83
- }
84
- [_touchHandler attachToView:_container];
85
- }
86
- }
87
-
88
- - (void)invalidate
89
- {
90
- [self hide];
91
- _container = nil;
92
- }
93
-
94
- @end
95
-
96
- @implementation RNSFullWindowOverlayManager
97
-
98
- RCT_EXPORT_MODULE()
99
-
100
- - (UIView *)view
101
- {
102
- return [[RNSFullWindowOverlay alloc] initWithBridge:self.bridge];
103
- }
104
-
105
- @end
@@ -1,23 +0,0 @@
1
- #import <UIKit/UIKit.h>
2
-
3
- #import <React/RCTViewComponentView.h>
4
- #import "RNSScreenController.h"
5
-
6
- NS_ASSUME_NONNULL_BEGIN
7
-
8
- @interface RNSScreenComponentView : RCTViewComponentView
9
-
10
- @property (weak, nonatomic) UIView *reactSuperview;
11
- @property (weak, nonatomic) UIView *config;
12
- @property (nonatomic, retain) RNSScreenController *controller;
13
-
14
- - (void)notifyWillAppear;
15
- - (void)notifyWillDisappear;
16
- - (void)notifyAppear;
17
- - (void)notifyDisappear;
18
- - (void)updateBounds;
19
- - (void)notifyDismissedWithCount:(int)dismissCount;
20
-
21
- @end
22
-
23
- NS_ASSUME_NONNULL_END