react-native-screens 4.0.0-beta.0 → 4.0.0-beta.10
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 +1 -1
- package/android/build.gradle +26 -6
- package/android/src/fabric/java/com/swmansion/rnscreens/FabricEnabledHeaderConfigViewGroup.kt +61 -0
- package/android/src/fabric/java/com/swmansion/rnscreens/FabricEnabledViewGroup.kt +4 -3
- package/android/src/main/java/com/swmansion/rnscreens/CustomToolbar.kt +54 -1
- package/android/src/main/java/com/swmansion/rnscreens/InsetsObserverProxy.kt +2 -4
- package/android/src/main/java/com/swmansion/rnscreens/Screen.kt +59 -36
- package/android/src/main/java/com/swmansion/rnscreens/ScreenStack.kt +26 -5
- package/android/src/main/java/com/swmansion/rnscreens/ScreenStackFragment.kt +37 -17
- package/android/src/main/java/com/swmansion/rnscreens/ScreenStackHeaderConfig.kt +1 -2
- package/android/src/main/java/com/swmansion/rnscreens/ScreenStackHeaderConfigShadowNode.kt +25 -0
- package/android/src/main/java/com/swmansion/rnscreens/ScreenStackHeaderConfigViewManager.kt +18 -0
- package/android/src/main/java/com/swmansion/rnscreens/ScreenViewManager.kt +8 -2
- package/android/src/main/java/com/swmansion/rnscreens/ScreenWindowTraits.kt +2 -1
- package/android/src/main/java/com/swmansion/rnscreens/events/HeaderHeightChangeEvent.kt +3 -3
- package/android/src/main/java/com/swmansion/rnscreens/ext/ViewExt.kt +17 -0
- package/android/src/main/java/com/swmansion/rnscreens/utils/PaddingBundle.kt +8 -0
- package/android/src/main/jni/rnscreens.h +2 -0
- package/android/src/main/res/base/anim/rns_ios_from_left_background_close.xml +5 -0
- package/android/src/main/res/base/anim/{rns_slide_out_to_left_ios.xml → rns_ios_from_left_background_open.xml} +1 -1
- package/android/src/main/res/base/anim/rns_ios_from_left_foreground_close.xml +6 -0
- package/android/src/main/res/base/anim/rns_ios_from_left_foreground_open.xml +6 -0
- package/android/src/main/res/base/anim/rns_ios_from_right_background_open.xml +5 -0
- package/android/src/paper/java/com/swmansion/rnscreens/FabricEnabledHeaderConfigViewGroup.kt +39 -0
- package/android/src/paper/java/com/swmansion/rnscreens/FabricEnabledViewGroup.kt +1 -1
- package/common/cpp/react/renderer/components/rnscreens/RNSScreenComponentDescriptor.h +5 -99
- package/common/cpp/react/renderer/components/rnscreens/RNSScreenShadowNode.cpp +101 -0
- package/common/cpp/react/renderer/components/rnscreens/RNSScreenShadowNode.h +2 -0
- package/common/cpp/react/renderer/components/rnscreens/RNSScreenStackHeaderConfigComponentDescriptor.h +44 -0
- package/common/cpp/react/renderer/components/rnscreens/RNSScreenStackHeaderConfigShadowNode.cpp +8 -0
- package/common/cpp/react/renderer/components/rnscreens/RNSScreenStackHeaderConfigShadowNode.h +32 -0
- package/common/cpp/react/renderer/components/rnscreens/RNSScreenStackHeaderConfigState.cpp +23 -0
- package/common/cpp/react/renderer/components/rnscreens/RNSScreenStackHeaderConfigState.h +50 -0
- package/common/cpp/react/renderer/components/rnscreens/RNSScreenStackHeaderSubviewComponentDescriptor.h +27 -0
- package/common/cpp/react/renderer/components/rnscreens/RNSScreenStackHeaderSubviewShadowNode.cpp +8 -0
- package/common/cpp/react/renderer/components/rnscreens/RNSScreenStackHeaderSubviewShadowNode.h +32 -0
- package/common/cpp/react/renderer/components/rnscreens/RNSScreenStackHeaderSubviewState.cpp +15 -0
- package/common/cpp/react/renderer/components/rnscreens/RNSScreenStackHeaderSubviewState.h +40 -0
- package/ios/RNSConvert.mm +4 -2
- package/ios/RNSFullWindowOverlay.mm +6 -0
- package/ios/RNSModalScreen.mm +7 -0
- package/ios/RNSScreen.h +9 -0
- package/ios/RNSScreen.mm +46 -8
- package/ios/RNSScreenContainer.mm +6 -0
- package/ios/RNSScreenContentWrapper.mm +6 -0
- package/ios/RNSScreenFooter.mm +6 -0
- package/ios/RNSScreenNavigationContainer.mm +7 -0
- package/ios/RNSScreenStack.mm +86 -8
- package/ios/RNSScreenStackHeaderConfig.h +63 -0
- package/ios/RNSScreenStackHeaderConfig.mm +133 -6
- package/ios/RNSScreenStackHeaderSubview.mm +32 -3
- package/ios/RNSSearchBar.mm +7 -0
- package/ios/utils/UINavigationBar+RNSUtility.h +37 -0
- package/ios/utils/UINavigationBar+RNSUtility.mm +44 -0
- package/ios/utils/UIView+RNSUtility.mm +0 -1
- package/lib/commonjs/TransitionProgressContext.js +1 -0
- package/lib/commonjs/TransitionProgressContext.js.map +1 -1
- package/lib/commonjs/components/Screen.js +111 -5
- package/lib/commonjs/components/Screen.js.map +1 -1
- package/lib/commonjs/components/Screen.web.js +2 -0
- package/lib/commonjs/components/Screen.web.js.map +1 -1
- package/lib/commonjs/components/ScreenContainer.js +1 -0
- package/lib/commonjs/components/ScreenContainer.js.map +1 -1
- package/lib/commonjs/components/ScreenContentWrapper.web.js +11 -0
- package/lib/commonjs/components/ScreenContentWrapper.web.js.map +1 -0
- package/lib/commonjs/components/ScreenFooter.web.js +11 -0
- package/lib/commonjs/components/ScreenFooter.web.js.map +1 -0
- package/lib/commonjs/components/ScreenStack.js +1 -0
- package/lib/commonjs/components/ScreenStack.js.map +1 -1
- package/lib/commonjs/components/ScreenStackHeaderConfig.js +54 -17
- package/lib/commonjs/components/ScreenStackHeaderConfig.js.map +1 -1
- package/lib/commonjs/components/SearchBar.js +1 -0
- package/lib/commonjs/components/SearchBar.js.map +1 -1
- package/lib/commonjs/components/helpers/usePrevious.js +15 -0
- package/lib/commonjs/components/helpers/usePrevious.js.map +1 -0
- package/lib/commonjs/core.js +1 -0
- package/lib/commonjs/core.js.map +1 -1
- package/lib/commonjs/fabric/FullWindowOverlayNativeComponent.js +1 -0
- package/lib/commonjs/fabric/FullWindowOverlayNativeComponent.js.map +1 -1
- package/lib/commonjs/fabric/ModalScreenNativeComponent.js +1 -0
- package/lib/commonjs/fabric/ModalScreenNativeComponent.js.map +1 -1
- package/lib/commonjs/fabric/NativeScreensModule.js +2 -1
- package/lib/commonjs/fabric/NativeScreensModule.js.map +1 -1
- package/lib/commonjs/fabric/ScreenContainerNativeComponent.js +1 -0
- package/lib/commonjs/fabric/ScreenContainerNativeComponent.js.map +1 -1
- package/lib/commonjs/fabric/ScreenNativeComponent.js +1 -0
- package/lib/commonjs/fabric/ScreenNativeComponent.js.map +1 -1
- package/lib/commonjs/fabric/ScreenNavigationContainerNativeComponent.js +1 -0
- package/lib/commonjs/fabric/ScreenNavigationContainerNativeComponent.js.map +1 -1
- package/lib/commonjs/fabric/ScreenStackHeaderConfigNativeComponent.js +4 -1
- package/lib/commonjs/fabric/ScreenStackHeaderConfigNativeComponent.js.map +1 -1
- package/lib/commonjs/fabric/ScreenStackHeaderSubviewNativeComponent.js +4 -1
- package/lib/commonjs/fabric/ScreenStackHeaderSubviewNativeComponent.js.map +1 -1
- package/lib/commonjs/fabric/ScreenStackNativeComponent.js +1 -0
- package/lib/commonjs/fabric/ScreenStackNativeComponent.js.map +1 -1
- package/lib/commonjs/fabric/SearchBarNativeComponent.js +2 -2
- package/lib/commonjs/fabric/SearchBarNativeComponent.js.map +1 -1
- package/lib/commonjs/native-stack/contexts/GHContext.js +1 -0
- package/lib/commonjs/native-stack/contexts/GHContext.js.map +1 -1
- package/lib/commonjs/native-stack/views/NativeStackView.js +7 -13
- package/lib/commonjs/native-stack/views/NativeStackView.js.map +1 -1
- package/lib/module/TransitionProgressContext.js +2 -0
- package/lib/module/TransitionProgressContext.js.map +1 -1
- package/lib/module/components/Screen.js +112 -5
- package/lib/module/components/Screen.js.map +1 -1
- package/lib/module/components/Screen.web.js +3 -0
- package/lib/module/components/Screen.web.js.map +1 -1
- package/lib/module/components/ScreenContainer.js +2 -0
- package/lib/module/components/ScreenContainer.js.map +1 -1
- package/lib/module/components/ScreenContentWrapper.web.js +5 -0
- package/lib/module/components/ScreenContentWrapper.web.js.map +1 -0
- package/lib/module/components/ScreenFooter.web.js +5 -0
- package/lib/module/components/ScreenFooter.web.js.map +1 -0
- package/lib/module/components/ScreenStack.js +2 -0
- package/lib/module/components/ScreenStack.js.map +1 -1
- package/lib/module/components/ScreenStackHeaderConfig.js +52 -16
- package/lib/module/components/ScreenStackHeaderConfig.js.map +1 -1
- package/lib/module/components/SearchBar.js +2 -0
- package/lib/module/components/SearchBar.js.map +1 -1
- package/lib/module/components/helpers/usePrevious.js +9 -0
- package/lib/module/components/helpers/usePrevious.js.map +1 -0
- package/lib/module/core.js +2 -0
- package/lib/module/core.js.map +1 -1
- package/lib/module/fabric/FullWindowOverlayNativeComponent.js +2 -0
- package/lib/module/fabric/FullWindowOverlayNativeComponent.js.map +1 -1
- package/lib/module/fabric/ModalScreenNativeComponent.js +2 -0
- package/lib/module/fabric/ModalScreenNativeComponent.js.map +1 -1
- package/lib/module/fabric/NativeScreensModule.js +2 -1
- package/lib/module/fabric/NativeScreensModule.js.map +1 -1
- package/lib/module/fabric/ScreenContainerNativeComponent.js +2 -0
- package/lib/module/fabric/ScreenContainerNativeComponent.js.map +1 -1
- package/lib/module/fabric/ScreenNativeComponent.js +2 -0
- package/lib/module/fabric/ScreenNativeComponent.js.map +1 -1
- package/lib/module/fabric/ScreenNavigationContainerNativeComponent.js +2 -0
- package/lib/module/fabric/ScreenNavigationContainerNativeComponent.js.map +1 -1
- package/lib/module/fabric/ScreenStackHeaderConfigNativeComponent.js +5 -1
- package/lib/module/fabric/ScreenStackHeaderConfigNativeComponent.js.map +1 -1
- package/lib/module/fabric/ScreenStackHeaderSubviewNativeComponent.js +5 -1
- package/lib/module/fabric/ScreenStackHeaderSubviewNativeComponent.js.map +1 -1
- package/lib/module/fabric/ScreenStackNativeComponent.js +2 -0
- package/lib/module/fabric/ScreenStackNativeComponent.js.map +1 -1
- package/lib/module/fabric/SearchBarNativeComponent.js +2 -0
- package/lib/module/fabric/SearchBarNativeComponent.js.map +1 -1
- package/lib/module/index.js +6 -6
- package/lib/module/native-stack/contexts/GHContext.js +2 -0
- package/lib/module/native-stack/contexts/GHContext.js.map +1 -1
- package/lib/module/native-stack/views/NativeStackView.js +7 -13
- package/lib/module/native-stack/views/NativeStackView.js.map +1 -1
- package/lib/typescript/TransitionProgressContext.d.ts.map +1 -1
- package/lib/typescript/components/Screen.d.ts +5 -1
- package/lib/typescript/components/Screen.d.ts.map +1 -1
- package/lib/typescript/components/Screen.web.d.ts.map +1 -1
- package/lib/typescript/components/ScreenContainer.d.ts.map +1 -1
- package/lib/typescript/components/ScreenContentWrapper.web.d.ts +5 -0
- package/lib/typescript/components/ScreenContentWrapper.web.d.ts.map +1 -0
- package/lib/typescript/components/ScreenFooter.web.d.ts +5 -0
- package/lib/typescript/components/ScreenFooter.web.d.ts.map +1 -0
- package/lib/typescript/components/ScreenStack.d.ts.map +1 -1
- package/lib/typescript/components/ScreenStackHeaderConfig.d.ts +1 -1
- package/lib/typescript/components/ScreenStackHeaderConfig.d.ts.map +1 -1
- package/lib/typescript/components/SearchBar.d.ts.map +1 -1
- package/lib/typescript/components/helpers/usePrevious.d.ts +2 -0
- package/lib/typescript/components/helpers/usePrevious.d.ts.map +1 -0
- package/lib/typescript/core.d.ts.map +1 -1
- package/lib/typescript/fabric/FullWindowOverlayNativeComponent.d.ts.map +1 -1
- package/lib/typescript/fabric/ModalScreenNativeComponent.d.ts +1 -0
- package/lib/typescript/fabric/ModalScreenNativeComponent.d.ts.map +1 -1
- package/lib/typescript/fabric/NativeScreensModule.d.ts.map +1 -1
- package/lib/typescript/fabric/ScreenContainerNativeComponent.d.ts.map +1 -1
- package/lib/typescript/fabric/ScreenNativeComponent.d.ts +1 -1
- package/lib/typescript/fabric/ScreenNativeComponent.d.ts.map +1 -1
- package/lib/typescript/fabric/ScreenNavigationContainerNativeComponent.d.ts.map +1 -1
- package/lib/typescript/fabric/ScreenStackHeaderConfigNativeComponent.d.ts.map +1 -1
- package/lib/typescript/fabric/ScreenStackHeaderSubviewNativeComponent.d.ts.map +1 -1
- package/lib/typescript/fabric/ScreenStackNativeComponent.d.ts.map +1 -1
- package/lib/typescript/fabric/SearchBarNativeComponent.d.ts.map +1 -1
- package/lib/typescript/index.d.ts +18 -0
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/native-stack/contexts/GHContext.d.ts.map +1 -1
- package/lib/typescript/native-stack/types.d.ts +14 -5
- package/lib/typescript/native-stack/types.d.ts.map +1 -1
- package/lib/typescript/native-stack/views/NativeStackView.d.ts.map +1 -1
- package/lib/typescript/types.d.ts +56 -11
- package/lib/typescript/types.d.ts.map +1 -1
- package/native-stack/README.md +30 -5
- package/package.json +1 -1
- package/src/TransitionProgressContext.tsx +2 -0
- package/src/components/Screen.tsx +161 -8
- package/src/components/Screen.web.tsx +3 -0
- package/src/components/ScreenContainer.tsx +2 -0
- package/src/components/ScreenContentWrapper.web.tsx +6 -0
- package/src/components/ScreenFooter.web.tsx +6 -0
- package/src/components/ScreenStack.tsx +2 -0
- package/src/components/ScreenStackHeaderConfig.tsx +61 -26
- package/src/components/SearchBar.tsx +2 -0
- package/src/components/helpers/usePrevious.tsx +11 -0
- package/src/core.ts +2 -0
- package/src/fabric/FullWindowOverlayNativeComponent.ts +2 -0
- package/src/fabric/ModalScreenNativeComponent.ts +3 -0
- package/src/fabric/NativeScreensModule.ts +2 -0
- package/src/fabric/ScreenContainerNativeComponent.ts +2 -0
- package/src/fabric/ScreenNativeComponent.ts +4 -1
- package/src/fabric/ScreenNavigationContainerNativeComponent.ts +2 -0
- package/src/fabric/ScreenStackHeaderConfigNativeComponent.ts +5 -1
- package/src/fabric/ScreenStackHeaderSubviewNativeComponent.ts +5 -1
- package/src/fabric/ScreenStackNativeComponent.ts +2 -0
- package/src/fabric/SearchBarNativeComponent.ts +2 -0
- package/src/index.tsx +6 -6
- package/src/native-stack/contexts/GHContext.tsx +2 -0
- package/src/native-stack/types.tsx +14 -5
- package/src/native-stack/views/NativeStackView.tsx +11 -16
- package/src/types.tsx +63 -11
- package/windows/RNScreens/Screen.h +2 -1
- /package/android/src/main/res/base/anim/{rns_slide_in_from_left_ios.xml → rns_ios_from_right_background_close.xml} +0 -0
- /package/android/src/main/res/base/anim/{rns_slide_out_to_right_ios.xml → rns_ios_from_right_foreground_close.xml} +0 -0
- /package/android/src/main/res/base/anim/{rns_slide_in_from_right_ios.xml → rns_ios_from_right_foreground_open.xml} +0 -0
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
1
3
|
import React from 'react';
|
|
2
4
|
import {
|
|
3
5
|
HeaderSubviewTypes,
|
|
@@ -10,12 +12,22 @@ import { Image, ImageProps, StyleSheet, ViewProps } from 'react-native';
|
|
|
10
12
|
import ScreenStackHeaderConfigNativeComponent from '../fabric/ScreenStackHeaderConfigNativeComponent';
|
|
11
13
|
import ScreenStackHeaderSubviewNativeComponent from '../fabric/ScreenStackHeaderSubviewNativeComponent';
|
|
12
14
|
|
|
13
|
-
export const ScreenStackHeaderConfig: React.ComponentType<ScreenStackHeaderConfigProps> =
|
|
14
|
-
ScreenStackHeaderConfigNativeComponent as any;
|
|
15
15
|
export const ScreenStackHeaderSubview: React.ComponentType<
|
|
16
16
|
React.PropsWithChildren<ViewProps & { type?: HeaderSubviewTypes }>
|
|
17
17
|
> = ScreenStackHeaderSubviewNativeComponent as any;
|
|
18
18
|
|
|
19
|
+
export function ScreenStackHeaderConfig(
|
|
20
|
+
props: ScreenStackHeaderConfigProps,
|
|
21
|
+
): React.JSX.Element {
|
|
22
|
+
return (
|
|
23
|
+
<ScreenStackHeaderConfigNativeComponent
|
|
24
|
+
{...props}
|
|
25
|
+
style={styles.headerConfig}
|
|
26
|
+
pointerEvents="box-none"
|
|
27
|
+
/>
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
|
|
19
31
|
export const ScreenStackHeaderBackButtonImage = (
|
|
20
32
|
props: ImageProps,
|
|
21
33
|
): JSX.Element => (
|
|
@@ -26,33 +38,45 @@ export const ScreenStackHeaderBackButtonImage = (
|
|
|
26
38
|
|
|
27
39
|
export const ScreenStackHeaderRightView = (
|
|
28
40
|
props: React.PropsWithChildren<ViewProps>,
|
|
29
|
-
): JSX.Element =>
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
41
|
+
): JSX.Element => {
|
|
42
|
+
const { style, ...rest } = props;
|
|
43
|
+
|
|
44
|
+
return (
|
|
45
|
+
<ScreenStackHeaderSubview
|
|
46
|
+
{...rest}
|
|
47
|
+
type="right"
|
|
48
|
+
style={[styles.headerSubview, style]}
|
|
49
|
+
/>
|
|
50
|
+
);
|
|
51
|
+
};
|
|
36
52
|
|
|
37
53
|
export const ScreenStackHeaderLeftView = (
|
|
38
54
|
props: React.PropsWithChildren<ViewProps>,
|
|
39
|
-
): JSX.Element =>
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
55
|
+
): JSX.Element => {
|
|
56
|
+
const { style, ...rest } = props;
|
|
57
|
+
|
|
58
|
+
return (
|
|
59
|
+
<ScreenStackHeaderSubview
|
|
60
|
+
{...rest}
|
|
61
|
+
type="left"
|
|
62
|
+
style={[styles.headerSubview, style]}
|
|
63
|
+
/>
|
|
64
|
+
);
|
|
65
|
+
};
|
|
46
66
|
|
|
47
67
|
export const ScreenStackHeaderCenterView = (
|
|
48
68
|
props: React.PropsWithChildren<ViewProps>,
|
|
49
|
-
): JSX.Element =>
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
69
|
+
): JSX.Element => {
|
|
70
|
+
const { style, ...rest } = props;
|
|
71
|
+
|
|
72
|
+
return (
|
|
73
|
+
<ScreenStackHeaderSubview
|
|
74
|
+
{...rest}
|
|
75
|
+
type="center"
|
|
76
|
+
style={[styles.headerSubviewCenter, style]}
|
|
77
|
+
/>
|
|
78
|
+
);
|
|
79
|
+
};
|
|
56
80
|
|
|
57
81
|
export const ScreenStackHeaderSearchBarView = (
|
|
58
82
|
props: React.PropsWithChildren<SearchBarProps>,
|
|
@@ -66,11 +90,22 @@ export const ScreenStackHeaderSearchBarView = (
|
|
|
66
90
|
|
|
67
91
|
const styles = StyleSheet.create({
|
|
68
92
|
headerSubview: {
|
|
69
|
-
position: 'absolute',
|
|
70
|
-
top: 0,
|
|
71
|
-
right: 0,
|
|
72
93
|
flexDirection: 'row',
|
|
73
94
|
alignItems: 'center',
|
|
74
95
|
justifyContent: 'center',
|
|
75
96
|
},
|
|
97
|
+
headerSubviewCenter: {
|
|
98
|
+
flexDirection: 'row',
|
|
99
|
+
alignItems: 'center',
|
|
100
|
+
justifyContent: 'center',
|
|
101
|
+
flexShrink: 1,
|
|
102
|
+
},
|
|
103
|
+
headerConfig: {
|
|
104
|
+
position: 'absolute',
|
|
105
|
+
top: '-100%',
|
|
106
|
+
width: '100%',
|
|
107
|
+
flexDirection: 'row',
|
|
108
|
+
justifyContent: 'space-between',
|
|
109
|
+
alignItems: 'center',
|
|
110
|
+
},
|
|
76
111
|
});
|
package/src/core.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
1
3
|
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
|
|
2
4
|
import type { ViewProps, ColorValue } from 'react-native';
|
|
3
5
|
import type {
|
|
@@ -73,6 +75,7 @@ export interface NativeProps extends ViewProps {
|
|
|
73
75
|
sheetGrabberVisible?: WithDefault<boolean, false>;
|
|
74
76
|
sheetCornerRadius?: WithDefault<Float, -1.0>;
|
|
75
77
|
sheetExpandsWhenScrolledToEdge?: WithDefault<boolean, false>;
|
|
78
|
+
sheetInitialDetent?: WithDefault<Int32, 0>;
|
|
76
79
|
customAnimationOnSwipe?: boolean;
|
|
77
80
|
fullScreenSwipeEnabled?: boolean;
|
|
78
81
|
fullScreenSwipeShadowEnabled?: boolean;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
1
3
|
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
|
|
2
4
|
import type { ViewProps, ColorValue } from 'react-native';
|
|
3
5
|
import type {
|
|
@@ -56,7 +58,8 @@ type StackAnimation =
|
|
|
56
58
|
| 'slide_from_left'
|
|
57
59
|
| 'slide_from_bottom'
|
|
58
60
|
| 'fade_from_bottom'
|
|
59
|
-
| '
|
|
61
|
+
| 'ios_from_right'
|
|
62
|
+
| 'ios_from_left';
|
|
60
63
|
|
|
61
64
|
type SwipeDirection = 'vertical' | 'horizontal';
|
|
62
65
|
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
1
3
|
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
|
|
2
4
|
import type { ViewProps, ColorValue } from 'react-native';
|
|
3
5
|
import type {
|
|
@@ -73,5 +75,7 @@ export interface NativeProps extends ViewProps {
|
|
|
73
75
|
|
|
74
76
|
export default codegenNativeComponent<NativeProps>(
|
|
75
77
|
'RNSScreenStackHeaderConfig',
|
|
76
|
-
{
|
|
78
|
+
{
|
|
79
|
+
interfaceOnly: true,
|
|
80
|
+
},
|
|
77
81
|
);
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
1
3
|
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
|
|
2
4
|
import type { ViewProps } from 'react-native';
|
|
3
5
|
import type { WithDefault } from 'react-native/Libraries/Types/CodegenTypes';
|
|
@@ -16,5 +18,7 @@ export interface NativeProps extends ViewProps {
|
|
|
16
18
|
|
|
17
19
|
export default codegenNativeComponent<NativeProps>(
|
|
18
20
|
'RNSScreenStackHeaderSubview',
|
|
19
|
-
{
|
|
21
|
+
{
|
|
22
|
+
interfaceOnly: true,
|
|
23
|
+
},
|
|
20
24
|
);
|
package/src/index.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export * from './types';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
4
|
* Core
|
|
5
5
|
*/
|
|
6
6
|
export {
|
|
@@ -11,7 +11,7 @@ export {
|
|
|
11
11
|
shouldUseActivityState,
|
|
12
12
|
} from './core';
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
/**
|
|
15
15
|
* RNS Components
|
|
16
16
|
*/
|
|
17
17
|
export {
|
|
@@ -57,17 +57,17 @@ export {
|
|
|
57
57
|
NativeScreenContentWrapper,
|
|
58
58
|
} from './components/ScreenContentWrapper';
|
|
59
59
|
|
|
60
|
-
|
|
60
|
+
/**
|
|
61
61
|
* Modules
|
|
62
62
|
*/
|
|
63
63
|
export { default as NativeScreensModule } from './fabric/NativeScreensModule';
|
|
64
64
|
|
|
65
|
-
|
|
65
|
+
/**
|
|
66
66
|
* Contexts
|
|
67
67
|
*/
|
|
68
68
|
export { GHContext } from './native-stack/contexts/GHContext';
|
|
69
69
|
|
|
70
|
-
|
|
70
|
+
/**
|
|
71
71
|
* Utils
|
|
72
72
|
*/
|
|
73
73
|
export {
|
|
@@ -76,7 +76,7 @@ export {
|
|
|
76
76
|
executeNativeBackPress,
|
|
77
77
|
} from './utils';
|
|
78
78
|
|
|
79
|
-
|
|
79
|
+
/**
|
|
80
80
|
* Hooks
|
|
81
81
|
*/
|
|
82
82
|
export { default as useTransitionProgress } from './useTransitionProgress';
|
|
@@ -418,7 +418,7 @@ export type NativeStackNavigationOptions = {
|
|
|
418
418
|
*
|
|
419
419
|
* Defaults to `0` - which represents first detent in the detents array.
|
|
420
420
|
*/
|
|
421
|
-
|
|
421
|
+
sheetInitialDetentIndex?: ScreenProps['sheetInitialDetentIndex'];
|
|
422
422
|
/**
|
|
423
423
|
* The largest sheet detent for which a view underneath won't be dimmed.
|
|
424
424
|
* Works only when `stackPresentation` is set to `formSheet`.
|
|
@@ -426,9 +426,17 @@ export type NativeStackNavigationOptions = {
|
|
|
426
426
|
* This prop can be set to an number, which indicates index of detent in `sheetAllowedDetents` array for which
|
|
427
427
|
* there won't be a dimming view beneath the sheet.
|
|
428
428
|
*
|
|
429
|
-
*
|
|
429
|
+
* Additionaly there are following options available:
|
|
430
|
+
*
|
|
431
|
+
* * `none` - there will be dimming view for all detents levels,
|
|
432
|
+
* * `largest` - there won't be a dimming view for any detent level.
|
|
433
|
+
*
|
|
434
|
+
* There also legacy & **deprecated** prop values available: `medium`, `large` (don't confuse with `largest`), `all`, which work in tandem with
|
|
435
|
+
* corresponding legacy prop values for `sheetAllowedDetents` prop.
|
|
436
|
+
*
|
|
437
|
+
* Defaults to `none`, indicating that the dimming view should be always present.
|
|
430
438
|
*/
|
|
431
|
-
|
|
439
|
+
sheetLargestUndimmedDetentIndex?: ScreenProps['sheetLargestUndimmedDetentIndex'];
|
|
432
440
|
/**
|
|
433
441
|
* How the screen should appear/disappear when pushed or popped at the top of the stack.
|
|
434
442
|
* The following values are currently supported:
|
|
@@ -440,7 +448,8 @@ export type NativeStackNavigationOptions = {
|
|
|
440
448
|
* - "slide_from_bottom" – performs a slide from bottom animation
|
|
441
449
|
* - "slide_from_right" - slide in the new screen from right to left (Android only, resolves to default transition on iOS)
|
|
442
450
|
* - "slide_from_left" - slide in the new screen from left to right
|
|
443
|
-
* - "
|
|
451
|
+
* - "ios_from_right" - iOS like slide in animation. pushes in the new screen from right to left (Android only, resolves to default transition on iOS)
|
|
452
|
+
* - "ios_from_left" - iOS like slide in animation. pushes in the new screen from left to right (Android only, resolves to default transition on iOS)
|
|
444
453
|
* - "none" – the screen appears/dissapears without an animation
|
|
445
454
|
*/
|
|
446
455
|
stackAnimation?: ScreenProps['stackAnimation'];
|
|
@@ -515,7 +524,7 @@ export type NativeStackNavigationOptions = {
|
|
|
515
524
|
*
|
|
516
525
|
* @platform android
|
|
517
526
|
*/
|
|
518
|
-
|
|
527
|
+
unstable_sheetFooter?: () => React.ReactNode;
|
|
519
528
|
};
|
|
520
529
|
|
|
521
530
|
export type NativeStackNavigatorProps =
|
|
@@ -195,12 +195,12 @@ const RouteView = ({
|
|
|
195
195
|
headerShown,
|
|
196
196
|
hideKeyboardOnSwipe,
|
|
197
197
|
homeIndicatorHidden,
|
|
198
|
-
|
|
198
|
+
sheetLargestUndimmedDetentIndex = 'none',
|
|
199
199
|
sheetGrabberVisible = false,
|
|
200
200
|
sheetCornerRadius = -1.0,
|
|
201
201
|
sheetElevation = 24,
|
|
202
202
|
sheetExpandsWhenScrolledToEdge = true,
|
|
203
|
-
|
|
203
|
+
sheetInitialDetentIndex = 0,
|
|
204
204
|
nativeBackButtonDismissalEnabled = false,
|
|
205
205
|
navigationBarColor,
|
|
206
206
|
navigationBarTranslucent,
|
|
@@ -215,7 +215,7 @@ const RouteView = ({
|
|
|
215
215
|
swipeDirection = 'horizontal',
|
|
216
216
|
transitionDuration,
|
|
217
217
|
freezeOnBlur,
|
|
218
|
-
|
|
218
|
+
unstable_sheetFooter = null,
|
|
219
219
|
} = options;
|
|
220
220
|
|
|
221
221
|
let {
|
|
@@ -229,9 +229,10 @@ const RouteView = ({
|
|
|
229
229
|
} = options;
|
|
230
230
|
|
|
231
231
|
// We only want to allow backgroundColor for now
|
|
232
|
-
unstable_screenStyle =
|
|
233
|
-
|
|
234
|
-
|
|
232
|
+
unstable_screenStyle =
|
|
233
|
+
stackPresentation === 'formSheet' && unstable_screenStyle
|
|
234
|
+
? { backgroundColor: unstable_screenStyle.backgroundColor }
|
|
235
|
+
: null;
|
|
235
236
|
|
|
236
237
|
if (sheetAllowedDetents === 'fitToContents') {
|
|
237
238
|
sheetAllowedDetents = [-1];
|
|
@@ -317,9 +318,9 @@ const RouteView = ({
|
|
|
317
318
|
hasLargeHeader={hasLargeHeader}
|
|
318
319
|
style={[StyleSheet.absoluteFill, unstable_screenStyle]}
|
|
319
320
|
sheetAllowedDetents={sheetAllowedDetents}
|
|
320
|
-
|
|
321
|
+
sheetLargestUndimmedDetentIndex={sheetLargestUndimmedDetentIndex}
|
|
321
322
|
sheetGrabberVisible={sheetGrabberVisible}
|
|
322
|
-
|
|
323
|
+
sheetInitialDetentIndex={sheetInitialDetentIndex}
|
|
323
324
|
sheetCornerRadius={sheetCornerRadius}
|
|
324
325
|
sheetElevation={sheetElevation}
|
|
325
326
|
sheetExpandsWhenScrolledToEdge={sheetExpandsWhenScrolledToEdge}
|
|
@@ -354,7 +355,6 @@ const RouteView = ({
|
|
|
354
355
|
});
|
|
355
356
|
}}
|
|
356
357
|
onWillAppear={() => {
|
|
357
|
-
console.log(`onWillAppear/transitionStart route: ${route.key}`);
|
|
358
358
|
navigation.emit({
|
|
359
359
|
type: 'transitionStart',
|
|
360
360
|
data: { closing: false },
|
|
@@ -362,7 +362,6 @@ const RouteView = ({
|
|
|
362
362
|
});
|
|
363
363
|
}}
|
|
364
364
|
onWillDisappear={() => {
|
|
365
|
-
console.log(`onWillDisappear/transitionStart route: ${route.key}`);
|
|
366
365
|
navigation.emit({
|
|
367
366
|
type: 'transitionStart',
|
|
368
367
|
data: { closing: true },
|
|
@@ -370,12 +369,10 @@ const RouteView = ({
|
|
|
370
369
|
});
|
|
371
370
|
}}
|
|
372
371
|
onAppear={() => {
|
|
373
|
-
console.log(`onAppear/appear route: ${route.key}`);
|
|
374
372
|
navigation.emit({
|
|
375
373
|
type: 'appear',
|
|
376
374
|
target: route.key,
|
|
377
375
|
});
|
|
378
|
-
console.log(`onAppear/transitionEnd route: ${route.key}`);
|
|
379
376
|
navigation.emit({
|
|
380
377
|
type: 'transitionEnd',
|
|
381
378
|
data: { closing: false },
|
|
@@ -383,7 +380,6 @@ const RouteView = ({
|
|
|
383
380
|
});
|
|
384
381
|
}}
|
|
385
382
|
onDisappear={() => {
|
|
386
|
-
console.log(`onDisappear/transitionEnd route: ${route.key}`);
|
|
387
383
|
navigation.emit({
|
|
388
384
|
type: 'transitionEnd',
|
|
389
385
|
data: { closing: true },
|
|
@@ -403,7 +399,6 @@ const RouteView = ({
|
|
|
403
399
|
}
|
|
404
400
|
}}
|
|
405
401
|
onDismissed={e => {
|
|
406
|
-
console.log(`onDismissed/dismiss route: ${route.key}`);
|
|
407
402
|
navigation.emit({
|
|
408
403
|
type: 'dismiss',
|
|
409
404
|
target: route.key,
|
|
@@ -450,8 +445,8 @@ const RouteView = ({
|
|
|
450
445
|
route={route}
|
|
451
446
|
headerShown={isHeaderInPush}
|
|
452
447
|
/>
|
|
453
|
-
{
|
|
454
|
-
<FooterComponent>{
|
|
448
|
+
{stackPresentation === 'formSheet' && unstable_sheetFooter && (
|
|
449
|
+
<FooterComponent>{unstable_sheetFooter()}</FooterComponent>
|
|
455
450
|
)}
|
|
456
451
|
</HeaderHeightContext.Provider>
|
|
457
452
|
</AnimatedHeaderHeightContext.Provider>
|
package/src/types.tsx
CHANGED
|
@@ -39,7 +39,8 @@ export type StackAnimationTypes =
|
|
|
39
39
|
| 'slide_from_bottom'
|
|
40
40
|
| 'slide_from_right'
|
|
41
41
|
| 'slide_from_left'
|
|
42
|
-
| '
|
|
42
|
+
| 'ios_from_right'
|
|
43
|
+
| 'ios_from_left';
|
|
43
44
|
export type BlurEffectTypes =
|
|
44
45
|
| 'extraLight'
|
|
45
46
|
| 'light'
|
|
@@ -102,7 +103,6 @@ export interface ScreenProps extends ViewProps {
|
|
|
102
103
|
active?: 0 | 1 | Animated.AnimatedInterpolation<number>;
|
|
103
104
|
activityState?: 0 | 1 | 2 | Animated.AnimatedInterpolation<number>;
|
|
104
105
|
children?: React.ReactNode;
|
|
105
|
-
unstable_footer?: React.ReactNode;
|
|
106
106
|
/**
|
|
107
107
|
* Boolean indicating that swipe dismissal should trigger animation provided by `stackAnimation`. Defaults to `false`.
|
|
108
108
|
*
|
|
@@ -289,17 +289,31 @@ export interface ScreenProps extends ViewProps {
|
|
|
289
289
|
unstable_screenStyle?: Pick<ViewStyle, 'backgroundColor'>;
|
|
290
290
|
/**
|
|
291
291
|
* Describes heights where a sheet can rest.
|
|
292
|
-
* Works only when `
|
|
292
|
+
* Works only when `presentation` is set to `formSheet`.
|
|
293
293
|
*
|
|
294
294
|
* Heights should be described as fraction (a number from `[0, 1]` interval) of screen height / maximum detent height.
|
|
295
|
-
*
|
|
295
|
+
* You can pass an array of ascending values each defining allowed sheet detent. iOS accepts any number of detents,
|
|
296
|
+
* while **Android is limited to three**.
|
|
297
|
+
*
|
|
298
|
+
* There is also possibility to specify `fitToContents` literal, which intents to set the sheet height
|
|
296
299
|
* to the height of its contents.
|
|
297
300
|
*
|
|
298
|
-
* Please note that the array **must** be sorted in ascending order.
|
|
301
|
+
* Please note that the array **must** be sorted in ascending order. This invariant is verified only in developement mode,
|
|
302
|
+
* where violation results in error.
|
|
303
|
+
*
|
|
304
|
+
* **Android is limited to up 3 values in the array** -- any surplus values, beside first three are ignored.
|
|
305
|
+
*
|
|
306
|
+
* There are also legacy & **deprecated** options available:
|
|
307
|
+
*
|
|
308
|
+
* * 'medium' - corresponds to `[0.5]` detent value, around half of the screen height,
|
|
309
|
+
* * 'large' - corresponds to `[1.0]` detent value, maximum height,
|
|
310
|
+
* * 'all' - corresponds to `[0.5, 1.0]` value, the name is deceiving due to compatibility reasons.
|
|
299
311
|
*
|
|
300
|
-
*
|
|
312
|
+
* These are provided solely for **temporary** backward compatibility and are destined for removal in future versions.
|
|
313
|
+
*
|
|
314
|
+
* Defaults to `[1.0]`.
|
|
301
315
|
*/
|
|
302
|
-
sheetAllowedDetents?: number[];
|
|
316
|
+
sheetAllowedDetents?: number[] | 'fitToContents' | 'medium' | 'large' | 'all';
|
|
303
317
|
/**
|
|
304
318
|
* Integer value describing elevation of the sheet, impacting shadow on the top edge of the sheet.
|
|
305
319
|
*
|
|
@@ -344,16 +358,40 @@ export interface ScreenProps extends ViewProps {
|
|
|
344
358
|
* This prop can be set to an number, which indicates index of detent in `sheetAllowedDetents` array for which
|
|
345
359
|
* there won't be a dimming view beneath the sheet.
|
|
346
360
|
*
|
|
347
|
-
*
|
|
361
|
+
* If the specified index is out of bounds of `sheetAllowedDetents` array, in dev environment mode error will be thrown,
|
|
362
|
+
* in production the value will be reset to default value.
|
|
363
|
+
*
|
|
364
|
+
* Additionaly there are following options available:
|
|
365
|
+
*
|
|
366
|
+
* * `none` - there will be dimming view for all detents levels,
|
|
367
|
+
* * `last` - there won't be a dimming view for any detent level.
|
|
368
|
+
*
|
|
369
|
+
* There also legacy & **deprecated** prop values available: `medium`, `large` (don't confuse with `largest`), `all`, which work in tandem with
|
|
370
|
+
* corresponding legacy prop values for `sheetAllowedDetents` prop.
|
|
371
|
+
*
|
|
372
|
+
* These are provided solely for **temporary** backward compatibility and are destined for removal in future versions.
|
|
373
|
+
*
|
|
374
|
+
* Defaults to `none`, indicating that the dimming view should be always present.
|
|
348
375
|
*/
|
|
349
|
-
|
|
376
|
+
sheetLargestUndimmedDetentIndex?:
|
|
377
|
+
| number
|
|
378
|
+
| 'none'
|
|
379
|
+
| 'last'
|
|
380
|
+
| 'medium' // deprecated
|
|
381
|
+
| 'large' // deprecated
|
|
382
|
+
| 'all'; // deprecated
|
|
350
383
|
/**
|
|
351
384
|
* Index of the detent the sheet should expand to after being opened.
|
|
352
385
|
* Works only when `stackPresentation` is set to `formSheet`.
|
|
353
386
|
*
|
|
387
|
+
* If the specified index is out of bounds of `sheetAllowedDetents` array, in dev environment more error will be thrown,
|
|
388
|
+
* in production the value will be reset to default value.
|
|
389
|
+
*
|
|
390
|
+
* Additionaly there is `last` value available, when set the sheet will expand initially to last (largest) detent.
|
|
391
|
+
*
|
|
354
392
|
* Defaults to `0` - which represents first detent in the detents array.
|
|
355
393
|
*/
|
|
356
|
-
|
|
394
|
+
sheetInitialDetentIndex?: number | 'last';
|
|
357
395
|
/**
|
|
358
396
|
* How the screen should appear/disappear when pushed or popped at the top of the stack.
|
|
359
397
|
* The following values are currently supported:
|
|
@@ -365,7 +403,8 @@ export interface ScreenProps extends ViewProps {
|
|
|
365
403
|
* - `slide_from_bottom` – performs a slide from bottom animation
|
|
366
404
|
* - "slide_from_right" - slide in the new screen from right to left (Android only, resolves to default transition on iOS)
|
|
367
405
|
* - "slide_from_left" - slide in the new screen from left to right
|
|
368
|
-
* - "
|
|
406
|
+
* - "ios_from_right" - iOS like slide in animation. pushes in the new screen from right to left (Android only, resolves to default transition on iOS)
|
|
407
|
+
* - "ios_from_left" - iOS like slide in animation. pushes in the new screen from left to right (Android only, resolves to default transition on iOS)
|
|
369
408
|
* - "none" – the screen appears/dissapears without an animation
|
|
370
409
|
*/
|
|
371
410
|
stackAnimation?: StackAnimationTypes;
|
|
@@ -422,6 +461,19 @@ export interface ScreenProps extends ViewProps {
|
|
|
422
461
|
* @platform ios
|
|
423
462
|
*/
|
|
424
463
|
transitionDuration?: number;
|
|
464
|
+
/**
|
|
465
|
+
* Footer component that can be used alongside formSheet stack presentation style.
|
|
466
|
+
*
|
|
467
|
+
* This option is provided, because due to implementation details it might be problematic
|
|
468
|
+
* to implement such layout with JS-only code.
|
|
469
|
+
*
|
|
470
|
+
* Please note that this prop is marked as unstable and might be subject of breaking changes,
|
|
471
|
+
* including removal, in particular when we find solution that will make implementing it with JS
|
|
472
|
+
* straightforward.
|
|
473
|
+
*
|
|
474
|
+
* @platform android
|
|
475
|
+
*/
|
|
476
|
+
unstable_sheetFooter?: () => React.ReactNode;
|
|
425
477
|
}
|
|
426
478
|
|
|
427
479
|
export interface ScreenContainerProps extends ViewProps {
|
|
File without changes
|
|
File without changes
|
|
File without changes
|