@react-navigation/stack 7.0.0-alpha.0 → 7.0.0-alpha.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.
Files changed (207) hide show
  1. package/lib/commonjs/TransitionConfigs/CardStyleInterpolators.js +4 -5
  2. package/lib/commonjs/TransitionConfigs/CardStyleInterpolators.js.map +1 -1
  3. package/lib/commonjs/TransitionConfigs/HeaderStyleInterpolators.js +19 -12
  4. package/lib/commonjs/TransitionConfigs/HeaderStyleInterpolators.js.map +1 -1
  5. package/lib/commonjs/TransitionConfigs/TransitionPresets.js +11 -21
  6. package/lib/commonjs/TransitionConfigs/TransitionPresets.js.map +1 -1
  7. package/lib/commonjs/TransitionConfigs/TransitionSpecs.js +7 -14
  8. package/lib/commonjs/TransitionConfigs/TransitionSpecs.js.map +1 -1
  9. package/lib/commonjs/index.js +16 -17
  10. package/lib/commonjs/index.js.map +1 -1
  11. package/lib/commonjs/navigators/createStackNavigator.js +35 -28
  12. package/lib/commonjs/navigators/createStackNavigator.js.map +1 -1
  13. package/lib/commonjs/types.js.map +1 -1
  14. package/lib/commonjs/utils/CardAnimationContext.js +4 -5
  15. package/lib/commonjs/utils/CardAnimationContext.js.map +1 -1
  16. package/lib/commonjs/utils/GestureHandlerRefContext.js +4 -5
  17. package/lib/commonjs/utils/GestureHandlerRefContext.js.map +1 -1
  18. package/lib/commonjs/utils/ModalPresentationContext.js +4 -6
  19. package/lib/commonjs/utils/ModalPresentationContext.js.map +1 -1
  20. package/lib/commonjs/utils/conditional.js +1 -1
  21. package/lib/commonjs/utils/conditional.js.map +1 -1
  22. package/lib/commonjs/utils/debounce.js +1 -1
  23. package/lib/commonjs/utils/debounce.js.map +1 -1
  24. package/lib/commonjs/utils/findLastIndex.js +2 -2
  25. package/lib/commonjs/utils/findLastIndex.js.map +1 -1
  26. package/lib/commonjs/utils/getDistanceForDirection.js +4 -5
  27. package/lib/commonjs/utils/getDistanceForDirection.js.map +1 -1
  28. package/lib/commonjs/utils/getInvertedMultiplier.js +4 -5
  29. package/lib/commonjs/utils/getInvertedMultiplier.js.map +1 -1
  30. package/lib/commonjs/utils/memoize.js +1 -1
  31. package/lib/commonjs/utils/memoize.js.map +1 -1
  32. package/lib/commonjs/utils/useCardAnimation.js +5 -6
  33. package/lib/commonjs/utils/useCardAnimation.js.map +1 -1
  34. package/lib/commonjs/utils/useGestureHandlerRef.js +5 -6
  35. package/lib/commonjs/utils/useGestureHandlerRef.js.map +1 -1
  36. package/lib/commonjs/utils/useKeyboardManager.js +7 -7
  37. package/lib/commonjs/utils/useKeyboardManager.js.map +1 -1
  38. package/lib/commonjs/views/GestureHandler.android.js.map +1 -1
  39. package/lib/commonjs/views/GestureHandler.ios.js.map +1 -1
  40. package/lib/commonjs/views/GestureHandler.js +5 -8
  41. package/lib/commonjs/views/GestureHandler.js.map +1 -1
  42. package/lib/commonjs/views/GestureHandlerNative.js +4 -5
  43. package/lib/commonjs/views/GestureHandlerNative.js.map +1 -1
  44. package/lib/commonjs/views/Header/Header.js +11 -12
  45. package/lib/commonjs/views/Header/Header.js.map +1 -1
  46. package/lib/commonjs/views/Header/HeaderContainer.js +15 -13
  47. package/lib/commonjs/views/Header/HeaderContainer.js.map +1 -1
  48. package/lib/commonjs/views/Header/HeaderSegment.js +14 -7
  49. package/lib/commonjs/views/Header/HeaderSegment.js.map +1 -1
  50. package/lib/commonjs/views/Screens.js +2 -2
  51. package/lib/commonjs/views/Screens.js.map +1 -1
  52. package/lib/commonjs/views/Stack/Card.js +236 -234
  53. package/lib/commonjs/views/Stack/Card.js.map +1 -1
  54. package/lib/commonjs/views/Stack/CardContainer.js +33 -30
  55. package/lib/commonjs/views/Stack/CardContainer.js.map +1 -1
  56. package/lib/commonjs/views/Stack/CardSheet.js +25 -5
  57. package/lib/commonjs/views/Stack/CardSheet.js.map +1 -1
  58. package/lib/commonjs/views/Stack/CardStack.js +131 -136
  59. package/lib/commonjs/views/Stack/CardStack.js.map +1 -1
  60. package/lib/commonjs/views/Stack/StackView.js +153 -164
  61. package/lib/commonjs/views/Stack/StackView.js.map +1 -1
  62. package/lib/module/TransitionConfigs/CardStyleInterpolators.js +1 -1
  63. package/lib/module/TransitionConfigs/CardStyleInterpolators.js.map +1 -1
  64. package/lib/module/TransitionConfigs/HeaderStyleInterpolators.js +20 -13
  65. package/lib/module/TransitionConfigs/HeaderStyleInterpolators.js.map +1 -1
  66. package/lib/module/TransitionConfigs/TransitionPresets.js +1 -1
  67. package/lib/module/TransitionConfigs/TransitionPresets.js.map +1 -1
  68. package/lib/module/TransitionConfigs/TransitionSpecs.js.map +1 -1
  69. package/lib/module/index.js +7 -7
  70. package/lib/module/index.js.map +1 -1
  71. package/lib/module/navigators/createStackNavigator.js +32 -23
  72. package/lib/module/navigators/createStackNavigator.js.map +1 -1
  73. package/lib/module/types.js.map +1 -1
  74. package/lib/module/utils/CardAnimationContext.js +1 -1
  75. package/lib/module/utils/CardAnimationContext.js.map +1 -1
  76. package/lib/module/utils/GestureHandlerRefContext.js +1 -1
  77. package/lib/module/utils/GestureHandlerRefContext.js.map +1 -1
  78. package/lib/module/utils/ModalPresentationContext.js +1 -2
  79. package/lib/module/utils/ModalPresentationContext.js.map +1 -1
  80. package/lib/module/utils/conditional.js +1 -1
  81. package/lib/module/utils/conditional.js.map +1 -1
  82. package/lib/module/utils/debounce.js +1 -1
  83. package/lib/module/utils/debounce.js.map +1 -1
  84. package/lib/module/utils/findLastIndex.js +2 -2
  85. package/lib/module/utils/findLastIndex.js.map +1 -1
  86. package/lib/module/utils/getDistanceForDirection.js +3 -3
  87. package/lib/module/utils/getDistanceForDirection.js.map +1 -1
  88. package/lib/module/utils/getInvertedMultiplier.js +3 -4
  89. package/lib/module/utils/getInvertedMultiplier.js.map +1 -1
  90. package/lib/module/utils/memoize.js +1 -1
  91. package/lib/module/utils/memoize.js.map +1 -1
  92. package/lib/module/utils/useCardAnimation.js +2 -2
  93. package/lib/module/utils/useCardAnimation.js.map +1 -1
  94. package/lib/module/utils/useGestureHandlerRef.js +3 -3
  95. package/lib/module/utils/useGestureHandlerRef.js.map +1 -1
  96. package/lib/module/utils/useKeyboardManager.js +5 -5
  97. package/lib/module/utils/useKeyboardManager.js.map +1 -1
  98. package/lib/module/views/GestureHandler.android.js.map +1 -1
  99. package/lib/module/views/GestureHandler.ios.js.map +1 -1
  100. package/lib/module/views/GestureHandler.js.map +1 -1
  101. package/lib/module/views/GestureHandlerNative.js +1 -1
  102. package/lib/module/views/GestureHandlerNative.js.map +1 -1
  103. package/lib/module/views/Header/Header.js +5 -4
  104. package/lib/module/views/Header/Header.js.map +1 -1
  105. package/lib/module/views/Header/HeaderContainer.js +13 -10
  106. package/lib/module/views/Header/HeaderContainer.js.map +1 -1
  107. package/lib/module/views/Header/HeaderSegment.js +11 -3
  108. package/lib/module/views/Header/HeaderSegment.js.map +1 -1
  109. package/lib/module/views/Screens.js.map +1 -1
  110. package/lib/module/views/Stack/Card.js +231 -228
  111. package/lib/module/views/Stack/Card.js.map +1 -1
  112. package/lib/module/views/Stack/CardContainer.js +28 -23
  113. package/lib/module/views/Stack/CardContainer.js.map +1 -1
  114. package/lib/module/views/Stack/CardSheet.js +22 -1
  115. package/lib/module/views/Stack/CardSheet.js.map +1 -1
  116. package/lib/module/views/Stack/CardStack.js +124 -128
  117. package/lib/module/views/Stack/CardStack.js.map +1 -1
  118. package/lib/module/views/Stack/StackView.js +149 -159
  119. package/lib/module/views/Stack/StackView.js.map +1 -1
  120. package/lib/typescript/src/TransitionConfigs/HeaderStyleInterpolators.d.ts +3 -3
  121. package/lib/typescript/src/TransitionConfigs/HeaderStyleInterpolators.d.ts.map +1 -1
  122. package/lib/typescript/src/index.d.ts +7 -7
  123. package/lib/typescript/src/index.d.ts.map +1 -1
  124. package/lib/typescript/src/navigators/createStackNavigator.d.ts +6 -6
  125. package/lib/typescript/src/navigators/createStackNavigator.d.ts.map +1 -1
  126. package/lib/typescript/src/types.d.ts +47 -9
  127. package/lib/typescript/src/types.d.ts.map +1 -1
  128. package/lib/typescript/src/utils/CardAnimationContext.d.ts +1 -2
  129. package/lib/typescript/src/utils/CardAnimationContext.d.ts.map +1 -1
  130. package/lib/typescript/src/utils/GestureHandlerRefContext.d.ts +1 -2
  131. package/lib/typescript/src/utils/GestureHandlerRefContext.d.ts.map +1 -1
  132. package/lib/typescript/src/utils/ModalPresentationContext.d.ts +1 -2
  133. package/lib/typescript/src/utils/ModalPresentationContext.d.ts.map +1 -1
  134. package/lib/typescript/src/utils/conditional.d.ts +1 -1
  135. package/lib/typescript/src/utils/conditional.d.ts.map +1 -1
  136. package/lib/typescript/src/utils/debounce.d.ts +1 -1
  137. package/lib/typescript/src/utils/debounce.d.ts.map +1 -1
  138. package/lib/typescript/src/utils/findLastIndex.d.ts +1 -1
  139. package/lib/typescript/src/utils/findLastIndex.d.ts.map +1 -1
  140. package/lib/typescript/src/utils/getDistanceForDirection.d.ts +1 -1
  141. package/lib/typescript/src/utils/getDistanceForDirection.d.ts.map +1 -1
  142. package/lib/typescript/src/utils/getInvertedMultiplier.d.ts +1 -1
  143. package/lib/typescript/src/utils/getInvertedMultiplier.d.ts.map +1 -1
  144. package/lib/typescript/src/utils/memoize.d.ts +1 -1
  145. package/lib/typescript/src/utils/memoize.d.ts.map +1 -1
  146. package/lib/typescript/src/utils/useCardAnimation.d.ts +1 -1
  147. package/lib/typescript/src/utils/useCardAnimation.d.ts.map +1 -1
  148. package/lib/typescript/src/utils/useGestureHandlerRef.d.ts +1 -1
  149. package/lib/typescript/src/utils/useGestureHandlerRef.d.ts.map +1 -1
  150. package/lib/typescript/src/utils/useKeyboardManager.d.ts +1 -1
  151. package/lib/typescript/src/utils/useKeyboardManager.d.ts.map +1 -1
  152. package/lib/typescript/src/views/GestureHandlerNative.d.ts +3 -3
  153. package/lib/typescript/src/views/GestureHandlerNative.d.ts.map +1 -1
  154. package/lib/typescript/src/views/Header/Header.d.ts +1 -2
  155. package/lib/typescript/src/views/Header/Header.d.ts.map +1 -1
  156. package/lib/typescript/src/views/Header/HeaderContainer.d.ts +4 -4
  157. package/lib/typescript/src/views/Header/HeaderContainer.d.ts.map +1 -1
  158. package/lib/typescript/src/views/Header/HeaderSegment.d.ts +3 -2
  159. package/lib/typescript/src/views/Header/HeaderSegment.d.ts.map +1 -1
  160. package/lib/typescript/src/views/Screens.d.ts +4 -3
  161. package/lib/typescript/src/views/Screens.d.ts.map +1 -1
  162. package/lib/typescript/src/views/Stack/Card.d.ts +7 -6
  163. package/lib/typescript/src/views/Stack/Card.d.ts.map +1 -1
  164. package/lib/typescript/src/views/Stack/CardContainer.d.ts +5 -8
  165. package/lib/typescript/src/views/Stack/CardContainer.d.ts.map +1 -1
  166. package/lib/typescript/src/views/Stack/CardSheet.d.ts +2 -3
  167. package/lib/typescript/src/views/Stack/CardSheet.d.ts.map +1 -1
  168. package/lib/typescript/src/views/Stack/CardStack.d.ts +5 -6
  169. package/lib/typescript/src/views/Stack/CardStack.d.ts.map +1 -1
  170. package/lib/typescript/src/views/Stack/StackView.d.ts +10 -81
  171. package/lib/typescript/src/views/Stack/StackView.d.ts.map +1 -1
  172. package/package.json +20 -21
  173. package/src/TransitionConfigs/CardStyleInterpolators.tsx +6 -6
  174. package/src/TransitionConfigs/HeaderStyleInterpolators.tsx +32 -22
  175. package/src/TransitionConfigs/TransitionPresets.tsx +4 -4
  176. package/src/index.tsx +7 -7
  177. package/src/navigators/createStackNavigator.tsx +20 -9
  178. package/src/types.tsx +50 -10
  179. package/src/utils/CardAnimationContext.tsx +3 -3
  180. package/src/utils/GestureHandlerRefContext.tsx +1 -1
  181. package/src/utils/ModalPresentationContext.tsx +1 -3
  182. package/src/utils/conditional.tsx +1 -1
  183. package/src/utils/debounce.tsx +1 -1
  184. package/src/utils/findLastIndex.tsx +2 -5
  185. package/src/utils/getDistanceForDirection.tsx +5 -4
  186. package/src/utils/getInvertedMultiplier.tsx +5 -6
  187. package/src/utils/memoize.tsx +1 -1
  188. package/src/utils/useCardAnimation.tsx +2 -2
  189. package/src/utils/useGestureHandlerRef.tsx +3 -3
  190. package/src/utils/useKeyboardManager.tsx +2 -2
  191. package/src/views/GestureHandlerNative.tsx +2 -2
  192. package/src/views/Header/Header.tsx +7 -6
  193. package/src/views/Header/HeaderContainer.tsx +19 -8
  194. package/src/views/Header/HeaderSegment.tsx +14 -6
  195. package/src/views/Screens.tsx +2 -1
  196. package/src/views/Stack/Card.tsx +80 -61
  197. package/src/views/Stack/CardContainer.tsx +23 -14
  198. package/src/views/Stack/CardSheet.tsx +58 -35
  199. package/src/views/Stack/CardStack.tsx +220 -190
  200. package/src/views/Stack/StackView.tsx +29 -31
  201. package/lib/commonjs/views/ModalStatusBarManager.js +0 -44
  202. package/lib/commonjs/views/ModalStatusBarManager.js.map +0 -1
  203. package/lib/module/views/ModalStatusBarManager.js +0 -36
  204. package/lib/module/views/ModalStatusBarManager.js.map +0 -1
  205. package/lib/typescript/src/views/ModalStatusBarManager.d.ts +0 -12
  206. package/lib/typescript/src/views/ModalStatusBarManager.d.ts.map +0 -1
  207. package/src/views/ModalStatusBarManager.tsx +0 -50
@@ -1,10 +1,12 @@
1
- import { ParamListBase, Route, StackNavigationState } from '@react-navigation/native';
1
+ import { type LocaleDirection, type ParamListBase, type Route, type RouteProp, type StackNavigationState } from '@react-navigation/native';
2
2
  import * as React from 'react';
3
- import type { StackDescriptorMap, StackNavigationConfig, StackNavigationHelpers } from '../../types';
3
+ import type { StackDescriptor, StackDescriptorMap, StackNavigationConfig, StackNavigationHelpers } from '../../types';
4
4
  type Props = StackNavigationConfig & {
5
+ direction: LocaleDirection;
5
6
  state: StackNavigationState<ParamListBase>;
6
7
  navigation: StackNavigationHelpers;
7
8
  descriptors: StackDescriptorMap;
9
+ describe: (route: RouteProp<ParamListBase>, placeholder: boolean) => StackDescriptor;
8
10
  };
9
11
  type State = {
10
12
  routes: Route<string>[];
@@ -15,90 +17,18 @@ type State = {
15
17
  replacingRouteKeys: string[];
16
18
  descriptors: StackDescriptorMap;
17
19
  };
18
- export default class StackView extends React.Component<Props, State> {
20
+ export declare class StackView extends React.Component<Props, State> {
19
21
  static getDerivedStateFromProps(props: Readonly<Props>, state: Readonly<State>): {
20
- routes: Route<string, object | undefined>[];
21
- previousRoutes: Route<string, object | undefined>[];
22
+ routes: Route<string>[];
23
+ previousRoutes: Route<string>[];
22
24
  descriptors: StackDescriptorMap;
23
25
  previousDescriptors: StackDescriptorMap;
24
26
  openingRouteKeys?: undefined;
25
27
  closingRouteKeys?: undefined;
26
28
  replacingRouteKeys?: undefined;
27
29
  } | {
28
- routes: (Readonly<{
29
- key: string;
30
- name: string;
31
- path?: string | undefined;
32
- }> & Readonly<{
33
- params?: Readonly<object | undefined>;
34
- }> & {
35
- state?: Readonly<{
36
- key: string;
37
- index: number;
38
- routeNames: string[];
39
- history?: unknown[] | undefined;
40
- routes: (Readonly<{
41
- key: string;
42
- name: string;
43
- path?: string | undefined;
44
- }> & Readonly<{
45
- params?: Readonly<object | undefined>;
46
- }> & any)[];
47
- type: string;
48
- stale: false;
49
- }> | import("@react-navigation/native").PartialState<Readonly<{
50
- key: string;
51
- index: number;
52
- routeNames: string[];
53
- history?: unknown[] | undefined;
54
- routes: (Readonly<{
55
- key: string;
56
- name: string;
57
- path?: string | undefined;
58
- }> & Readonly<{
59
- params?: Readonly<object | undefined>;
60
- }> & any)[];
61
- type: string;
62
- stale: false;
63
- }>> | undefined;
64
- })[];
65
- previousRoutes: (Readonly<{
66
- key: string;
67
- name: string;
68
- path?: string | undefined;
69
- }> & Readonly<{
70
- params?: Readonly<object | undefined>;
71
- }> & {
72
- state?: Readonly<{
73
- key: string;
74
- index: number;
75
- routeNames: string[];
76
- history?: unknown[] | undefined;
77
- routes: (Readonly<{
78
- key: string;
79
- name: string;
80
- path?: string | undefined;
81
- }> & Readonly<{
82
- params?: Readonly<object | undefined>;
83
- }> & any)[];
84
- type: string;
85
- stale: false;
86
- }> | import("@react-navigation/native").PartialState<Readonly<{
87
- key: string;
88
- index: number;
89
- routeNames: string[];
90
- history?: unknown[] | undefined;
91
- routes: (Readonly<{
92
- key: string;
93
- name: string;
94
- path?: string | undefined;
95
- }> & Readonly<{
96
- params?: Readonly<object | undefined>;
97
- }> & any)[];
98
- type: string;
99
- stale: false;
100
- }>> | undefined;
101
- })[];
30
+ routes: import("@react-navigation/native").NavigationRoute<ParamListBase, string>[];
31
+ previousRoutes: import("@react-navigation/native").NavigationRoute<ParamListBase, string>[];
102
32
  previousDescriptors: StackDescriptorMap;
103
33
  openingRouteKeys: string[];
104
34
  closingRouteKeys: string[];
@@ -107,7 +37,6 @@ export default class StackView extends React.Component<Props, State> {
107
37
  };
108
38
  state: State;
109
39
  private getPreviousRoute;
110
- private renderScene;
111
40
  private renderHeader;
112
41
  private handleOpenRoute;
113
42
  private handleCloseRoute;
@@ -116,7 +45,7 @@ export default class StackView extends React.Component<Props, State> {
116
45
  private handleGestureStart;
117
46
  private handleGestureEnd;
118
47
  private handleGestureCancel;
119
- render(): JSX.Element;
48
+ render(): React.JSX.Element;
120
49
  }
121
50
  export {};
122
51
  //# sourceMappingURL=StackView.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"StackView.d.ts","sourceRoot":"","sources":["../../../../../src/views/Stack/StackView.tsx"],"names":[],"mappings":"AAIA,OAAO,EAEL,aAAa,EACb,KAAK,EAEL,oBAAoB,EACrB,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAO/B,OAAO,KAAK,EACV,kBAAkB,EAClB,qBAAqB,EACrB,sBAAsB,EACvB,MAAM,aAAa,CAAC;AAQrB,KAAK,KAAK,GAAG,qBAAqB,GAAG;IACnC,KAAK,EAAE,oBAAoB,CAAC,aAAa,CAAC,CAAC;IAC3C,UAAU,EAAE,sBAAsB,CAAC;IACnC,WAAW,EAAE,kBAAkB,CAAC;CACjC,CAAC;AAEF,KAAK,KAAK,GAAG;IAEX,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC;IAExB,cAA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zB;IAEF,MAAM;CAyDP"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@react-navigation/stack",
3
3
  "description": "Stack navigator component for iOS and Android with animated transitions and gestures",
4
- "version": "7.0.0-alpha.0",
4
+ "version": "7.0.0-alpha.10",
5
5
  "keywords": [
6
6
  "react-native-component",
7
7
  "react-component",
@@ -40,31 +40,30 @@
40
40
  "clean": "del lib"
41
41
  },
42
42
  "dependencies": {
43
- "@react-navigation/elements": "^1.3.9-alpha.0",
43
+ "@react-navigation/elements": "^2.0.0-alpha.7",
44
44
  "color": "^4.2.3"
45
45
  },
46
46
  "devDependencies": {
47
- "@react-navigation/native": "^7.0.0-alpha.0",
48
- "@testing-library/react-native": "^11.5.0",
49
- "@types/color": "^3.0.3",
50
- "@types/react": "~18.0.26",
51
- "@types/react-native": "~0.70.8",
52
- "del-cli": "^5.0.0",
53
- "react": "18.1.0",
54
- "react-native": "0.70.5",
55
- "react-native-builder-bob": "^0.20.3",
56
- "react-native-gesture-handler": "~2.8.0",
57
- "react-native-safe-area-context": "4.4.1",
58
- "react-native-screens": "~3.18.0",
59
- "typescript": "^4.9.4"
47
+ "@react-navigation/native": "^7.0.0-alpha.9",
48
+ "@testing-library/react-native": "^12.4.3",
49
+ "@types/color": "^3.0.6",
50
+ "@types/react": "~18.2.45",
51
+ "del-cli": "^5.1.0",
52
+ "react": "18.2.0",
53
+ "react-native": "0.73.2",
54
+ "react-native-builder-bob": "^0.23.2",
55
+ "react-native-gesture-handler": "~2.14.0",
56
+ "react-native-safe-area-context": "4.8.2",
57
+ "react-native-screens": "~3.29.0",
58
+ "typescript": "^5.3.3"
60
59
  },
61
60
  "peerDependencies": {
62
- "@react-navigation/native": "^6.0.0",
61
+ "@react-navigation/native": "^7.0.0-alpha.9",
63
62
  "react": "*",
64
- "react-native": "*",
65
- "react-native-gesture-handler": ">= 1.0.0",
66
- "react-native-safe-area-context": ">= 3.0.0",
67
- "react-native-screens": ">= 3.0.0"
63
+ "react-native": "0.73.2",
64
+ "react-native-gesture-handler": "~2.14.0",
65
+ "react-native-safe-area-context": "4.8.2",
66
+ "react-native-screens": "~3.29.0"
68
67
  },
69
68
  "react-native-builder-bob": {
70
69
  "source": "src",
@@ -80,5 +79,5 @@
80
79
  ]
81
80
  ]
82
81
  },
83
- "gitHead": "ad722b882e0c40b1d1bc025d70112ddb126f265e"
82
+ "gitHead": "c7b047dec7c75bda359a618d39a2aac4c2aea9c1"
84
83
  }
@@ -4,7 +4,7 @@ import type {
4
4
  StackCardInterpolatedStyle,
5
5
  StackCardInterpolationProps,
6
6
  } from '../types';
7
- import conditional from '../utils/conditional';
7
+ import { conditional } from '../utils/conditional';
8
8
 
9
9
  const { add, multiply } = Animated;
10
10
 
@@ -156,11 +156,11 @@ export function forModalPresentationIOS({
156
156
  const borderRadius = isLandscape
157
157
  ? 0
158
158
  : isFirst
159
- ? progress.interpolate({
160
- inputRange: [0, 1, 1.0001, 2],
161
- outputRange: [0, 0, hasNotchIos ? 38 : 0, 10],
162
- })
163
- : 10;
159
+ ? progress.interpolate({
160
+ inputRange: [0, 1, 1.0001, 2],
161
+ outputRange: [0, 0, hasNotchIos ? 38 : 0, 10],
162
+ })
163
+ : 10;
164
164
 
165
165
  return {
166
166
  cardStyle: {
@@ -1,11 +1,11 @@
1
- import { Animated, I18nManager } from 'react-native';
1
+ import { Animated } from 'react-native';
2
2
 
3
3
  import type {
4
4
  StackHeaderInterpolatedStyle,
5
5
  StackHeaderInterpolationProps,
6
6
  } from '../types';
7
7
 
8
- const { add } = Animated;
8
+ const { add, multiply } = Animated;
9
9
 
10
10
  /**
11
11
  * Standard UIKit style animation for the header where the title fades into the back button label.
@@ -13,6 +13,7 @@ const { add } = Animated;
13
13
  export function forUIKit({
14
14
  current,
15
15
  next,
16
+ direction,
16
17
  layouts,
17
18
  }: StackHeaderInterpolationProps): StackHeaderInterpolatedStyle {
18
19
  const defaultOffset = 100;
@@ -34,6 +35,8 @@ export function forUIKit({
34
35
  // The back title also animates in from this position
35
36
  const rightOffset = layouts.screen.width / 4;
36
37
 
38
+ const multiplier = direction === 'rtl' ? -1 : 1;
39
+
37
40
  const progress = add(
38
41
  current.progress.interpolate({
39
42
  inputRange: [0, 1],
@@ -59,12 +62,13 @@ export function forUIKit({
59
62
  leftLabelStyle: {
60
63
  transform: [
61
64
  {
62
- translateX: progress.interpolate({
63
- inputRange: [0, 1, 2],
64
- outputRange: I18nManager.getConstants().isRTL
65
- ? [-rightOffset, 0, leftLabelOffset]
66
- : [leftLabelOffset, 0, -rightOffset],
67
- }),
65
+ translateX: multiply(
66
+ multiplier,
67
+ progress.interpolate({
68
+ inputRange: [0, 1, 2],
69
+ outputRange: [leftLabelOffset, 0, -rightOffset],
70
+ })
71
+ ),
68
72
  },
69
73
  ],
70
74
  },
@@ -81,24 +85,26 @@ export function forUIKit({
81
85
  }),
82
86
  transform: [
83
87
  {
84
- translateX: progress.interpolate({
85
- inputRange: [0.5, 1, 2],
86
- outputRange: I18nManager.getConstants().isRTL
87
- ? [-titleLeftOffset, 0, rightOffset]
88
- : [rightOffset, 0, -titleLeftOffset],
89
- }),
88
+ translateX: multiply(
89
+ multiplier,
90
+ progress.interpolate({
91
+ inputRange: [0.5, 1, 2],
92
+ outputRange: [rightOffset, 0, -titleLeftOffset],
93
+ })
94
+ ),
90
95
  },
91
96
  ],
92
97
  },
93
98
  backgroundStyle: {
94
99
  transform: [
95
100
  {
96
- translateX: progress.interpolate({
97
- inputRange: [0, 1, 2],
98
- outputRange: I18nManager.getConstants().isRTL
99
- ? [-layouts.screen.width, 0, layouts.screen.width]
100
- : [layouts.screen.width, 0, -layouts.screen.width],
101
- }),
101
+ translateX: multiply(
102
+ multiplier,
103
+ progress.interpolate({
104
+ inputRange: [0, 1, 2],
105
+ outputRange: [layouts.screen.width, 0, -layouts.screen.width],
106
+ })
107
+ ),
102
108
  },
103
109
  ],
104
110
  },
@@ -151,8 +157,10 @@ export function forFade({
151
157
  export function forSlideLeft({
152
158
  current,
153
159
  next,
160
+ direction,
154
161
  layouts: { screen },
155
162
  }: StackHeaderInterpolationProps): StackHeaderInterpolatedStyle {
163
+ const isRTL = direction === 'rtl';
156
164
  const progress = add(
157
165
  current.progress.interpolate({
158
166
  inputRange: [0, 1],
@@ -170,7 +178,7 @@ export function forSlideLeft({
170
178
 
171
179
  const translateX = progress.interpolate({
172
180
  inputRange: [0, 1, 2],
173
- outputRange: I18nManager.getConstants().isRTL
181
+ outputRange: isRTL
174
182
  ? [-screen.width, 0, screen.width]
175
183
  : [screen.width, 0, -screen.width],
176
184
  });
@@ -191,8 +199,10 @@ export function forSlideLeft({
191
199
  export function forSlideRight({
192
200
  current,
193
201
  next,
202
+ direction,
194
203
  layouts: { screen },
195
204
  }: StackHeaderInterpolationProps): StackHeaderInterpolatedStyle {
205
+ const isRTL = direction === 'rtl';
196
206
  const progress = add(
197
207
  current.progress.interpolate({
198
208
  inputRange: [0, 1],
@@ -210,7 +220,7 @@ export function forSlideRight({
210
220
 
211
221
  const translateX = progress.interpolate({
212
222
  inputRange: [0, 1, 2],
213
- outputRange: I18nManager.getConstants().isRTL
223
+ outputRange: isRTL
214
224
  ? [screen.width, 0, -screen.width]
215
225
  : [-screen.width, 0, screen.width],
216
226
  });
@@ -135,11 +135,11 @@ export const ModalFadeTransition: TransitionPreset = {
135
135
  export const DefaultTransition = Platform.select({
136
136
  ios: SlideFromRightIOS,
137
137
  android:
138
- Platform.Version >= ANDROID_VERSION_10
138
+ Number(Platform.Version) >= ANDROID_VERSION_10
139
139
  ? ScaleFromCenterAndroid
140
- : Platform.Version >= ANDROID_VERSION_PIE
141
- ? RevealFromBottomAndroid
142
- : FadeFromBottomAndroid,
140
+ : Number(Platform.Version) >= ANDROID_VERSION_PIE
141
+ ? RevealFromBottomAndroid
142
+ : FadeFromBottomAndroid,
143
143
  default: ScaleFromCenterAndroid,
144
144
  });
145
145
 
package/src/index.tsx CHANGED
@@ -6,13 +6,13 @@ import * as TransitionSpecs from './TransitionConfigs/TransitionSpecs';
6
6
  /**
7
7
  * Navigators
8
8
  */
9
- export { default as createStackNavigator } from './navigators/createStackNavigator';
9
+ export { createStackNavigator } from './navigators/createStackNavigator';
10
10
 
11
11
  /**
12
12
  * Views
13
13
  */
14
- export { default as Header } from './views/Header/Header';
15
- export { default as StackView } from './views/Stack/StackView';
14
+ export { Header } from './views/Header/Header';
15
+ export { StackView } from './views/Stack/StackView';
16
16
 
17
17
  /**
18
18
  * Transition presets
@@ -27,10 +27,10 @@ export {
27
27
  /**
28
28
  * Utilities
29
29
  */
30
- export { default as CardAnimationContext } from './utils/CardAnimationContext';
31
- export { default as GestureHandlerRefContext } from './utils/GestureHandlerRefContext';
32
- export { default as useCardAnimation } from './utils/useCardAnimation';
33
- export { default as useGestureHandlerRef } from './utils/useGestureHandlerRef';
30
+ export { CardAnimationContext } from './utils/CardAnimationContext';
31
+ export { GestureHandlerRefContext } from './utils/GestureHandlerRefContext';
32
+ export { useCardAnimation } from './utils/useCardAnimation';
33
+ export { useGestureHandlerRef } from './utils/useGestureHandlerRef';
34
34
 
35
35
  /**
36
36
  * Types
@@ -1,13 +1,14 @@
1
1
  import {
2
2
  createNavigatorFactory,
3
- DefaultNavigatorOptions,
4
- EventArg,
5
- ParamListBase,
6
- StackActionHelpers,
3
+ type DefaultNavigatorOptions,
4
+ type EventArg,
5
+ type ParamListBase,
6
+ type StackActionHelpers,
7
7
  StackActions,
8
- StackNavigationState,
8
+ type StackNavigationState,
9
9
  StackRouter,
10
- StackRouterOptions,
10
+ type StackRouterOptions,
11
+ useLocale,
11
12
  useNavigationBuilder,
12
13
  } from '@react-navigation/native';
13
14
  import * as React from 'react';
@@ -17,7 +18,7 @@ import type {
17
18
  StackNavigationEventMap,
18
19
  StackNavigationOptions,
19
20
  } from '../types';
20
- import StackView from '../views/Stack/StackView';
21
+ import { StackView } from '../views/Stack/StackView';
21
22
 
22
23
  type Props = DefaultNavigatorOptions<
23
24
  ParamListBase,
@@ -31,12 +32,17 @@ type Props = DefaultNavigatorOptions<
31
32
  function StackNavigator({
32
33
  id,
33
34
  initialRouteName,
35
+ getStateForRouteNamesChange,
34
36
  children,
37
+ layout,
35
38
  screenListeners,
36
39
  screenOptions,
40
+ screenLayout,
37
41
  ...rest
38
42
  }: Props) {
39
- const { state, descriptors, navigation, NavigationContent } =
43
+ const { direction } = useLocale();
44
+
45
+ const { state, describe, descriptors, navigation, NavigationContent } =
40
46
  useNavigationBuilder<
41
47
  StackNavigationState<ParamListBase>,
42
48
  StackRouterOptions,
@@ -47,8 +53,11 @@ function StackNavigator({
47
53
  id,
48
54
  initialRouteName,
49
55
  children,
56
+ layout,
50
57
  screenListeners,
51
58
  screenOptions,
59
+ screenLayout,
60
+ getStateForRouteNamesChange,
52
61
  });
53
62
 
54
63
  React.useEffect(
@@ -81,7 +90,9 @@ function StackNavigator({
81
90
  <NavigationContent>
82
91
  <StackView
83
92
  {...rest}
93
+ direction={direction}
84
94
  state={state}
95
+ describe={describe}
85
96
  descriptors={descriptors}
86
97
  navigation={navigation}
87
98
  />
@@ -89,7 +100,7 @@ function StackNavigator({
89
100
  );
90
101
  }
91
102
 
92
- export default createNavigatorFactory<
103
+ export const createStackNavigator = createNavigatorFactory<
93
104
  StackNavigationState<ParamListBase>,
94
105
  StackNavigationOptions,
95
106
  StackNavigationEventMap,
package/src/types.tsx CHANGED
@@ -1,12 +1,12 @@
1
1
  import type {
2
2
  HeaderBackButton,
3
3
  HeaderBackButtonProps,
4
- HeaderButtonProps,
5
4
  HeaderOptions,
6
5
  HeaderTitleProps,
7
6
  } from '@react-navigation/elements';
8
7
  import type {
9
8
  Descriptor,
9
+ LocaleDirection,
10
10
  NavigationHelpers,
11
11
  NavigationProp,
12
12
  ParamListBase,
@@ -50,7 +50,7 @@ export type StackNavigationHelpers = NavigationHelpers<
50
50
  export type StackNavigationProp<
51
51
  ParamList extends ParamListBase,
52
52
  RouteName extends keyof ParamList = keyof ParamList,
53
- NavigatorID extends string | undefined = undefined
53
+ NavigatorID extends string | undefined = undefined,
54
54
  > = NavigationProp<
55
55
  ParamList,
56
56
  RouteName,
@@ -64,7 +64,7 @@ export type StackNavigationProp<
64
64
  export type StackScreenProps<
65
65
  ParamList extends ParamListBase,
66
66
  RouteName extends keyof ParamList = keyof ParamList,
67
- NavigatorID extends string | undefined = undefined
67
+ NavigatorID extends string | undefined = undefined,
68
68
  > = {
69
69
  navigation: StackNavigationProp<ParamList, RouteName, NavigatorID>;
70
70
  route: RouteProp<ParamList, RouteName>;
@@ -139,11 +139,11 @@ export type StackHeaderOptions = Omit<
139
139
  /**
140
140
  * Function which returns a React Element to display on the left side of the header.
141
141
  */
142
- headerLeft?: (props: HeaderBackButtonProps) => React.ReactNode;
142
+ headerLeft?: (props: StackHeaderLeftProps) => React.ReactNode;
143
143
  /**
144
144
  * Function which returns a React Element to display on the right side of the header.
145
145
  */
146
- headerRight?: (props: HeaderButtonProps) => React.ReactNode;
146
+ headerRight?: (props: StackHeaderRightProps) => React.ReactNode;
147
147
  /**
148
148
  * Whether back button title font should scale to respect Text Size accessibility settings. Defaults to `false`.
149
149
  */
@@ -196,7 +196,11 @@ export type StackHeaderProps = {
196
196
  /**
197
197
  * Title of the previous screen.
198
198
  */
199
- title: string;
199
+ title: string | undefined;
200
+ /**
201
+ * The `href` to use for the anchor tag on web
202
+ */
203
+ href: string | undefined;
200
204
  };
201
205
  /**
202
206
  * Animated nodes representing the progress of the animation.
@@ -220,6 +224,32 @@ export type StackHeaderProps = {
220
224
  styleInterpolator: StackHeaderStyleInterpolator;
221
225
  };
222
226
 
227
+ export type StackHeaderRightProps = {
228
+ /**
229
+ * Tint color for the header button.
230
+ */
231
+ tintColor?: string;
232
+ /**
233
+ * Color for material ripple (Android >= 5.0 only).
234
+ */
235
+ pressColor?: string;
236
+ /**
237
+ * Opacity when the button is pressed, used when ripple is not supported.
238
+ */
239
+ pressOpacity?: number;
240
+ /**
241
+ * Whether it's possible to navigate back in stack.
242
+ */
243
+ canGoBack?: boolean;
244
+ };
245
+
246
+ export type StackHeaderLeftProps = HeaderBackButtonProps & {
247
+ /**
248
+ * Whether it's possible to navigate back in stack.
249
+ */
250
+ canGoBack?: boolean;
251
+ };
252
+
223
253
  export type StackDescriptor = Descriptor<
224
254
  StackNavigationOptions,
225
255
  StackNavigationProp<ParamListBase>,
@@ -341,6 +371,12 @@ export type StackNavigationOptions = StackHeaderOptions &
341
371
  * Only supported on iOS and Android.
342
372
  */
343
373
  freezeOnBlur?: boolean;
374
+ /**
375
+ * Whether the home indicator should prefer to stay hidden on this screen. Defaults to `false`.
376
+ *
377
+ * @platform ios
378
+ */
379
+ autoHideHomeIndicator?: boolean;
344
380
  };
345
381
 
346
382
  export type StackNavigationConfig = {
@@ -429,19 +465,19 @@ export type StackCardInterpolatedStyle = {
429
465
  /**
430
466
  * Interpolated style for the container view wrapping the card.
431
467
  */
432
- containerStyle?: any;
468
+ containerStyle?: Animated.WithAnimatedValue<StyleProp<ViewStyle>>;
433
469
  /**
434
470
  * Interpolated style for the view representing the card.
435
471
  */
436
- cardStyle?: any;
472
+ cardStyle?: Animated.WithAnimatedValue<StyleProp<ViewStyle>>;
437
473
  /**
438
474
  * Interpolated style for the view representing the semi-transparent overlay below the card.
439
475
  */
440
- overlayStyle?: any;
476
+ overlayStyle?: Animated.WithAnimatedValue<StyleProp<ViewStyle>>;
441
477
  /**
442
478
  * Interpolated style representing the card shadow.
443
479
  */
444
- shadowStyle?: any;
480
+ shadowStyle?: Animated.WithAnimatedValue<StyleProp<ViewStyle>>;
445
481
  };
446
482
 
447
483
  export type StackCardStyleInterpolator = (
@@ -468,6 +504,10 @@ export type StackHeaderInterpolationProps = {
468
504
  */
469
505
  progress: Animated.AnimatedInterpolation<number>;
470
506
  };
507
+ /**
508
+ * Writing direction of the layout.
509
+ */
510
+ direction: LocaleDirection;
471
511
  /**
472
512
  * Layout measurements for various items we use for animation.
473
513
  */
@@ -2,6 +2,6 @@ import * as React from 'react';
2
2
 
3
3
  import type { StackCardInterpolationProps } from '../types';
4
4
 
5
- export default React.createContext<StackCardInterpolationProps | undefined>(
6
- undefined
7
- );
5
+ export const CardAnimationContext = React.createContext<
6
+ StackCardInterpolationProps | undefined
7
+ >(undefined);
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
2
 
3
- export default React.createContext<React.Ref<
3
+ export const GestureHandlerRefContext = React.createContext<React.Ref<
4
4
  import('react-native-gesture-handler').PanGestureHandler
5
5
  > | null>(null);
@@ -1,5 +1,3 @@
1
1
  import * as React from 'react';
2
2
 
3
- const ModalPresentationContext = React.createContext(false);
4
-
5
- export default ModalPresentationContext;
3
+ export const ModalPresentationContext = React.createContext(false);
@@ -9,7 +9,7 @@ const { add, multiply } = Animated;
9
9
  * @param main Animated Node to use if the condition is `true`
10
10
  * @param fallback Animated Node to use if the condition is `false`
11
11
  */
12
- export default function conditional(
12
+ export function conditional(
13
13
  condition: Animated.AnimatedInterpolation<0 | 1>,
14
14
  main: Animated.AnimatedInterpolation<number>,
15
15
  fallback: Animated.AnimatedInterpolation<number>
@@ -1,4 +1,4 @@
1
- export default function debounce<T extends (...args: any[]) => void>(
1
+ export function debounce<T extends (...args: any[]) => void>(
2
2
  func: T,
3
3
  duration: number
4
4
  ): T {