react-native-screens 3.17.0 → 3.18.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.
Files changed (51) hide show
  1. package/README.md +5 -1
  2. package/android/build.gradle +0 -34
  3. package/android/src/main/java/com/swmansion/rnscreens/CustomSearchView.kt +2 -0
  4. package/android/src/main/java/com/swmansion/rnscreens/LifecycleHelper.kt +1 -2
  5. package/android/src/main/java/com/swmansion/rnscreens/RNScreensPackage.kt +2 -11
  6. package/android/src/main/java/com/swmansion/rnscreens/Screen.kt +1 -6
  7. package/android/src/main/java/com/swmansion/rnscreens/ScreenContainer.kt +18 -31
  8. package/android/src/main/java/com/swmansion/rnscreens/ScreenContainerViewManager.kt +6 -18
  9. package/android/src/main/java/com/swmansion/rnscreens/ScreenFragment.kt +23 -34
  10. package/android/src/main/java/com/swmansion/rnscreens/ScreenStack.kt +19 -38
  11. package/android/src/main/java/com/swmansion/rnscreens/ScreenStackFragment.kt +37 -32
  12. package/android/src/main/java/com/swmansion/rnscreens/ScreenStackHeaderConfig.kt +14 -26
  13. package/android/src/main/java/com/swmansion/rnscreens/ScreenStackHeaderConfigViewManager.kt +6 -18
  14. package/android/src/main/java/com/swmansion/rnscreens/ScreenStackHeaderSubview.kt +2 -6
  15. package/android/src/main/java/com/swmansion/rnscreens/ScreenStackHeaderSubviewManager.kt +3 -9
  16. package/android/src/main/java/com/swmansion/rnscreens/ScreenStackViewManager.kt +11 -32
  17. package/android/src/main/java/com/swmansion/rnscreens/ScreenViewManager.kt +3 -10
  18. package/android/src/main/java/com/swmansion/rnscreens/ScreenWindowTraits.kt +1 -0
  19. package/android/src/main/jni/CMakeLists.txt +72 -0
  20. package/android/src/main/jni/rnscreens.cpp +16 -0
  21. package/android/src/main/jni/rnscreens.h +28 -0
  22. package/common/cpp/{rnscreens → react/renderer/components/rnscreens}/RNSScreenComponentDescriptor.h +0 -0
  23. package/common/cpp/{rnscreens → react/renderer/components/rnscreens}/RNSScreenShadowNode.cpp +0 -0
  24. package/common/cpp/{rnscreens → react/renderer/components/rnscreens}/RNSScreenShadowNode.h +3 -2
  25. package/common/cpp/{rnscreens → react/renderer/components/rnscreens}/RNSScreenState.cpp +0 -0
  26. package/common/cpp/{rnscreens → react/renderer/components/rnscreens}/RNSScreenState.h +1 -1
  27. package/ios/RNSFullWindowOverlay.mm +1 -1
  28. package/ios/RNSScreen.mm +1 -1
  29. package/ios/RNSScreenContainer.mm +1 -1
  30. package/ios/RNSScreenNavigationContainer.mm +1 -1
  31. package/ios/RNSScreenStackHeaderConfig.mm +5 -2
  32. package/ios/RNSSearchBar.mm +1 -1
  33. package/lib/commonjs/native-stack/utils/getDefaultHeaderHeight.js +1 -1
  34. package/lib/commonjs/native-stack/utils/getDefaultHeaderHeight.js.map +1 -1
  35. package/lib/module/native-stack/utils/getDefaultHeaderHeight.js +1 -1
  36. package/lib/module/native-stack/utils/getDefaultHeaderHeight.js.map +1 -1
  37. package/lib/typescript/native-stack/types.d.ts +5 -5
  38. package/lib/typescript/reanimated/ReanimatedNativeStackScreen.d.ts +1 -1
  39. package/lib/typescript/reanimated/ReanimatedScreen.d.ts +1 -1
  40. package/lib/typescript/types.d.ts +20 -5
  41. package/package.json +8 -8
  42. package/react-native.config.js +19 -0
  43. package/src/native-stack/types.tsx +5 -5
  44. package/src/native-stack/utils/getDefaultHeaderHeight.tsx +1 -1
  45. package/src/types.tsx +20 -5
  46. package/android/src/fabric/java/com/swmansion/rnscreens/RNScreensComponentsRegistry.java +0 -28
  47. package/android/src/main/jni/Android.mk +0 -44
  48. package/android/src/main/jni/OnLoad.cpp +0 -9
  49. package/android/src/main/jni/RNScreensComponentsRegistry.cpp +0 -66
  50. package/android/src/main/jni/RNScreensComponentsRegistry.h +0 -34
  51. package/common/cpp/Android.mk +0 -37
@@ -70,6 +70,11 @@ export declare type NativeStackNavigationOptions = {
70
70
  * @platform ios
71
71
  */
72
72
  disableBackButtonMenu?: boolean;
73
+ /**
74
+ * Whether inactive screens should be suspended from re-rendering. Defaults to `false`.
75
+ * Defaults to `true` when `enableFreeze()` is run at the top of the application.
76
+ */
77
+ freezeOnBlur?: boolean;
73
78
  /**
74
79
  * Boolean indicating whether the swipe gesture should work on whole screen. Swiping with this option results in the same transition animation as `simple_push` by default.
75
80
  * It can be changed to other custom animations with `customAnimationOnSwipe` prop, but default iOS swipe animation is not achievable due to usage of custom recognizer.
@@ -355,11 +360,6 @@ export declare type NativeStackNavigationOptions = {
355
360
  * @platform ios
356
361
  */
357
362
  transitionDuration?: number;
358
- /**
359
- * Whether inactive screens should be suspended from re-rendering. Defaults to `false`.
360
- * Defaults to `true` when `enableFreeze()` is run at the top of the application.
361
- */
362
- freezeOnBlur?: boolean;
363
363
  };
364
364
  export declare type NativeStackNavigatorProps = DefaultNavigatorOptions<NativeStackNavigationOptions> & StackRouterOptions & NativeStackNavigationConfig;
365
365
  export declare type NativeStackDescriptor = Descriptor<ParamListBase, string, StackNavigationState<ParamListBase>, NativeStackNavigationOptions>;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
2
  import { ScreenProps } from 'react-native-screens';
3
3
  import Animated from 'react-native-reanimated';
4
- declare const ReanimatedNativeStackScreen: React.ForwardRefExoticComponent<Pick<ScreenProps, "children" | "active" | "activityState" | "customAnimationOnSwipe" | "enabled" | "isNativeStack" | "fullScreenSwipeEnabled" | "gestureEnabled" | "gestureResponseDistance" | "homeIndicatorHidden" | "hideKeyboardOnSwipe" | "nativeBackButtonDismissalEnabled" | "navigationBarColor" | "navigationBarHidden" | "onAppear" | "onComponentRef" | "onDisappear" | "onDismissed" | "onHeaderBackButtonClicked" | "onTransitionProgress" | "onWillAppear" | "onWillDisappear" | "replaceAnimation" | "screenOrientation" | "stackAnimation" | "stackPresentation" | "statusBarAnimation" | "statusBarColor" | "statusBarHidden" | "statusBarStyle" | "statusBarTranslucent" | "swipeDirection" | "transitionDuration" | "freezeOnBlur" | "hitSlop" | "onLayout" | "pointerEvents" | "removeClippedSubviews" | "style" | "testID" | "nativeID" | "collapsable" | "needsOffscreenAlphaCompositing" | "renderToHardwareTextureAndroid" | "focusable" | "shouldRasterizeIOS" | "isTVSelectable" | "hasTVPreferredFocus" | "tvParallaxProperties" | "tvParallaxShiftDistanceX" | "tvParallaxShiftDistanceY" | "tvParallaxTiltAngle" | "tvParallaxMagnification" | "onStartShouldSetResponder" | "onMoveShouldSetResponder" | "onResponderEnd" | "onResponderGrant" | "onResponderReject" | "onResponderMove" | "onResponderRelease" | "onResponderStart" | "onResponderTerminationRequest" | "onResponderTerminate" | "onStartShouldSetResponderCapture" | "onMoveShouldSetResponderCapture" | "onTouchStart" | "onTouchMove" | "onTouchEnd" | "onTouchCancel" | "onTouchEndCapture" | "accessible" | "accessibilityActions" | "accessibilityLabel" | "accessibilityRole" | "accessibilityState" | "accessibilityHint" | "accessibilityValue" | "onAccessibilityAction" | "accessibilityComponentType" | "accessibilityLiveRegion" | "importantForAccessibility" | "accessibilityElementsHidden" | "accessibilityTraits" | "accessibilityViewIsModal" | "onAccessibilityEscape" | "onAccessibilityTap" | "onMagicTap" | "accessibilityIgnoresInvertColors"> & React.RefAttributes<React.ComponentClass<Animated.AnimateProps<{}>, any>>>;
4
+ declare const ReanimatedNativeStackScreen: React.ForwardRefExoticComponent<Pick<ScreenProps, "children" | "active" | "activityState" | "customAnimationOnSwipe" | "enabled" | "isNativeStack" | "freezeOnBlur" | "fullScreenSwipeEnabled" | "gestureEnabled" | "gestureResponseDistance" | "homeIndicatorHidden" | "hideKeyboardOnSwipe" | "nativeBackButtonDismissalEnabled" | "navigationBarColor" | "navigationBarHidden" | "onAppear" | "onComponentRef" | "onDisappear" | "onDismissed" | "onHeaderBackButtonClicked" | "onNativeDismissCancelled" | "onTransitionProgress" | "onWillAppear" | "onWillDisappear" | "preventNativeDismiss" | "replaceAnimation" | "screenOrientation" | "stackAnimation" | "stackPresentation" | "statusBarAnimation" | "statusBarColor" | "statusBarHidden" | "statusBarStyle" | "statusBarTranslucent" | "swipeDirection" | "transitionDuration" | "hitSlop" | "onLayout" | "pointerEvents" | "removeClippedSubviews" | "style" | "testID" | "nativeID" | "collapsable" | "needsOffscreenAlphaCompositing" | "renderToHardwareTextureAndroid" | "focusable" | "shouldRasterizeIOS" | "isTVSelectable" | "hasTVPreferredFocus" | "tvParallaxProperties" | "tvParallaxShiftDistanceX" | "tvParallaxShiftDistanceY" | "tvParallaxTiltAngle" | "tvParallaxMagnification" | "onStartShouldSetResponder" | "onMoveShouldSetResponder" | "onResponderEnd" | "onResponderGrant" | "onResponderReject" | "onResponderMove" | "onResponderRelease" | "onResponderStart" | "onResponderTerminationRequest" | "onResponderTerminate" | "onStartShouldSetResponderCapture" | "onMoveShouldSetResponderCapture" | "onTouchStart" | "onTouchMove" | "onTouchEnd" | "onTouchCancel" | "onTouchEndCapture" | "accessible" | "accessibilityActions" | "accessibilityLabel" | "accessibilityRole" | "accessibilityState" | "accessibilityHint" | "accessibilityValue" | "onAccessibilityAction" | "accessibilityComponentType" | "accessibilityLiveRegion" | "importantForAccessibility" | "accessibilityElementsHidden" | "accessibilityTraits" | "accessibilityViewIsModal" | "onAccessibilityEscape" | "onAccessibilityTap" | "onMagicTap" | "accessibilityIgnoresInvertColors"> & React.RefAttributes<React.ComponentClass<Animated.AnimateProps<{}>, any>>>;
5
5
  export default ReanimatedNativeStackScreen;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
2
  import { ScreenProps } from 'react-native-screens';
3
3
  import Animated from 'react-native-reanimated';
4
- declare const ReanimatedScreen: React.ForwardRefExoticComponent<Pick<ScreenProps, "children" | "active" | "activityState" | "customAnimationOnSwipe" | "enabled" | "isNativeStack" | "fullScreenSwipeEnabled" | "gestureEnabled" | "gestureResponseDistance" | "homeIndicatorHidden" | "hideKeyboardOnSwipe" | "nativeBackButtonDismissalEnabled" | "navigationBarColor" | "navigationBarHidden" | "onAppear" | "onComponentRef" | "onDisappear" | "onDismissed" | "onHeaderBackButtonClicked" | "onTransitionProgress" | "onWillAppear" | "onWillDisappear" | "replaceAnimation" | "screenOrientation" | "stackAnimation" | "stackPresentation" | "statusBarAnimation" | "statusBarColor" | "statusBarHidden" | "statusBarStyle" | "statusBarTranslucent" | "swipeDirection" | "transitionDuration" | "freezeOnBlur" | "hitSlop" | "onLayout" | "pointerEvents" | "removeClippedSubviews" | "style" | "testID" | "nativeID" | "collapsable" | "needsOffscreenAlphaCompositing" | "renderToHardwareTextureAndroid" | "focusable" | "shouldRasterizeIOS" | "isTVSelectable" | "hasTVPreferredFocus" | "tvParallaxProperties" | "tvParallaxShiftDistanceX" | "tvParallaxShiftDistanceY" | "tvParallaxTiltAngle" | "tvParallaxMagnification" | "onStartShouldSetResponder" | "onMoveShouldSetResponder" | "onResponderEnd" | "onResponderGrant" | "onResponderReject" | "onResponderMove" | "onResponderRelease" | "onResponderStart" | "onResponderTerminationRequest" | "onResponderTerminate" | "onStartShouldSetResponderCapture" | "onMoveShouldSetResponderCapture" | "onTouchStart" | "onTouchMove" | "onTouchEnd" | "onTouchCancel" | "onTouchEndCapture" | "accessible" | "accessibilityActions" | "accessibilityLabel" | "accessibilityRole" | "accessibilityState" | "accessibilityHint" | "accessibilityValue" | "onAccessibilityAction" | "accessibilityComponentType" | "accessibilityLiveRegion" | "importantForAccessibility" | "accessibilityElementsHidden" | "accessibilityTraits" | "accessibilityViewIsModal" | "onAccessibilityEscape" | "onAccessibilityTap" | "onMagicTap" | "accessibilityIgnoresInvertColors"> & React.RefAttributes<React.ComponentClass<Animated.AnimateProps<{}>, any>>>;
4
+ declare const ReanimatedScreen: React.ForwardRefExoticComponent<Pick<ScreenProps, "children" | "active" | "activityState" | "customAnimationOnSwipe" | "enabled" | "isNativeStack" | "freezeOnBlur" | "fullScreenSwipeEnabled" | "gestureEnabled" | "gestureResponseDistance" | "homeIndicatorHidden" | "hideKeyboardOnSwipe" | "nativeBackButtonDismissalEnabled" | "navigationBarColor" | "navigationBarHidden" | "onAppear" | "onComponentRef" | "onDisappear" | "onDismissed" | "onHeaderBackButtonClicked" | "onNativeDismissCancelled" | "onTransitionProgress" | "onWillAppear" | "onWillDisappear" | "preventNativeDismiss" | "replaceAnimation" | "screenOrientation" | "stackAnimation" | "stackPresentation" | "statusBarAnimation" | "statusBarColor" | "statusBarHidden" | "statusBarStyle" | "statusBarTranslucent" | "swipeDirection" | "transitionDuration" | "hitSlop" | "onLayout" | "pointerEvents" | "removeClippedSubviews" | "style" | "testID" | "nativeID" | "collapsable" | "needsOffscreenAlphaCompositing" | "renderToHardwareTextureAndroid" | "focusable" | "shouldRasterizeIOS" | "isTVSelectable" | "hasTVPreferredFocus" | "tvParallaxProperties" | "tvParallaxShiftDistanceX" | "tvParallaxShiftDistanceY" | "tvParallaxTiltAngle" | "tvParallaxMagnification" | "onStartShouldSetResponder" | "onMoveShouldSetResponder" | "onResponderEnd" | "onResponderGrant" | "onResponderReject" | "onResponderMove" | "onResponderRelease" | "onResponderStart" | "onResponderTerminationRequest" | "onResponderTerminate" | "onStartShouldSetResponderCapture" | "onMoveShouldSetResponderCapture" | "onTouchStart" | "onTouchMove" | "onTouchEnd" | "onTouchCancel" | "onTouchEndCapture" | "accessible" | "accessibilityActions" | "accessibilityLabel" | "accessibilityRole" | "accessibilityState" | "accessibilityHint" | "accessibilityValue" | "onAccessibilityAction" | "accessibilityComponentType" | "accessibilityLiveRegion" | "importantForAccessibility" | "accessibilityElementsHidden" | "accessibilityTraits" | "accessibilityViewIsModal" | "onAccessibilityEscape" | "onAccessibilityTap" | "onMagicTap" | "accessibilityIgnoresInvertColors"> & React.RefAttributes<React.ComponentClass<Animated.AnimateProps<{}>, any>>>;
5
5
  export default ReanimatedScreen;
@@ -35,6 +35,11 @@ export interface ScreenProps extends ViewProps {
35
35
  * Internal boolean used to not attach events used only by native-stack. It prevents non native-stack navigators from sending transition progress from their Screen components.
36
36
  */
37
37
  isNativeStack?: boolean;
38
+ /**
39
+ * Whether inactive screens should be suspended from re-rendering. Defaults to `false`.
40
+ * When `enableFreeze()` is run at the top of the application defaults to `true`.
41
+ */
42
+ freezeOnBlur?: boolean;
38
43
  /**
39
44
  * Boolean indicating whether the swipe gesture should work on whole screen. Swiping with this option results in the same transition animation as `simple_push` by default.
40
45
  * It can be changed to other custom animations with `customAnimationOnSwipe` prop, but default iOS swipe animation is not achievable due to usage of custom recognizer.
@@ -109,6 +114,14 @@ export interface ScreenProps extends ViewProps {
109
114
  * @platform android
110
115
  */
111
116
  onHeaderBackButtonClicked?: () => void;
117
+ /**
118
+ * An internal callback called when screen is dismissed by gesture or by native header back button and `preventNativeDismiss` is set to `true`.
119
+ *
120
+ * @platform ios
121
+ */
122
+ onNativeDismissCancelled?: (e: NativeSyntheticEvent<{
123
+ dismissCount: number;
124
+ }>) => void;
112
125
  /**
113
126
  * An internal callback called every frame during the transition of screens of `native-stack`, used to feed transition context.
114
127
  */
@@ -121,6 +134,13 @@ export interface ScreenProps extends ViewProps {
121
134
  * A callback that gets called when the current screen will disappear. This is called as soon as the transition begins.
122
135
  */
123
136
  onWillDisappear?: (e: NativeSyntheticEvent<TargetedEvent>) => void;
137
+ /**
138
+ * Boolean indicating whether to prevent current screen from being dismissed.
139
+ * Defaults to `false`.
140
+ *
141
+ * @platform ios
142
+ */
143
+ preventNativeDismiss?: boolean;
124
144
  ref?: React.Ref<View>;
125
145
  /**
126
146
  * How should the screen replacing another screen animate. Defaults to `pop`.
@@ -209,11 +229,6 @@ export interface ScreenProps extends ViewProps {
209
229
  * @platform ios
210
230
  */
211
231
  transitionDuration?: number;
212
- /**
213
- * Whether inactive screens should be suspended from re-rendering. Defaults to `false`.
214
- * When `enableFreeze()` is run at the top of the application defaults to `true`.
215
- */
216
- freezeOnBlur?: boolean;
217
232
  }
218
233
  export interface ScreenContainerProps extends ViewProps {
219
234
  children?: React.ReactNode;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-screens",
3
- "version": "3.17.0",
3
+ "version": "3.18.1",
4
4
  "description": "Native navigation primitives for your React Native app.",
5
5
  "scripts": {
6
6
  "check-types": "tsc --noEmit",
@@ -38,6 +38,7 @@
38
38
  "ios/",
39
39
  "windows/",
40
40
  "RNScreens.podspec",
41
+ "react-native.config.js",
41
42
  "README.md",
42
43
  "!**/__tests__",
43
44
  "!android/src/main/java/com/swmansion/rnscreens/LifecycleHelper.kt"
@@ -132,12 +133,11 @@
132
133
  "lib/"
133
134
  ],
134
135
  "codegenConfig": {
135
- "libraries": [
136
- {
137
- "name": "rnscreens",
138
- "type": "components",
139
- "jsSrcsDir": "./src/fabric"
140
- }
141
- ]
136
+ "name": "rnscreens",
137
+ "type": "components",
138
+ "jsSrcsDir": "./src/fabric",
139
+ "android": {
140
+ "javaPackageName": "com.swmansion.rnscreens"
141
+ }
142
142
  }
143
143
  }
@@ -0,0 +1,19 @@
1
+ module.exports = {
2
+ dependency: {
3
+ platforms: {
4
+ android: {
5
+ componentDescriptors: [
6
+ "RNSFullWindowOverlayComponentDescriptor",
7
+ "RNSScreenContainerComponentDescriptor",
8
+ "RNSScreenNavigationContainerComponentDescriptor",
9
+ "RNSScreenStackHeaderConfigComponentDescriptor",
10
+ "RNSScreenStackHeaderSubviewComponentDescriptor",
11
+ "RNSScreenStackComponentDescriptor",
12
+ "RNSSearchBarComponentDescriptor",
13
+ 'RNSScreenComponentDescriptor'
14
+ ],
15
+ cmakeListsPath: "../android/src/main/jni/CMakeLists.txt"
16
+ },
17
+ },
18
+ },
19
+ }
@@ -96,6 +96,11 @@ export type NativeStackNavigationOptions = {
96
96
  * @platform ios
97
97
  */
98
98
  disableBackButtonMenu?: boolean;
99
+ /**
100
+ * Whether inactive screens should be suspended from re-rendering. Defaults to `false`.
101
+ * Defaults to `true` when `enableFreeze()` is run at the top of the application.
102
+ */
103
+ freezeOnBlur?: boolean;
99
104
  /**
100
105
  * Boolean indicating whether the swipe gesture should work on whole screen. Swiping with this option results in the same transition animation as `simple_push` by default.
101
106
  * It can be changed to other custom animations with `customAnimationOnSwipe` prop, but default iOS swipe animation is not achievable due to usage of custom recognizer.
@@ -375,11 +380,6 @@ export type NativeStackNavigationOptions = {
375
380
  * @platform ios
376
381
  */
377
382
  transitionDuration?: number;
378
- /**
379
- * Whether inactive screens should be suspended from re-rendering. Defaults to `false`.
380
- * Defaults to `true` when `enableFreeze()` is run at the top of the application.
381
- */
382
- freezeOnBlur?: boolean;
383
383
  };
384
384
 
385
385
  export type NativeStackNavigatorProps = DefaultNavigatorOptions<
@@ -22,7 +22,7 @@ export default function getDefaultHeaderHeight(
22
22
  statusBarHeight = 0;
23
23
  }
24
24
 
25
- if (Platform.isPad || Platform.isTVOS) {
25
+ if (Platform.isPad || Platform.isTV) {
26
26
  headerHeight = isFromSheetModal ? formSheetModalHeight : 50;
27
27
  } else {
28
28
  if (isLandscape) {
package/src/types.tsx CHANGED
@@ -95,6 +95,11 @@ export interface ScreenProps extends ViewProps {
95
95
  * Internal boolean used to not attach events used only by native-stack. It prevents non native-stack navigators from sending transition progress from their Screen components.
96
96
  */
97
97
  isNativeStack?: boolean;
98
+ /**
99
+ * Whether inactive screens should be suspended from re-rendering. Defaults to `false`.
100
+ * When `enableFreeze()` is run at the top of the application defaults to `true`.
101
+ */
102
+ freezeOnBlur?: boolean;
98
103
  /**
99
104
  * Boolean indicating whether the swipe gesture should work on whole screen. Swiping with this option results in the same transition animation as `simple_push` by default.
100
105
  * It can be changed to other custom animations with `customAnimationOnSwipe` prop, but default iOS swipe animation is not achievable due to usage of custom recognizer.
@@ -167,6 +172,14 @@ export interface ScreenProps extends ViewProps {
167
172
  * @platform android
168
173
  */
169
174
  onHeaderBackButtonClicked?: () => void;
175
+ /**
176
+ * An internal callback called when screen is dismissed by gesture or by native header back button and `preventNativeDismiss` is set to `true`.
177
+ *
178
+ * @platform ios
179
+ */
180
+ onNativeDismissCancelled?: (
181
+ e: NativeSyntheticEvent<{ dismissCount: number }>
182
+ ) => void;
170
183
  /**
171
184
  * An internal callback called every frame during the transition of screens of `native-stack`, used to feed transition context.
172
185
  */
@@ -181,6 +194,13 @@ export interface ScreenProps extends ViewProps {
181
194
  * A callback that gets called when the current screen will disappear. This is called as soon as the transition begins.
182
195
  */
183
196
  onWillDisappear?: (e: NativeSyntheticEvent<TargetedEvent>) => void;
197
+ /**
198
+ * Boolean indicating whether to prevent current screen from being dismissed.
199
+ * Defaults to `false`.
200
+ *
201
+ * @platform ios
202
+ */
203
+ preventNativeDismiss?: boolean;
184
204
  ref?: React.Ref<View>;
185
205
  /**
186
206
  * How should the screen replacing another screen animate. Defaults to `pop`.
@@ -269,11 +289,6 @@ export interface ScreenProps extends ViewProps {
269
289
  * @platform ios
270
290
  */
271
291
  transitionDuration?: number;
272
- /**
273
- * Whether inactive screens should be suspended from re-rendering. Defaults to `false`.
274
- * When `enableFreeze()` is run at the top of the application defaults to `true`.
275
- */
276
- freezeOnBlur?: boolean;
277
292
  }
278
293
 
279
294
  export interface ScreenContainerProps extends ViewProps {
@@ -1,28 +0,0 @@
1
- package com.swmansion.rnscreens;
2
-
3
- import com.facebook.jni.HybridData;
4
- import com.facebook.proguard.annotations.DoNotStrip;
5
- import com.facebook.react.fabric.ComponentFactory;
6
- import com.facebook.soloader.SoLoader;
7
-
8
- @DoNotStrip
9
- public class RNScreensComponentsRegistry {
10
- static {
11
- SoLoader.loadLibrary("rnscreens_modules");
12
- }
13
-
14
- @DoNotStrip private final HybridData mHybridData;
15
-
16
- @DoNotStrip
17
- private native HybridData initHybrid(ComponentFactory componentFactory);
18
-
19
- @DoNotStrip
20
- private RNScreensComponentsRegistry(ComponentFactory componentFactory) {
21
- mHybridData = initHybrid(componentFactory);
22
- }
23
-
24
- @DoNotStrip
25
- public static RNScreensComponentsRegistry register(ComponentFactory componentFactory) {
26
- return new RNScreensComponentsRegistry(componentFactory);
27
- }
28
- }
@@ -1,44 +0,0 @@
1
- SCREENS_MAIN_THIS_DIR := $(call my-dir)
2
-
3
- include $(REACT_ANDROID_DIR)/Android-prebuilt.mk
4
-
5
- include $(SCREENS_MAIN_THIS_DIR)/../../../build/generated/source/codegen/jni/Android.mk
6
- include $(SCREENS_MAIN_THIS_DIR)/../../../../common/cpp/Android.mk
7
-
8
- include $(CLEAR_VARS)
9
-
10
- LOCAL_PATH := $(SCREENS_MAIN_THIS_DIR)
11
- LOCAL_MODULE := rnscreens_modules
12
-
13
- LOCAL_C_INCLUDES := $(LOCAL_PATH) $(GENERATED_SRC_DIR)/codegen/jni
14
- LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/*.cpp) $(wildcard $(GENERATED_SRC_DIR)/codegen/jni/*.cpp)
15
- LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH) $(GENERATED_SRC_DIR)/codegen/jni
16
-
17
- # Please note as one of the library listed is libreact_codegen_samplelibrary
18
- # This name will be generated as libreact_codegen_<library-name>
19
- # where <library-name> is the one you specified in the Gradle configuration
20
- LOCAL_SHARED_LIBRARIES := libjsi \
21
- libfbjni \
22
- libglog \
23
- libfolly_runtime \
24
- libyoga \
25
- libreact_nativemodule_core \
26
- libturbomodulejsijni \
27
- librrc_view \
28
- libreact_render_core \
29
- libreact_render_graphics \
30
- libfabricjni \
31
- libreact_debug \
32
- libreact_render_componentregistry \
33
- libreact_render_debug \
34
- libruntimeexecutor \
35
- libreact_render_mapbuffer \
36
- libreact_codegen_rncore \
37
- libreact_codegen_rnscreens \
38
- librnscreens_common
39
-
40
- LOCAL_CFLAGS := \
41
- -DLOG_TAG=\"ReactNative\"
42
- LOCAL_CFLAGS += -fexceptions -frtti -std=c++17 -Wall
43
-
44
- include $(BUILD_SHARED_LIBRARY)
@@ -1,9 +0,0 @@
1
- #include <fbjni/fbjni.h>
2
-
3
- #include "RNScreensComponentsRegistry.h"
4
-
5
- JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *) {
6
- return facebook::jni::initialize(vm, [] {
7
- facebook::react::RNScreensComponentsRegistry::registerNatives();
8
- });
9
- }
@@ -1,66 +0,0 @@
1
- #include "RNScreensComponentsRegistry.h"
2
-
3
- #include <CoreComponentsRegistry.h>
4
- #include <fbjni/fbjni.h>
5
- #include <react/renderer/componentregistry/ComponentDescriptorProviderRegistry.h>
6
- #include <react/renderer/components/rnscreens/ComponentDescriptors.h>
7
- #include <react/renderer/mapbuffer/MapBuffer.h>
8
- #include <react/renderer/mapbuffer/MapBufferBuilder.h>
9
- #include <rnscreens/RNSScreenComponentDescriptor.h>
10
-
11
- namespace facebook {
12
- namespace react {
13
-
14
- RNScreensComponentsRegistry::RNScreensComponentsRegistry(
15
- ComponentFactory *delegate)
16
- : delegate_(delegate) {}
17
-
18
- std::shared_ptr<ComponentDescriptorProviderRegistry const>
19
- RNScreensComponentsRegistry::sharedProviderRegistry() {
20
- auto providerRegistry = CoreComponentsRegistry::sharedProviderRegistry();
21
-
22
- // Screens
23
- providerRegistry->add(concreteComponentDescriptorProvider<RNSScreenComponentDescriptor>());
24
- providerRegistry->add(concreteComponentDescriptorProvider<RNSScreenStackComponentDescriptor>());
25
- providerRegistry->add(concreteComponentDescriptorProvider<RNSScreenStackHeaderConfigComponentDescriptor>());
26
- providerRegistry->add(concreteComponentDescriptorProvider<RNSScreenStackHeaderSubviewComponentDescriptor>());
27
-
28
- return providerRegistry;
29
- }
30
-
31
- jni::local_ref<RNScreensComponentsRegistry::jhybriddata>
32
- RNScreensComponentsRegistry::initHybrid(
33
- jni::alias_ref<jclass>,
34
- ComponentFactory *delegate) {
35
- auto instance = makeCxxInstance(delegate);
36
-
37
- auto buildRegistryFunction =
38
- [](EventDispatcher::Weak const &eventDispatcher,
39
- ContextContainer::Shared const &contextContainer)
40
- -> ComponentDescriptorRegistry::Shared {
41
- auto registry = RNScreensComponentsRegistry::sharedProviderRegistry()
42
- ->createComponentDescriptorRegistry(
43
- {eventDispatcher, contextContainer});
44
-
45
- return registry;
46
- };
47
-
48
- delegate->buildRegistryFunction = buildRegistryFunction;
49
- return instance;
50
- }
51
-
52
- void RNScreensComponentsRegistry::registerNatives() {
53
- registerHybrid({
54
- makeNativeMethod("initHybrid", RNScreensComponentsRegistry::initHybrid),
55
- });
56
- // This is a temporary solution that allows components exported by the screens
57
- // library to be added to the main component registry. This code is triggered
58
- // when c++ screens library is initialized and is needed because RN's autolinking
59
- // does not currently support Fabric components. As a consequence, users would need
60
- // to manually put library initialization calls in their ReactNativeHost implementation
61
- // which is undesirable.
62
- sharedProviderRegistry();
63
- }
64
-
65
- } // namespace react
66
- } // namespace facebook
@@ -1,34 +0,0 @@
1
- #pragma once
2
-
3
- #include <ComponentFactory.h>
4
- #include <fbjni/fbjni.h>
5
- #include <react/renderer/componentregistry/ComponentDescriptorProviderRegistry.h>
6
- #include <react/renderer/componentregistry/ComponentDescriptorRegistry.h>
7
-
8
- namespace facebook {
9
- namespace react {
10
-
11
- class RNScreensComponentsRegistry
12
- : public facebook::jni::HybridClass<RNScreensComponentsRegistry> {
13
- public:
14
- constexpr static auto kJavaDescriptor =
15
- "Lcom/swmansion/rnscreens/RNScreensComponentsRegistry;";
16
-
17
- static void registerNatives();
18
-
19
- RNScreensComponentsRegistry(ComponentFactory *delegate);
20
-
21
- private:
22
- friend HybridBase;
23
-
24
- static std::shared_ptr<ComponentDescriptorProviderRegistry const> sharedProviderRegistry();
25
-
26
- const ComponentFactory *delegate_;
27
-
28
- static jni::local_ref<jhybriddata> initHybrid(
29
- jni::alias_ref<jclass>,
30
- ComponentFactory *delegate);
31
- };
32
-
33
- } // namespace react
34
- } // namespace facebook
@@ -1,37 +0,0 @@
1
- SCREENS_COMMON_THIS_DIR := $(call my-dir)
2
-
3
- include $(CLEAR_VARS)
4
-
5
- LOCAL_PATH := $(SCREENS_COMMON_THIS_DIR)
6
- LOCAL_MODULE := rnscreens_common
7
-
8
- LOCAL_C_INCLUDES := $(LOCAL_PATH) $(GENERATED_SRC_DIR)/codegen/jni
9
- LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/**/*.cpp)
10
- LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH) $(GENERATED_SRC_DIR)/codegen/jni
11
-
12
- # Please note as one of the library listed is libreact_codegen_samplelibrary
13
- # This name will be generated as libreact_codegen_<library-name>
14
- # where <library-name> is the one you specified in the Gradle configuration
15
- LOCAL_SHARED_LIBRARIES := libjsi \
16
- libfbjni \
17
- libglog \
18
- libfolly_runtime \
19
- libyoga \
20
- libreact_nativemodule_core \
21
- libturbomodulejsijni \
22
- librrc_view \
23
- libreact_render_core \
24
- libreact_render_graphics \
25
- libfabricjni \
26
- libreact_debug \
27
- libreact_render_componentregistry \
28
- libreact_render_debug \
29
- libruntimeexecutor \
30
- libreact_codegen_rncore \
31
- libreact_codegen_rnscreens
32
-
33
- LOCAL_CFLAGS := \
34
- -DLOG_TAG=\"ReactNative\"
35
- LOCAL_CFLAGS += -fexceptions -frtti -std=c++17 -Wall
36
-
37
- include $(BUILD_SHARED_LIBRARY)