react-native-screens 3.31.1 → 3.33.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/README.md +21 -11
- package/RNScreens.podspec +11 -52
- package/android/CMakeLists.txt +48 -4
- package/android/build.gradle +16 -9
- package/android/src/fabric/java/com/swmansion/rnscreens/FabricEnabledViewGroup.kt +25 -16
- package/android/src/fabric/java/com/swmansion/rnscreens/NativeProxy.kt +53 -0
- package/android/src/main/cpp/NativeProxy.cpp +51 -0
- package/android/src/main/cpp/NativeProxy.h +35 -0
- package/android/src/main/cpp/OnLoad.cpp +8 -0
- package/android/src/main/cpp/jni-adapter.cpp +86 -93
- package/android/src/main/java/com/swmansion/rnscreens/CustomSearchView.kt +7 -2
- package/android/src/main/java/com/swmansion/rnscreens/CustomToolbar.kt +6 -1
- package/android/src/main/java/com/swmansion/rnscreens/FragmentBackPressOverrider.kt +2 -2
- package/android/src/main/java/com/swmansion/rnscreens/RNScreensPackage.kt +36 -17
- package/android/src/main/java/com/swmansion/rnscreens/Screen.kt +150 -40
- package/android/src/main/java/com/swmansion/rnscreens/ScreenContainer.kt +52 -30
- package/android/src/main/java/com/swmansion/rnscreens/ScreenContainerViewManager.kt +27 -4
- package/android/src/main/java/com/swmansion/rnscreens/ScreenEventDispatcher.kt +10 -2
- package/android/src/main/java/com/swmansion/rnscreens/ScreenFragment.kt +56 -27
- package/android/src/main/java/com/swmansion/rnscreens/ScreenFragmentWrapper.kt +8 -1
- package/android/src/main/java/com/swmansion/rnscreens/ScreenStack.kt +50 -19
- package/android/src/main/java/com/swmansion/rnscreens/ScreenStackFragment.kt +63 -39
- package/android/src/main/java/com/swmansion/rnscreens/ScreenStackFragmentWrapper.kt +4 -0
- package/android/src/main/java/com/swmansion/rnscreens/ScreenStackHeaderConfig.kt +88 -57
- package/android/src/main/java/com/swmansion/rnscreens/ScreenStackHeaderConfigViewManager.kt +131 -36
- package/android/src/main/java/com/swmansion/rnscreens/ScreenStackHeaderSubview.kt +19 -4
- package/android/src/main/java/com/swmansion/rnscreens/ScreenStackHeaderSubviewManager.kt +16 -10
- package/android/src/main/java/com/swmansion/rnscreens/ScreenStackViewManager.kt +28 -25
- package/android/src/main/java/com/swmansion/rnscreens/ScreenViewManager.kt +177 -77
- package/android/src/main/java/com/swmansion/rnscreens/ScreenWindowTraits.kt +77 -25
- package/android/src/main/java/com/swmansion/rnscreens/ScreensModule.kt +31 -9
- package/android/src/main/java/com/swmansion/rnscreens/ScreensShadowNode.kt +3 -1
- package/android/src/main/java/com/swmansion/rnscreens/SearchBarManager.kt +160 -54
- package/android/src/main/java/com/swmansion/rnscreens/SearchBarView.kt +29 -22
- package/android/src/main/java/com/swmansion/rnscreens/SearchViewFormatter.kt +7 -2
- package/android/src/main/java/com/swmansion/rnscreens/events/HeaderAttachedEvent.kt +4 -1
- package/android/src/main/java/com/swmansion/rnscreens/events/HeaderBackButtonClickedEvent.kt +4 -1
- package/android/src/main/java/com/swmansion/rnscreens/events/HeaderDetachedEvent.kt +4 -1
- package/android/src/main/java/com/swmansion/rnscreens/events/HeaderHeightChangeEvent.kt +5 -6
- package/android/src/main/java/com/swmansion/rnscreens/events/ScreenAppearEvent.kt +4 -1
- package/android/src/main/java/com/swmansion/rnscreens/events/ScreenDisappearEvent.kt +4 -1
- package/android/src/main/java/com/swmansion/rnscreens/events/ScreenDismissedEvent.kt +8 -4
- package/android/src/main/java/com/swmansion/rnscreens/events/ScreenTransitionProgressEvent.kt +7 -6
- package/android/src/main/java/com/swmansion/rnscreens/events/ScreenWillAppearEvent.kt +4 -1
- package/android/src/main/java/com/swmansion/rnscreens/events/ScreenWillDisappearEvent.kt +4 -1
- package/android/src/main/java/com/swmansion/rnscreens/events/SearchBarBlurEvent.kt +5 -2
- package/android/src/main/java/com/swmansion/rnscreens/events/SearchBarChangeTextEvent.kt +4 -3
- package/android/src/main/java/com/swmansion/rnscreens/events/SearchBarCloseEvent.kt +4 -1
- package/android/src/main/java/com/swmansion/rnscreens/events/SearchBarFocusEvent.kt +5 -2
- package/android/src/main/java/com/swmansion/rnscreens/events/SearchBarOpenEvent.kt +4 -1
- package/android/src/main/java/com/swmansion/rnscreens/events/SearchBarSearchButtonPressEvent.kt +9 -4
- package/android/src/main/java/com/swmansion/rnscreens/events/StackFinishTransitioningEvent.kt +4 -1
- package/android/src/main/java/com/swmansion/rnscreens/utils/DeviceUtils.kt +1 -5
- package/android/src/main/java/com/swmansion/rnscreens/utils/ScreenDummyLayoutHelper.kt +214 -0
- package/android/src/main/jni/CMakeLists.txt +5 -4
- package/android/src/paper/java/com/facebook/react/viewmanagers/RNSScreenContainerManagerDelegate.java +25 -0
- package/android/src/paper/java/com/facebook/react/viewmanagers/RNSScreenContainerManagerInterface.java +16 -0
- package/android/src/paper/java/com/facebook/react/viewmanagers/RNSScreenManagerDelegate.java +6 -0
- package/android/src/paper/java/com/facebook/react/viewmanagers/RNSScreenManagerInterface.java +2 -0
- package/android/src/paper/java/com/facebook/react/viewmanagers/RNSScreenStackHeaderConfigManagerDelegate.java +3 -0
- package/android/src/paper/java/com/facebook/react/viewmanagers/RNSScreenStackHeaderConfigManagerInterface.java +1 -0
- package/android/src/paper/java/com/facebook/react/viewmanagers/RNSSearchBarManagerDelegate.java +99 -0
- package/android/src/paper/java/com/facebook/react/viewmanagers/RNSSearchBarManagerInterface.java +37 -0
- package/android/src/paper/java/com/swmansion/rnscreens/FabricEnabledViewGroup.kt +10 -5
- package/android/src/paper/java/com/swmansion/rnscreens/NativeProxy.kt +19 -0
- package/android/src/paper/java/com/swmansion/rnscreens/NativeScreensModuleSpec.java +4 -0
- package/common/cpp/react/renderer/components/rnscreens/FrameCorrectionModes.h +51 -0
- package/common/cpp/react/renderer/components/rnscreens/RNSModalScreenComponentDescriptor.h +8 -9
- package/common/cpp/react/renderer/components/rnscreens/RNSModalScreenShadowNode.cpp +2 -1
- package/common/cpp/react/renderer/components/rnscreens/RNSModalScreenShadowNode.h +9 -8
- package/common/cpp/react/renderer/components/rnscreens/RNSScreenComponentDescriptor.h +147 -10
- package/common/cpp/react/renderer/components/rnscreens/RNSScreenShadowNode.cpp +51 -1
- package/common/cpp/react/renderer/components/rnscreens/RNSScreenShadowNode.h +29 -7
- package/common/cpp/react/renderer/components/rnscreens/RNSScreenState.cpp +22 -1
- package/common/cpp/react/renderer/components/rnscreens/RNSScreenState.h +30 -10
- package/common/cpp/react/renderer/components/rnscreens/utils/RectUtil.h +36 -0
- package/cpp/RNSScreenRemovalListener.cpp +25 -0
- package/cpp/RNSScreenRemovalListener.h +20 -0
- package/cpp/RNScreensTurboModule.cpp +31 -23
- package/cpp/RNScreensTurboModule.h +17 -20
- package/ios/RNSConvert.h +7 -0
- package/ios/RNSConvert.mm +24 -0
- package/ios/RNSModalScreen.mm +22 -0
- package/ios/RNSModule.mm +2 -3
- package/ios/RNSScreen.h +2 -1
- package/ios/RNSScreen.mm +35 -19
- package/ios/RNSScreenContainer.mm +1 -1
- package/ios/RNSScreenStack.mm +59 -54
- package/ios/RNSScreenStackAnimator.mm +43 -6
- package/ios/RNSScreenStackHeaderConfig.h +2 -0
- package/ios/RNSScreenStackHeaderConfig.mm +93 -28
- package/ios/RNSScreenStackHeaderSubview.mm +8 -0
- package/ios/RNSSearchBar.h +5 -5
- package/ios/RNSSearchBar.mm +11 -11
- package/ios/utils/RCTSurfaceTouchHandler+RNSUtility.h +15 -0
- package/ios/utils/RCTSurfaceTouchHandler+RNSUtility.mm +14 -0
- package/ios/utils/RCTTouchHandler+RNSUtility.h +15 -0
- package/ios/utils/RCTTouchHandler+RNSUtility.mm +15 -0
- package/ios/utils/UIView+RNSUtility.h +23 -0
- package/ios/utils/UIView+RNSUtility.mm +55 -0
- package/lib/commonjs/components/Screen.js +119 -127
- package/lib/commonjs/components/Screen.js.map +1 -1
- package/lib/commonjs/components/ScreenStack.js +8 -1
- package/lib/commonjs/components/ScreenStack.js.map +1 -1
- package/lib/commonjs/components/SearchBar.js +39 -36
- package/lib/commonjs/components/SearchBar.js.map +1 -1
- package/lib/commonjs/fabric/ModalScreenNativeComponent.js.map +1 -1
- package/lib/commonjs/fabric/ScreenNativeComponent.js.map +1 -1
- package/lib/commonjs/fabric/ScreenStackHeaderConfigNativeComponent.js.map +1 -1
- package/lib/commonjs/native-stack/views/HeaderConfig.js +2 -0
- package/lib/commonjs/native-stack/views/HeaderConfig.js.map +1 -1
- package/lib/commonjs/native-stack/views/NativeStackView.js +4 -0
- package/lib/commonjs/native-stack/views/NativeStackView.js.map +1 -1
- package/lib/module/components/Screen.js +118 -126
- package/lib/module/components/Screen.js.map +1 -1
- package/lib/module/components/ScreenStack.js +8 -1
- package/lib/module/components/ScreenStack.js.map +1 -1
- package/lib/module/components/SearchBar.js +39 -36
- package/lib/module/components/SearchBar.js.map +1 -1
- package/lib/module/fabric/ModalScreenNativeComponent.js.map +1 -1
- package/lib/module/fabric/ScreenNativeComponent.js.map +1 -1
- package/lib/module/fabric/ScreenStackHeaderConfigNativeComponent.js.map +1 -1
- package/lib/module/native-stack/views/HeaderConfig.js +2 -0
- package/lib/module/native-stack/views/HeaderConfig.js.map +1 -1
- package/lib/module/native-stack/views/NativeStackView.js +4 -0
- package/lib/module/native-stack/views/NativeStackView.js.map +1 -1
- package/lib/typescript/TransitionProgressContext.d.ts +1 -1
- package/lib/typescript/TransitionProgressContext.d.ts.map +1 -1
- package/lib/typescript/components/Screen.d.ts +3 -14
- package/lib/typescript/components/Screen.d.ts.map +1 -1
- package/lib/typescript/components/ScreenStack.d.ts.map +1 -1
- package/lib/typescript/components/SearchBar.d.ts +14 -21
- package/lib/typescript/components/SearchBar.d.ts.map +1 -1
- package/lib/typescript/fabric/ModalScreenNativeComponent.d.ts +12 -10
- package/lib/typescript/fabric/ModalScreenNativeComponent.d.ts.map +1 -1
- package/lib/typescript/fabric/ScreenNativeComponent.d.ts +12 -10
- package/lib/typescript/fabric/ScreenNativeComponent.d.ts.map +1 -1
- package/lib/typescript/fabric/ScreenStackHeaderConfigNativeComponent.d.ts +5 -3
- package/lib/typescript/fabric/ScreenStackHeaderConfigNativeComponent.d.ts.map +1 -1
- package/lib/typescript/fabric/ScreenStackHeaderSubviewNativeComponent.d.ts +1 -1
- package/lib/typescript/fabric/ScreenStackHeaderSubviewNativeComponent.d.ts.map +1 -1
- package/lib/typescript/fabric/ScreenStackNativeComponent.d.ts +1 -1
- package/lib/typescript/fabric/ScreenStackNativeComponent.d.ts.map +1 -1
- package/lib/typescript/fabric/SearchBarNativeComponent.d.ts +9 -9
- package/lib/typescript/fabric/SearchBarNativeComponent.d.ts.map +1 -1
- package/lib/typescript/gesture-handler/RNScreensTurboModule.d.ts +1 -1
- package/lib/typescript/gesture-handler/RNScreensTurboModule.d.ts.map +1 -1
- package/lib/typescript/native-stack/types.d.ts +39 -14
- package/lib/typescript/native-stack/types.d.ts.map +1 -1
- package/lib/typescript/native-stack/utils/SafeAreaProviderCompat.d.ts +1 -1
- package/lib/typescript/native-stack/utils/SafeAreaProviderCompat.d.ts.map +1 -1
- package/lib/typescript/native-stack/utils/getDefaultHeaderHeight.d.ts +1 -1
- package/lib/typescript/native-stack/utils/getDefaultHeaderHeight.d.ts.map +1 -1
- package/lib/typescript/native-stack/utils/useAnimatedHeaderHeight.d.ts +1 -1
- package/lib/typescript/native-stack/utils/useAnimatedHeaderHeight.d.ts.map +1 -1
- package/lib/typescript/native-stack/views/HeaderConfig.d.ts +2 -2
- package/lib/typescript/native-stack/views/HeaderConfig.d.ts.map +1 -1
- package/lib/typescript/native-stack/views/NativeStackView.d.ts +1 -1
- package/lib/typescript/native-stack/views/NativeStackView.d.ts.map +1 -1
- package/lib/typescript/reanimated/ReanimatedTransitionProgressContext.d.ts +1 -1
- package/lib/typescript/reanimated/ReanimatedTransitionProgressContext.d.ts.map +1 -1
- package/lib/typescript/types.d.ts +39 -13
- package/lib/typescript/types.d.ts.map +1 -1
- package/lib/typescript/useTransitionProgress.d.ts +3 -3
- package/native-stack/README.md +116 -98
- package/package.json +16 -7
- package/react-native.config.js +17 -15
- package/src/TransitionProgressContext.tsx +1 -1
- package/src/components/Screen.tsx +31 -37
- package/src/components/ScreenStack.tsx +11 -1
- package/src/components/ScreenStackHeaderConfig.tsx +5 -5
- package/src/components/ScreenStackHeaderConfig.web.tsx +6 -6
- package/src/components/SearchBar.tsx +77 -65
- package/src/core.ts +1 -1
- package/src/fabric/ModalScreenNativeComponent.ts +2 -0
- package/src/fabric/ScreenNativeComponent.ts +2 -0
- package/src/fabric/ScreenNavigationContainerNativeComponent.ts +1 -1
- package/src/fabric/ScreenStackHeaderConfigNativeComponent.ts +4 -1
- package/src/fabric/ScreenStackHeaderSubviewNativeComponent.ts +1 -1
- package/src/fabric/SearchBarNativeComponent.ts +7 -7
- package/src/gesture-handler/ScreenGestureDetector.tsx +5 -5
- package/src/gesture-handler/constraints.ts +5 -5
- package/src/gesture-handler/fabricUtils.ts +1 -1
- package/src/native-stack/contexts/GHContext.tsx +1 -1
- package/src/native-stack/navigators/createNativeStackNavigator.tsx +3 -3
- package/src/native-stack/types.tsx +29 -4
- package/src/native-stack/utils/getDefaultHeaderHeight.tsx +1 -1
- package/src/native-stack/utils/getStatusBarHeight.tsx +1 -1
- package/src/native-stack/utils/useAnimatedHeaderHeight.tsx +1 -1
- package/src/native-stack/utils/useBackPressSubscription.tsx +1 -1
- package/src/native-stack/utils/useHeaderHeight.tsx +1 -1
- package/src/native-stack/views/FontProcessor.tsx +1 -1
- package/src/native-stack/views/HeaderConfig.tsx +3 -1
- package/src/native-stack/views/NativeStackView.tsx +13 -9
- package/src/reanimated/ReanimatedHeaderHeightContext.tsx +1 -1
- package/src/reanimated/ReanimatedNativeStackScreen.tsx +5 -5
- package/src/reanimated/ReanimatedScreen.tsx +2 -2
- package/src/reanimated/ReanimatedScreenProvider.tsx +1 -1
- package/src/reanimated/useReanimatedHeaderHeight.tsx +1 -1
- package/src/reanimated/useReanimatedTransitionProgress.tsx +1 -1
- package/src/types.tsx +31 -5
- package/src/useTransitionProgress.tsx +1 -1
- package/windows/README.md +4 -1
|
@@ -41,7 +41,7 @@ function NativeStackNavigator({
|
|
|
41
41
|
// @ts-ignore navigation.dangerouslyGetParent was removed in v6
|
|
42
42
|
if (navigation?.dangerouslyGetParent === undefined) {
|
|
43
43
|
console.warn(
|
|
44
|
-
'Looks like you are importing `native-stack` from `react-native-screens/native-stack`. Since version 6 of `react-navigation`, it should be imported from `@react-navigation/native-stack`.'
|
|
44
|
+
'Looks like you are importing `native-stack` from `react-native-screens/native-stack`. Since version 6 of `react-navigation`, it should be imported from `@react-navigation/native-stack`.',
|
|
45
45
|
);
|
|
46
46
|
}
|
|
47
47
|
}, [navigation]);
|
|
@@ -70,9 +70,9 @@ function NativeStackNavigator({
|
|
|
70
70
|
});
|
|
71
71
|
}
|
|
72
72
|
});
|
|
73
|
-
}
|
|
73
|
+
},
|
|
74
74
|
),
|
|
75
|
-
[navigation, state.index, state.key]
|
|
75
|
+
[navigation, state.index, state.key],
|
|
76
76
|
);
|
|
77
77
|
|
|
78
78
|
return (
|
|
@@ -56,7 +56,7 @@ export type NativeStackNavigationEventMap = {
|
|
|
56
56
|
|
|
57
57
|
export type NativeStackNavigationProp<
|
|
58
58
|
ParamList extends ParamListBase,
|
|
59
|
-
RouteName extends keyof ParamList = string
|
|
59
|
+
RouteName extends keyof ParamList = string,
|
|
60
60
|
> = NavigationProp<
|
|
61
61
|
ParamList,
|
|
62
62
|
RouteName,
|
|
@@ -68,7 +68,7 @@ export type NativeStackNavigationProp<
|
|
|
68
68
|
|
|
69
69
|
export type NativeStackScreenProps<
|
|
70
70
|
ParamList extends ParamListBase,
|
|
71
|
-
RouteName extends keyof ParamList = string
|
|
71
|
+
RouteName extends keyof ParamList = string,
|
|
72
72
|
> = {
|
|
73
73
|
navigation: NativeStackNavigationProp<ParamList, RouteName>;
|
|
74
74
|
route: RouteProp<ParamList, RouteName>;
|
|
@@ -112,6 +112,15 @@ export type NativeStackNavigationOptions = {
|
|
|
112
112
|
* @platform ios
|
|
113
113
|
*/
|
|
114
114
|
disableBackButtonMenu?: boolean;
|
|
115
|
+
/**
|
|
116
|
+
* How the back button behaves by default (when not customized). Available on iOS>=14, and is used only when none of: `backTitleFontFamily`, `backTitleFontSize`, `disableBackButtonMenu` or `backTitle` is set.
|
|
117
|
+
* The following values are currently supported (they correspond to https://developer.apple.com/documentation/uikit/uinavigationitembackbuttondisplaymode?language=objc):
|
|
118
|
+
* - "default" – show given back button previous controller title, system generic or just icon based on available space
|
|
119
|
+
* - "generic" – show given system generic or just icon based on available space
|
|
120
|
+
* - "minimal" – show just an icon
|
|
121
|
+
* @platform ios
|
|
122
|
+
*/
|
|
123
|
+
backButtonDisplayMode?: ScreenStackHeaderConfigProps['backButtonDisplayMode'];
|
|
115
124
|
/**
|
|
116
125
|
* Whether inactive screens should be suspended from re-rendering. Defaults to `false`.
|
|
117
126
|
* Defaults to `true` when `enableFreeze()` is run at the top of the application.
|
|
@@ -125,6 +134,16 @@ export type NativeStackNavigationOptions = {
|
|
|
125
134
|
* @platform ios
|
|
126
135
|
*/
|
|
127
136
|
fullScreenSwipeEnabled?: boolean;
|
|
137
|
+
/**
|
|
138
|
+
* Whether the full screen dismiss gesture has shadow under view during transition. The gesture uses custom transition and thus
|
|
139
|
+
* doesn't have a shadow by default. When enabled, a custom shadow view is added during the transition which tries to mimic the
|
|
140
|
+
* default iOS shadow. Defaults to `false`.
|
|
141
|
+
*
|
|
142
|
+
* This does not affect the behavior of transitions that don't use gestures, enabled by `fullScreenGestureEnabled` prop.
|
|
143
|
+
*
|
|
144
|
+
* @platform ios
|
|
145
|
+
*/
|
|
146
|
+
fullScreenSwipeShadowEnabled?: boolean;
|
|
128
147
|
/**
|
|
129
148
|
* Whether you can use gestures to dismiss this screen. Defaults to `true`.
|
|
130
149
|
* Only supported on iOS.
|
|
@@ -296,6 +315,12 @@ export type NativeStackNavigationOptions = {
|
|
|
296
315
|
* @platform android
|
|
297
316
|
*/
|
|
298
317
|
navigationBarColor?: ColorValue;
|
|
318
|
+
/**
|
|
319
|
+
* Boolean indicating whether the content should be visible behind the navigation bar. Defaults to `false`.
|
|
320
|
+
*
|
|
321
|
+
* @platform android
|
|
322
|
+
*/
|
|
323
|
+
navigationBarTranslucent?: boolean;
|
|
299
324
|
/**
|
|
300
325
|
* Sets the visibility of the navigation bar. Defaults to `false`.
|
|
301
326
|
*
|
|
@@ -509,11 +534,11 @@ export interface MeasuredDimensions {
|
|
|
509
534
|
export type AnimatedScreenTransition = {
|
|
510
535
|
topScreenStyle: (
|
|
511
536
|
event: PanGestureHandlerEventPayload,
|
|
512
|
-
screenSize: MeasuredDimensions
|
|
537
|
+
screenSize: MeasuredDimensions,
|
|
513
538
|
) => Record<string, unknown>;
|
|
514
539
|
belowTopScreenStyle: (
|
|
515
540
|
event: PanGestureHandlerEventPayload,
|
|
516
|
-
screenSize: MeasuredDimensions
|
|
541
|
+
screenSize: MeasuredDimensions,
|
|
517
542
|
) => Record<string, unknown>;
|
|
518
543
|
};
|
|
519
544
|
|
|
@@ -8,7 +8,7 @@ export default function getDefaultHeaderHeight(
|
|
|
8
8
|
layout: Layout,
|
|
9
9
|
statusBarHeight: number,
|
|
10
10
|
stackPresentation: StackPresentationTypes,
|
|
11
|
-
isLargeHeader = false
|
|
11
|
+
isLargeHeader = false,
|
|
12
12
|
): number {
|
|
13
13
|
// default header heights
|
|
14
14
|
let headerHeight = Platform.OS === 'android' ? 56 : 64;
|
|
@@ -4,7 +4,7 @@ import { Platform } from 'react-native';
|
|
|
4
4
|
export default function getStatusBarHeight(
|
|
5
5
|
topInset: number,
|
|
6
6
|
dimensions: Rect,
|
|
7
|
-
isStatusBarTranslucent: boolean
|
|
7
|
+
isStatusBarTranslucent: boolean,
|
|
8
8
|
) {
|
|
9
9
|
if (Platform.OS === 'ios') {
|
|
10
10
|
// It looks like some iOS devices don't have strictly set status bar height to 44.
|
|
@@ -7,7 +7,7 @@ export default function useAnimatedHeaderHeight() {
|
|
|
7
7
|
|
|
8
8
|
if (animatedValue === undefined) {
|
|
9
9
|
throw new Error(
|
|
10
|
-
"Couldn't find the header height. Are you inside a screen in a navigator with a header?"
|
|
10
|
+
"Couldn't find the header height. Are you inside a screen in a navigator with a header?",
|
|
11
11
|
);
|
|
12
12
|
}
|
|
13
13
|
|
|
@@ -7,7 +7,7 @@ export default function useHeaderHeight() {
|
|
|
7
7
|
|
|
8
8
|
if (height === undefined) {
|
|
9
9
|
throw new Error(
|
|
10
|
-
"Couldn't find the header height. Are you inside a screen in a navigator with a header?"
|
|
10
|
+
"Couldn't find the header height. Are you inside a screen in a navigator with a header?",
|
|
11
11
|
);
|
|
12
12
|
}
|
|
13
13
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import ReactNativeStyleAttributes from 'react-native/Libraries/Components/View/ReactNativeStyleAttributes';
|
|
4
4
|
|
|
5
5
|
export function processFonts(
|
|
6
|
-
fontFamilies: (string | undefined)[]
|
|
6
|
+
fontFamilies: (string | undefined)[],
|
|
7
7
|
): (string | undefined)[] {
|
|
8
8
|
// @ts-ignore: React Native types are incorrect here and don't consider fontFamily a style value
|
|
9
9
|
const fontFamilyProcessor = ReactNativeStyleAttributes.fontFamily?.process;
|
|
@@ -27,6 +27,7 @@ export default function HeaderConfig({
|
|
|
27
27
|
backButtonInCustomView,
|
|
28
28
|
direction,
|
|
29
29
|
disableBackButtonMenu,
|
|
30
|
+
backButtonDisplayMode = 'default',
|
|
30
31
|
headerBackTitle,
|
|
31
32
|
headerBackTitleStyle = {},
|
|
32
33
|
headerBackTitleVisible = true,
|
|
@@ -103,7 +104,7 @@ export default function HeaderConfig({
|
|
|
103
104
|
warnOnce(
|
|
104
105
|
isVisionOS &&
|
|
105
106
|
(headerTitleStyle.color !== undefined || headerTintColor !== undefined),
|
|
106
|
-
'headerTitleStyle.color and headerTintColor are not supported on visionOS.'
|
|
107
|
+
'headerTitleStyle.color and headerTintColor are not supported on visionOS.',
|
|
107
108
|
);
|
|
108
109
|
|
|
109
110
|
return (
|
|
@@ -120,6 +121,7 @@ export default function HeaderConfig({
|
|
|
120
121
|
color={tintColor}
|
|
121
122
|
direction={direction}
|
|
122
123
|
disableBackButtonMenu={disableBackButtonMenu}
|
|
124
|
+
backButtonDisplayMode={backButtonDisplayMode}
|
|
123
125
|
hidden={headerShown === false}
|
|
124
126
|
hideBackButton={headerHideBackButton}
|
|
125
127
|
hideShadow={headerHideShadow}
|
|
@@ -44,7 +44,7 @@ let Container = View;
|
|
|
44
44
|
|
|
45
45
|
if (__DEV__) {
|
|
46
46
|
const DebugContainer = (
|
|
47
|
-
props: ViewProps & { stackPresentation: StackPresentationTypes }
|
|
47
|
+
props: ViewProps & { stackPresentation: StackPresentationTypes },
|
|
48
48
|
) => {
|
|
49
49
|
const { stackPresentation, ...rest } = props;
|
|
50
50
|
if (Platform.OS === 'ios' && stackPresentation !== 'push') {
|
|
@@ -87,7 +87,7 @@ const MaybeNestedStack = ({
|
|
|
87
87
|
!isAndroid &&
|
|
88
88
|
stackPresentation !== 'push' &&
|
|
89
89
|
headerShownPreviousRef.current !== headerShown,
|
|
90
|
-
`Dynamically changing 'headerShown' in modals will result in remounting the screen and losing all local state. See options for the screen '${route.name}'
|
|
90
|
+
`Dynamically changing 'headerShown' in modals will result in remounting the screen and losing all local state. See options for the screen '${route.name}'.`,
|
|
91
91
|
);
|
|
92
92
|
|
|
93
93
|
headerShownPreviousRef.current = headerShown;
|
|
@@ -119,7 +119,7 @@ const MaybeNestedStack = ({
|
|
|
119
119
|
const statusBarHeight = getStatusBarHeight(
|
|
120
120
|
topInset,
|
|
121
121
|
dimensions,
|
|
122
|
-
isStatusBarTranslucent
|
|
122
|
+
isStatusBarTranslucent,
|
|
123
123
|
);
|
|
124
124
|
|
|
125
125
|
const hasLargeHeader = options.headerLargeTitle ?? false;
|
|
@@ -128,7 +128,7 @@ const MaybeNestedStack = ({
|
|
|
128
128
|
dimensions,
|
|
129
129
|
statusBarHeight,
|
|
130
130
|
stackPresentation,
|
|
131
|
-
hasLargeHeader
|
|
131
|
+
hasLargeHeader,
|
|
132
132
|
);
|
|
133
133
|
|
|
134
134
|
if (isHeaderInModal) {
|
|
@@ -152,7 +152,7 @@ const MaybeNestedStack = ({
|
|
|
152
152
|
|
|
153
153
|
type NavigationRoute<
|
|
154
154
|
ParamList extends ParamListBase,
|
|
155
|
-
RouteName extends keyof ParamList
|
|
155
|
+
RouteName extends keyof ParamList,
|
|
156
156
|
> = Route<Extract<RouteName, string>, ParamList[RouteName]> & {
|
|
157
157
|
state?: NavigationState | PartialState<NavigationState>;
|
|
158
158
|
};
|
|
@@ -174,6 +174,7 @@ const RouteView = ({
|
|
|
174
174
|
}) => {
|
|
175
175
|
const { options, render: renderScene } = descriptors[route.key];
|
|
176
176
|
const {
|
|
177
|
+
fullScreenSwipeShadowEnabled = false,
|
|
177
178
|
gestureEnabled,
|
|
178
179
|
headerShown,
|
|
179
180
|
hideKeyboardOnSwipe,
|
|
@@ -185,6 +186,7 @@ const RouteView = ({
|
|
|
185
186
|
sheetExpandsWhenScrolledToEdge = true,
|
|
186
187
|
nativeBackButtonDismissalEnabled = false,
|
|
187
188
|
navigationBarColor,
|
|
189
|
+
navigationBarTranslucent,
|
|
188
190
|
navigationBarHidden,
|
|
189
191
|
replaceAnimation = 'pop',
|
|
190
192
|
screenOrientation,
|
|
@@ -235,7 +237,7 @@ const RouteView = ({
|
|
|
235
237
|
const statusBarHeight = getStatusBarHeight(
|
|
236
238
|
topInset,
|
|
237
239
|
dimensions,
|
|
238
|
-
isStatusBarTranslucent
|
|
240
|
+
isStatusBarTranslucent,
|
|
239
241
|
);
|
|
240
242
|
|
|
241
243
|
const hasLargeHeader = options.headerLargeTitle ?? false;
|
|
@@ -244,7 +246,7 @@ const RouteView = ({
|
|
|
244
246
|
dimensions,
|
|
245
247
|
statusBarHeight,
|
|
246
248
|
stackPresentation,
|
|
247
|
-
hasLargeHeader
|
|
249
|
+
hasLargeHeader,
|
|
248
250
|
);
|
|
249
251
|
|
|
250
252
|
const parentHeaderHeight = React.useContext(HeaderHeightContext);
|
|
@@ -262,7 +264,7 @@ const RouteView = ({
|
|
|
262
264
|
const animatedHeaderHeight = React.useRef(
|
|
263
265
|
new Animated.Value(staticHeaderHeight, {
|
|
264
266
|
useNativeDriver: true,
|
|
265
|
-
})
|
|
267
|
+
}),
|
|
266
268
|
).current;
|
|
267
269
|
|
|
268
270
|
const Screen = React.useContext(ScreenContext);
|
|
@@ -293,12 +295,14 @@ const RouteView = ({
|
|
|
293
295
|
customAnimationOnSwipe={customAnimationOnSwipe}
|
|
294
296
|
freezeOnBlur={freezeOnBlur}
|
|
295
297
|
fullScreenSwipeEnabled={fullScreenSwipeEnabled}
|
|
298
|
+
fullScreenSwipeShadowEnabled={fullScreenSwipeShadowEnabled}
|
|
296
299
|
hideKeyboardOnSwipe={hideKeyboardOnSwipe}
|
|
297
300
|
homeIndicatorHidden={homeIndicatorHidden}
|
|
298
301
|
gestureEnabled={isAndroid ? false : gestureEnabled}
|
|
299
302
|
gestureResponseDistance={gestureResponseDistance}
|
|
300
303
|
nativeBackButtonDismissalEnabled={nativeBackButtonDismissalEnabled}
|
|
301
304
|
navigationBarColor={navigationBarColor}
|
|
305
|
+
navigationBarTranslucent={navigationBarTranslucent}
|
|
302
306
|
navigationBarHidden={navigationBarHidden}
|
|
303
307
|
replaceAnimation={replaceAnimation}
|
|
304
308
|
screenOrientation={screenOrientation}
|
|
@@ -439,7 +443,7 @@ function NativeStackViewInner({
|
|
|
439
443
|
goBackGesture !== undefined
|
|
440
444
|
) {
|
|
441
445
|
console.warn(
|
|
442
|
-
'Cannot detect GestureDetectorProvider in a screen that uses `goBackGesture`. Make sure your navigator is wrapped in GestureDetectorProvider.'
|
|
446
|
+
'Cannot detect GestureDetectorProvider in a screen that uses `goBackGesture`. Make sure your navigator is wrapped in GestureDetectorProvider.',
|
|
443
447
|
);
|
|
444
448
|
}
|
|
445
449
|
}, [ScreenGestureDetector.name, goBackGesture]);
|
|
@@ -19,7 +19,7 @@ import getStatusBarHeight from '../native-stack/utils/getStatusBarHeight';
|
|
|
19
19
|
import ReanimatedHeaderHeightContext from './ReanimatedHeaderHeightContext';
|
|
20
20
|
|
|
21
21
|
const AnimatedScreen = Animated.createAnimatedComponent(
|
|
22
|
-
InnerScreen as unknown as React.ComponentClass
|
|
22
|
+
InnerScreen as unknown as React.ComponentClass,
|
|
23
23
|
);
|
|
24
24
|
|
|
25
25
|
// We use prop added to global by reanimated since it seems safer than the one from RN. See:
|
|
@@ -40,7 +40,7 @@ const ReanimatedNativeStackScreen = React.forwardRef<
|
|
|
40
40
|
const statusBarHeight = getStatusBarHeight(
|
|
41
41
|
topInset,
|
|
42
42
|
dimensions,
|
|
43
|
-
isStatusBarTranslucent
|
|
43
|
+
isStatusBarTranslucent,
|
|
44
44
|
);
|
|
45
45
|
|
|
46
46
|
// Default header height, normally used in `useHeaderHeight` hook.
|
|
@@ -49,7 +49,7 @@ const ReanimatedNativeStackScreen = React.forwardRef<
|
|
|
49
49
|
dimensions,
|
|
50
50
|
statusBarHeight,
|
|
51
51
|
stackPresentation,
|
|
52
|
-
hasLargeHeader
|
|
52
|
+
hasLargeHeader,
|
|
53
53
|
);
|
|
54
54
|
|
|
55
55
|
const cachedHeaderHeight = React.useRef(defaultHeaderHeight);
|
|
@@ -79,7 +79,7 @@ const ReanimatedNativeStackScreen = React.forwardRef<
|
|
|
79
79
|
ENABLE_FABRIC
|
|
80
80
|
? 'onTransitionProgress'
|
|
81
81
|
: 'topTransitionProgress',
|
|
82
|
-
]
|
|
82
|
+
],
|
|
83
83
|
)}
|
|
84
84
|
onHeaderHeightChangeReanimated={useEvent(
|
|
85
85
|
(event: HeaderHeightChangeEventType) => {
|
|
@@ -96,7 +96,7 @@ const ReanimatedNativeStackScreen = React.forwardRef<
|
|
|
96
96
|
: ENABLE_FABRIC
|
|
97
97
|
? 'onHeaderHeightChange'
|
|
98
98
|
: 'topHeaderHeightChange',
|
|
99
|
-
]
|
|
99
|
+
],
|
|
100
100
|
)}
|
|
101
101
|
{...rest}>
|
|
102
102
|
<ReanimatedHeaderHeightContext.Provider value={headerHeight}>
|
|
@@ -5,7 +5,7 @@ import { InnerScreen, ScreenProps } from 'react-native-screens';
|
|
|
5
5
|
import Animated from 'react-native-reanimated';
|
|
6
6
|
|
|
7
7
|
const AnimatedScreen = Animated.createAnimatedComponent(
|
|
8
|
-
InnerScreen as unknown as React.ComponentClass
|
|
8
|
+
InnerScreen as unknown as React.ComponentClass,
|
|
9
9
|
);
|
|
10
10
|
|
|
11
11
|
const ReanimatedScreen = React.forwardRef<typeof AnimatedScreen, ScreenProps>(
|
|
@@ -17,7 +17,7 @@ const ReanimatedScreen = React.forwardRef<typeof AnimatedScreen, ScreenProps>(
|
|
|
17
17
|
{...props}
|
|
18
18
|
/>
|
|
19
19
|
);
|
|
20
|
-
}
|
|
20
|
+
},
|
|
21
21
|
);
|
|
22
22
|
|
|
23
23
|
ReanimatedScreen.displayName = 'ReanimatedScreen';
|
|
@@ -31,7 +31,7 @@ class ReanimatedScreenWrapper extends React.Component<ScreenProps> {
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
export default function ReanimatedScreenProvider(
|
|
34
|
-
props: PropsWithChildren<unknown
|
|
34
|
+
props: PropsWithChildren<unknown>,
|
|
35
35
|
) {
|
|
36
36
|
return (
|
|
37
37
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -6,7 +6,7 @@ export default function useReanimatedHeaderHeight() {
|
|
|
6
6
|
|
|
7
7
|
if (height === undefined) {
|
|
8
8
|
throw new Error(
|
|
9
|
-
"Couldn't find the header height using Reanimated. Are you inside a screen in a navigator with a header and your NavigationContainer is wrapped in ReanimatedScreenProvider?"
|
|
9
|
+
"Couldn't find the header height using Reanimated. Are you inside a screen in a navigator with a header and your NavigationContainer is wrapped in ReanimatedScreenProvider?",
|
|
10
10
|
);
|
|
11
11
|
}
|
|
12
12
|
|
|
@@ -6,7 +6,7 @@ export default function useReanimatedTransitionProgress() {
|
|
|
6
6
|
|
|
7
7
|
if (progress === undefined) {
|
|
8
8
|
throw new Error(
|
|
9
|
-
"Couldn't find values for reanimated transition progress. Are you inside a screen in Native Stack?"
|
|
9
|
+
"Couldn't find values for reanimated transition progress. Are you inside a screen in Native Stack?",
|
|
10
10
|
);
|
|
11
11
|
}
|
|
12
12
|
|
package/src/types.tsx
CHANGED
|
@@ -19,6 +19,7 @@ export type SearchBarCommands = {
|
|
|
19
19
|
cancelSearch: () => void;
|
|
20
20
|
};
|
|
21
21
|
|
|
22
|
+
export type BackButtonDisplayMode = 'default' | 'generic' | 'minimal';
|
|
22
23
|
export type StackPresentationTypes =
|
|
23
24
|
| 'push'
|
|
24
25
|
| 'modal'
|
|
@@ -132,6 +133,16 @@ export interface ScreenProps extends ViewProps {
|
|
|
132
133
|
* @platform ios
|
|
133
134
|
*/
|
|
134
135
|
fullScreenSwipeEnabled?: boolean;
|
|
136
|
+
/**
|
|
137
|
+
* Whether the full screen dismiss gesture has shadow under view during transition. The gesture uses custom transition and thus
|
|
138
|
+
* doesn't have a shadow by default. When enabled, a custom shadow view is added during the transition which tries to mimic the
|
|
139
|
+
* default iOS shadow. Defaults to `false`.
|
|
140
|
+
*
|
|
141
|
+
* This does not affect the behavior of transitions that don't use gestures, enabled by `fullScreenGestureEnabled` prop.
|
|
142
|
+
*
|
|
143
|
+
* @platform ios
|
|
144
|
+
*/
|
|
145
|
+
fullScreenSwipeShadowEnabled?: boolean;
|
|
135
146
|
/**
|
|
136
147
|
* Whether you can use gestures to dismiss this screen. Defaults to `true`.
|
|
137
148
|
*
|
|
@@ -170,6 +181,12 @@ export interface ScreenProps extends ViewProps {
|
|
|
170
181
|
* @platform android
|
|
171
182
|
*/
|
|
172
183
|
navigationBarColor?: ColorValue;
|
|
184
|
+
/**
|
|
185
|
+
* Boolean indicating whether the content should be visible behind the navigation bar. Defaults to `false`.
|
|
186
|
+
*
|
|
187
|
+
* @platform android
|
|
188
|
+
*/
|
|
189
|
+
navigationBarTranslucent?: boolean;
|
|
173
190
|
/**
|
|
174
191
|
* Sets the visibility of the navigation bar. Defaults to `false`.
|
|
175
192
|
*
|
|
@@ -194,7 +211,7 @@ export interface ScreenProps extends ViewProps {
|
|
|
194
211
|
* A callback that gets called when the header height has changed.
|
|
195
212
|
*/
|
|
196
213
|
onHeaderHeightChange?: (
|
|
197
|
-
e: NativeSyntheticEvent<HeaderHeightChangeEventType
|
|
214
|
+
e: NativeSyntheticEvent<HeaderHeightChangeEventType>,
|
|
198
215
|
) => void;
|
|
199
216
|
/**
|
|
200
217
|
* A callback that gets called after swipe back is canceled.
|
|
@@ -212,13 +229,13 @@ export interface ScreenProps extends ViewProps {
|
|
|
212
229
|
* @platform ios
|
|
213
230
|
*/
|
|
214
231
|
onNativeDismissCancelled?: (
|
|
215
|
-
e: NativeSyntheticEvent<{ dismissCount: number }
|
|
232
|
+
e: NativeSyntheticEvent<{ dismissCount: number }>,
|
|
216
233
|
) => void;
|
|
217
234
|
/**
|
|
218
235
|
* An internal callback called every frame during the transition of screens of `native-stack`, used to feed transition context.
|
|
219
236
|
*/
|
|
220
237
|
onTransitionProgress?: (
|
|
221
|
-
e: NativeSyntheticEvent<TransitionProgressEventType
|
|
238
|
+
e: NativeSyntheticEvent<TransitionProgressEventType>,
|
|
222
239
|
) => void;
|
|
223
240
|
/**
|
|
224
241
|
* A callback that gets called when the current screen will appear. This is called as soon as the transition begins.
|
|
@@ -396,7 +413,7 @@ export interface ScreenContainerProps extends ViewProps {
|
|
|
396
413
|
|
|
397
414
|
export interface GestureDetectorBridge {
|
|
398
415
|
stackUseEffectCallback: (
|
|
399
|
-
stackRef: React.MutableRefObject<React.Ref<NativeStackNavigatorProps
|
|
416
|
+
stackRef: React.MutableRefObject<React.Ref<NativeStackNavigatorProps>>,
|
|
400
417
|
) => void;
|
|
401
418
|
}
|
|
402
419
|
|
|
@@ -461,6 +478,15 @@ export interface ScreenStackHeaderConfigProps extends ViewProps {
|
|
|
461
478
|
* @platform ios
|
|
462
479
|
*/
|
|
463
480
|
disableBackButtonMenu?: boolean;
|
|
481
|
+
/**
|
|
482
|
+
* How the back button behaves by default (when not customized). Available on iOS>=14, and is used only when none of: `backTitleFontFamily`, `backTitleFontSize`, `disableBackButtonMenu` or `backTitle` is set.
|
|
483
|
+
* The following values are currently supported (they correspond to https://developer.apple.com/documentation/uikit/uinavigationitembackbuttondisplaymode?language=objc):
|
|
484
|
+
* - "default" – show given back button previous controller title, system generic or just icon based on available space
|
|
485
|
+
* - "generic" – show given system generic or just icon based on available space
|
|
486
|
+
* - "minimal" – show just an icon
|
|
487
|
+
* @platform ios
|
|
488
|
+
*/
|
|
489
|
+
backButtonDisplayMode?: BackButtonDisplayMode;
|
|
464
490
|
/**
|
|
465
491
|
* When set to true the header will be hidden while the parent Screen is on the top of the stack. The default value is false.
|
|
466
492
|
*/
|
|
@@ -659,7 +685,7 @@ export interface SearchBarProps {
|
|
|
659
685
|
* A callback that gets called when the search button is pressed. It receives the current text value of the search bar.
|
|
660
686
|
*/
|
|
661
687
|
onSearchButtonPress?: (
|
|
662
|
-
e: NativeSyntheticEvent<TextInputFocusEventData
|
|
688
|
+
e: NativeSyntheticEvent<TextInputFocusEventData>,
|
|
663
689
|
) => void;
|
|
664
690
|
/**
|
|
665
691
|
* Text displayed when search field is empty
|
|
@@ -7,7 +7,7 @@ export default function useTransitionProgress() {
|
|
|
7
7
|
|
|
8
8
|
if (progress === undefined) {
|
|
9
9
|
throw new Error(
|
|
10
|
-
"Couldn't find values for transition progress. Are you inside a screen in Native Stack?"
|
|
10
|
+
"Couldn't find values for transition progress. Are you inside a screen in Native Stack?",
|
|
11
11
|
);
|
|
12
12
|
}
|
|
13
13
|
|
package/windows/README.md
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
# react-native-screens Windows Implementation
|
|
2
2
|
|
|
3
3
|
## Module Installation
|
|
4
|
+
|
|
4
5
|
You can either use autolinking on react-native-windows 0.63 and later or manually link the module on earlier releases.
|
|
5
6
|
|
|
6
7
|
## Automatic install with autolinking on RNW >= 0.63
|
|
8
|
+
|
|
7
9
|
RNScreens supports autolinking. Just call: `npm i react-native-screens --save`
|
|
8
10
|
|
|
9
11
|
## Manual installation on RNW >= 0.62
|
|
12
|
+
|
|
10
13
|
1. `npm install react-native-screens --save`
|
|
11
14
|
2. Open your solution in Visual Studio 2019 (eg. `windows\yourapp.sln`)
|
|
12
15
|
3. Right-click Solution icon in Solution Explorer > Add > Existing Project...
|
|
@@ -22,4 +25,4 @@ If you want to contribute to this module Windows implementation, first you must
|
|
|
22
25
|
|
|
23
26
|
You must temporarily install the `react-native-windows` package. Versions of `react-native-windows` and `react-native` must match, e.g. if the module uses `react-native@0.62`, install `npm i react-native-windows@^0.62 --dev`.
|
|
24
27
|
|
|
25
|
-
Now, you will be able to open corresponding `RNScreens...sln` file, e.g. `RNScreens62.sln` for `react-native-windows@0.62`.
|
|
28
|
+
Now, you will be able to open corresponding `RNScreens...sln` file, e.g. `RNScreens62.sln` for `react-native-windows@0.62`.
|