@react-navigation/native-stack 7.0.0-rc.29 → 7.0.0-rc.30

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 (42) hide show
  1. package/lib/commonjs/views/NativeStackView.native.js +3 -12
  2. package/lib/commonjs/views/NativeStackView.native.js.map +1 -1
  3. package/lib/module/views/NativeStackView.native.js +4 -13
  4. package/lib/module/views/NativeStackView.native.js.map +1 -1
  5. package/lib/typescript/commonjs/src/types.d.ts +0 -7
  6. package/lib/typescript/commonjs/src/types.d.ts.map +1 -1
  7. package/lib/typescript/commonjs/src/views/NativeStackView.native.d.ts.map +1 -1
  8. package/lib/typescript/commonjs/tsconfig.build.tsbuildinfo +1 -1
  9. package/lib/typescript/module/src/types.d.ts +0 -7
  10. package/lib/typescript/module/src/types.d.ts.map +1 -1
  11. package/lib/typescript/module/src/views/NativeStackView.native.d.ts.map +1 -1
  12. package/lib/typescript/module/tsconfig.build.tsbuildinfo +1 -1
  13. package/package.json +4 -4
  14. package/src/types.tsx +0 -7
  15. package/src/views/NativeStackView.native.tsx +8 -14
  16. package/lib/commonjs/views/DebugContainer.js +0 -22
  17. package/lib/commonjs/views/DebugContainer.js.map +0 -1
  18. package/lib/commonjs/views/DebugContainer.native.js +0 -47
  19. package/lib/commonjs/views/DebugContainer.native.js.map +0 -1
  20. package/lib/commonjs/views/ScreenStackContent.js +0 -70
  21. package/lib/commonjs/views/ScreenStackContent.js.map +0 -1
  22. package/lib/module/views/DebugContainer.js +0 -16
  23. package/lib/module/views/DebugContainer.js.map +0 -1
  24. package/lib/module/views/DebugContainer.native.js +0 -38
  25. package/lib/module/views/DebugContainer.native.js.map +0 -1
  26. package/lib/module/views/ScreenStackContent.js +0 -63
  27. package/lib/module/views/ScreenStackContent.js.map +0 -1
  28. package/lib/typescript/commonjs/src/views/DebugContainer.d.ts +0 -10
  29. package/lib/typescript/commonjs/src/views/DebugContainer.d.ts.map +0 -1
  30. package/lib/typescript/commonjs/src/views/DebugContainer.native.d.ts +0 -15
  31. package/lib/typescript/commonjs/src/views/DebugContainer.native.d.ts.map +0 -1
  32. package/lib/typescript/commonjs/src/views/ScreenStackContent.d.ts +0 -9
  33. package/lib/typescript/commonjs/src/views/ScreenStackContent.d.ts.map +0 -1
  34. package/lib/typescript/module/src/views/DebugContainer.d.ts +0 -10
  35. package/lib/typescript/module/src/views/DebugContainer.d.ts.map +0 -1
  36. package/lib/typescript/module/src/views/DebugContainer.native.d.ts +0 -15
  37. package/lib/typescript/module/src/views/DebugContainer.native.d.ts.map +0 -1
  38. package/lib/typescript/module/src/views/ScreenStackContent.d.ts +0 -9
  39. package/lib/typescript/module/src/views/ScreenStackContent.d.ts.map +0 -1
  40. package/src/views/DebugContainer.native.tsx +0 -43
  41. package/src/views/DebugContainer.tsx +0 -14
  42. package/src/views/ScreenStackContent.tsx +0 -121
@@ -1,121 +0,0 @@
1
- import * as React from 'react';
2
- import {
3
- Platform,
4
- type StyleProp,
5
- StyleSheet,
6
- type ViewStyle,
7
- } from 'react-native';
8
- import {
9
- Screen,
10
- type ScreenProps,
11
- ScreenStack,
12
- ScreenStackHeaderConfig,
13
- type ScreenStackHeaderConfigProps,
14
- } from 'react-native-screens';
15
- import warnOnce from 'warn-once';
16
-
17
- import { DebugContainer } from './DebugContainer';
18
-
19
- type Props = Omit<
20
- ScreenProps,
21
- 'enabled' | 'isNativeStack' | 'hasLargeHeader'
22
- > & {
23
- headerConfig?: ScreenStackHeaderConfigProps;
24
- contentStyle?: StyleProp<ViewStyle>;
25
- };
26
-
27
- export function ScreenStackContent({
28
- children,
29
- headerConfig,
30
- activityState,
31
- stackPresentation,
32
- contentStyle,
33
- ...rest
34
- }: Props) {
35
- const isHeaderInModal =
36
- Platform.OS === 'android'
37
- ? false
38
- : stackPresentation !== 'push' && headerConfig?.hidden === false;
39
-
40
- const headerHiddenPreviousRef = React.useRef(headerConfig?.hidden);
41
-
42
- React.useEffect(() => {
43
- warnOnce(
44
- Platform.OS !== 'android' &&
45
- stackPresentation !== 'push' &&
46
- headerHiddenPreviousRef.current !== headerConfig?.hidden,
47
- `Dynamically changing header's visibility in modals will result in remounting the screen and losing all local state.`
48
- );
49
-
50
- headerHiddenPreviousRef.current = headerConfig?.hidden;
51
- }, [headerConfig?.hidden, stackPresentation]);
52
-
53
- const content = (
54
- <>
55
- <DebugContainer
56
- style={[
57
- stackPresentation === 'formSheet'
58
- ? Platform.OS === 'ios'
59
- ? styles.absolute
60
- : null
61
- : styles.container,
62
- contentStyle,
63
- ]}
64
- stackPresentation={stackPresentation ?? 'push'}
65
- >
66
- {children}
67
- </DebugContainer>
68
- {/**
69
- * `HeaderConfig` needs to be the direct child of `Screen` without any intermediate `View`
70
- * We don't render it conditionally based on visibility to make it possible to dynamically render a custom `header`
71
- * Otherwise dynamically rendering a custom `header` leaves the native header visible
72
- *
73
- * https://github.com/software-mansion/react-native-screens/blob/main/guides/GUIDE_FOR_LIBRARY_AUTHORS.md#screenstackheaderconfig
74
- *
75
- * HeaderConfig must not be first child of a Screen.
76
- * See https://github.com/software-mansion/react-native-screens/pull/1825
77
- * for detailed explanation.
78
- */}
79
- <ScreenStackHeaderConfig {...headerConfig} />
80
- </>
81
- );
82
-
83
- return (
84
- <Screen
85
- enabled
86
- isNativeStack
87
- activityState={activityState}
88
- stackPresentation={stackPresentation}
89
- hasLargeHeader={headerConfig?.largeTitle ?? false}
90
- {...rest}
91
- >
92
- {isHeaderInModal ? (
93
- <ScreenStack style={styles.container}>
94
- <Screen
95
- enabled
96
- isNativeStack
97
- activityState={activityState}
98
- hasLargeHeader={headerConfig?.largeTitle ?? false}
99
- style={StyleSheet.absoluteFill}
100
- >
101
- {content}
102
- </Screen>
103
- </ScreenStack>
104
- ) : (
105
- content
106
- )}
107
- </Screen>
108
- );
109
- }
110
-
111
- const styles = StyleSheet.create({
112
- container: {
113
- flex: 1,
114
- },
115
- absolute: {
116
- position: 'absolute',
117
- top: 0,
118
- start: 0,
119
- end: 0,
120
- },
121
- });