@react-navigation/native-stack 6.2.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.
Files changed (63) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +5 -0
  3. package/lib/commonjs/index.js +16 -0
  4. package/lib/commonjs/index.js.map +1 -0
  5. package/lib/commonjs/navigators/createNativeStackNavigator.js +67 -0
  6. package/lib/commonjs/navigators/createNativeStackNavigator.js.map +1 -0
  7. package/lib/commonjs/types.js +6 -0
  8. package/lib/commonjs/types.js.map +1 -0
  9. package/lib/commonjs/views/DebugContainer.js +24 -0
  10. package/lib/commonjs/views/DebugContainer.js.map +1 -0
  11. package/lib/commonjs/views/DebugContainer.native.js +43 -0
  12. package/lib/commonjs/views/DebugContainer.native.js.map +1 -0
  13. package/lib/commonjs/views/FontProcessor.js +11 -0
  14. package/lib/commonjs/views/FontProcessor.js.map +1 -0
  15. package/lib/commonjs/views/FontProcessor.native.js +25 -0
  16. package/lib/commonjs/views/FontProcessor.native.js.map +1 -0
  17. package/lib/commonjs/views/HeaderConfig.js +157 -0
  18. package/lib/commonjs/views/HeaderConfig.js.map +1 -0
  19. package/lib/commonjs/views/NativeStackView.js +133 -0
  20. package/lib/commonjs/views/NativeStackView.js.map +1 -0
  21. package/lib/commonjs/views/NativeStackView.native.js +247 -0
  22. package/lib/commonjs/views/NativeStackView.native.js.map +1 -0
  23. package/lib/module/index.js +8 -0
  24. package/lib/module/index.js.map +1 -0
  25. package/lib/module/navigators/createNativeStackNavigator.js +50 -0
  26. package/lib/module/navigators/createNativeStackNavigator.js.map +1 -0
  27. package/lib/module/types.js +2 -0
  28. package/lib/module/types.js.map +1 -0
  29. package/lib/module/views/DebugContainer.js +11 -0
  30. package/lib/module/views/DebugContainer.js.map +1 -0
  31. package/lib/module/views/DebugContainer.native.js +26 -0
  32. package/lib/module/views/DebugContainer.native.js.map +1 -0
  33. package/lib/module/views/FontProcessor.js +4 -0
  34. package/lib/module/views/FontProcessor.js.map +1 -0
  35. package/lib/module/views/FontProcessor.native.js +15 -0
  36. package/lib/module/views/FontProcessor.native.js.map +1 -0
  37. package/lib/module/views/HeaderConfig.js +138 -0
  38. package/lib/module/views/HeaderConfig.js.map +1 -0
  39. package/lib/module/views/NativeStackView.js +118 -0
  40. package/lib/module/views/NativeStackView.js.map +1 -0
  41. package/lib/module/views/NativeStackView.native.js +224 -0
  42. package/lib/module/views/NativeStackView.native.js.map +1 -0
  43. package/lib/typescript/src/index.d.ts +8 -0
  44. package/lib/typescript/src/navigators/createNativeStackNavigator.d.ts +6 -0
  45. package/lib/typescript/src/types.d.ts +373 -0
  46. package/lib/typescript/src/views/DebugContainer.d.ts +9 -0
  47. package/lib/typescript/src/views/DebugContainer.native.d.ts +9 -0
  48. package/lib/typescript/src/views/FontProcessor.d.ts +1 -0
  49. package/lib/typescript/src/views/FontProcessor.native.d.ts +1 -0
  50. package/lib/typescript/src/views/HeaderConfig.d.ts +9 -0
  51. package/lib/typescript/src/views/NativeStackView.d.ts +10 -0
  52. package/lib/typescript/src/views/NativeStackView.native.d.ts +10 -0
  53. package/package.json +80 -0
  54. package/src/index.tsx +14 -0
  55. package/src/navigators/createNativeStackNavigator.tsx +81 -0
  56. package/src/types.tsx +425 -0
  57. package/src/views/DebugContainer.native.tsx +33 -0
  58. package/src/views/DebugContainer.tsx +14 -0
  59. package/src/views/FontProcessor.native.tsx +13 -0
  60. package/src/views/FontProcessor.tsx +5 -0
  61. package/src/views/HeaderConfig.tsx +234 -0
  62. package/src/views/NativeStackView.native.tsx +331 -0
  63. package/src/views/NativeStackView.tsx +173 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2017 React Navigation Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,5 @@
1
+ # `@react-navigation/native-stack`
2
+
3
+ Stack navigator for React Native using native primitives for navigation. Uses [`react-native-screens`](https://github.com/software-mansion/react-native-screens) under the hood.
4
+
5
+ Installation instructions and documentation can be found on the [React Navigation website](https://reactnavigation.org/docs/native-stack-navigator.html).
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "createNativeStackNavigator", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _createNativeStackNavigator.default;
10
+ }
11
+ });
12
+
13
+ var _createNativeStackNavigator = _interopRequireDefault(require("./navigators/createNativeStackNavigator"));
14
+
15
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
16
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["index.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAGA","sourcesContent":["/**\n * Navigators\n */\nexport { default as createNativeStackNavigator } from './navigators/createNativeStackNavigator';\n\n/**\n * Types\n */\nexport type {\n NativeStackHeaderProps,\n NativeStackNavigationOptions,\n NativeStackNavigationProp,\n NativeStackScreenProps,\n} from './types';\n"]}
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _native = require("@react-navigation/native");
9
+
10
+ var React = _interopRequireWildcard(require("react"));
11
+
12
+ var _NativeStackView = _interopRequireDefault(require("../views/NativeStackView"));
13
+
14
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
+
16
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
17
+
18
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
19
+
20
+ function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
21
+
22
+ function NativeStackNavigator({
23
+ initialRouteName,
24
+ children,
25
+ screenListeners,
26
+ screenOptions,
27
+ ...rest
28
+ }) {
29
+ const {
30
+ state,
31
+ descriptors,
32
+ navigation
33
+ } = (0, _native.useNavigationBuilder)(_native.StackRouter, {
34
+ initialRouteName,
35
+ children,
36
+ screenListeners,
37
+ screenOptions
38
+ });
39
+ React.useEffect(() => {
40
+ var _navigation$addListen;
41
+
42
+ return navigation === null || navigation === void 0 ? void 0 : (_navigation$addListen = navigation.addListener) === null || _navigation$addListen === void 0 ? void 0 : _navigation$addListen.call(navigation, 'tabPress', e => {
43
+ const isFocused = navigation.isFocused(); // Run the operation in the next frame so we're sure all listeners have been run
44
+ // This is necessary to know if preventDefault() has been called
45
+
46
+ requestAnimationFrame(() => {
47
+ if (state.index > 0 && isFocused && !e.defaultPrevented) {
48
+ // When user taps on already focused tab and we're inside the tab,
49
+ // reset the stack to replicate native behaviour
50
+ navigation.dispatch({ ..._native.StackActions.popToTop(),
51
+ target: state.key
52
+ });
53
+ }
54
+ });
55
+ });
56
+ }, [navigation, state.index, state.key]);
57
+ return /*#__PURE__*/React.createElement(_NativeStackView.default, _extends({}, rest, {
58
+ state: state,
59
+ navigation: navigation,
60
+ descriptors: descriptors
61
+ }));
62
+ }
63
+
64
+ var _default = (0, _native.createNavigatorFactory)(NativeStackNavigator);
65
+
66
+ exports.default = _default;
67
+ //# sourceMappingURL=createNativeStackNavigator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["createNativeStackNavigator.tsx"],"names":["NativeStackNavigator","initialRouteName","children","screenListeners","screenOptions","rest","state","descriptors","navigation","StackRouter","React","useEffect","addListener","e","isFocused","requestAnimationFrame","index","defaultPrevented","dispatch","StackActions","popToTop","target","key"],"mappings":";;;;;;;AAAA;;AAWA;;AAOA;;;;;;;;;;AAEA,SAASA,oBAAT,CAA8B;AAC5BC,EAAAA,gBAD4B;AAE5BC,EAAAA,QAF4B;AAG5BC,EAAAA,eAH4B;AAI5BC,EAAAA,aAJ4B;AAK5B,KAAGC;AALyB,CAA9B,EAM8B;AAC5B,QAAM;AAAEC,IAAAA,KAAF;AAASC,IAAAA,WAAT;AAAsBC,IAAAA;AAAtB,MAAqC,kCAMzCC,mBANyC,EAM5B;AACbR,IAAAA,gBADa;AAEbC,IAAAA,QAFa;AAGbC,IAAAA,eAHa;AAIbC,IAAAA;AAJa,GAN4B,CAA3C;AAaAM,EAAAA,KAAK,CAACC,SAAN,CACE;AAAA;;AAAA,WACEH,UADF,aACEA,UADF,gDACEA,UAAU,CAAEI,WADd,0DACE,2BAAAJ,UAAU,EAAgB,UAAhB,EAA6BK,CAAD,IAAY;AAChD,YAAMC,SAAS,GAAGN,UAAU,CAACM,SAAX,EAAlB,CADgD,CAGhD;AACA;;AACAC,MAAAA,qBAAqB,CAAC,MAAM;AAC1B,YACET,KAAK,CAACU,KAAN,GAAc,CAAd,IACAF,SADA,IAEA,CAAED,CAAD,CAAkCI,gBAHrC,EAIE;AACA;AACA;AACAT,UAAAA,UAAU,CAACU,QAAX,CAAoB,EAClB,GAAGC,qBAAaC,QAAb,EADe;AAElBC,YAAAA,MAAM,EAAEf,KAAK,CAACgB;AAFI,WAApB;AAID;AACF,OAboB,CAArB;AAcD,KAnBS,CADZ;AAAA,GADF,EAsBE,CAACd,UAAD,EAAaF,KAAK,CAACU,KAAnB,EAA0BV,KAAK,CAACgB,GAAhC,CAtBF;AAyBA,sBACE,oBAAC,wBAAD,eACMjB,IADN;AAEE,IAAA,KAAK,EAAEC,KAFT;AAGE,IAAA,UAAU,EAAEE,UAHd;AAIE,IAAA,WAAW,EAAED;AAJf,KADF;AAQD;;eAEc,oCAKbP,oBALa,C","sourcesContent":["import {\n createNavigatorFactory,\n EventArg,\n ParamListBase,\n StackActionHelpers,\n StackActions,\n StackNavigationState,\n StackRouter,\n StackRouterOptions,\n useNavigationBuilder,\n} from '@react-navigation/native';\nimport * as React from 'react';\n\nimport type {\n NativeStackNavigationEventMap,\n NativeStackNavigationOptions,\n NativeStackNavigatorProps,\n} from '../types';\nimport NativeStackView from '../views/NativeStackView';\n\nfunction NativeStackNavigator({\n initialRouteName,\n children,\n screenListeners,\n screenOptions,\n ...rest\n}: NativeStackNavigatorProps) {\n const { state, descriptors, navigation } = useNavigationBuilder<\n StackNavigationState<ParamListBase>,\n StackRouterOptions,\n StackActionHelpers<ParamListBase>,\n NativeStackNavigationOptions,\n NativeStackNavigationEventMap\n >(StackRouter, {\n initialRouteName,\n children,\n screenListeners,\n screenOptions,\n });\n\n React.useEffect(\n () =>\n navigation?.addListener?.('tabPress', (e: any) => {\n const isFocused = navigation.isFocused();\n\n // Run the operation in the next frame so we're sure all listeners have been run\n // This is necessary to know if preventDefault() has been called\n requestAnimationFrame(() => {\n if (\n state.index > 0 &&\n isFocused &&\n !(e as EventArg<'tabPress', true>).defaultPrevented\n ) {\n // When user taps on already focused tab and we're inside the tab,\n // reset the stack to replicate native behaviour\n navigation.dispatch({\n ...StackActions.popToTop(),\n target: state.key,\n });\n }\n });\n }),\n [navigation, state.index, state.key]\n );\n\n return (\n <NativeStackView\n {...rest}\n state={state}\n navigation={navigation}\n descriptors={descriptors}\n />\n );\n}\n\nexport default createNavigatorFactory<\n StackNavigationState<ParamListBase>,\n NativeStackNavigationOptions,\n NativeStackNavigationEventMap,\n typeof NativeStackNavigator\n>(NativeStackNavigator);\n"]}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]}
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = Container;
7
+
8
+ var React = _interopRequireWildcard(require("react"));
9
+
10
+ var _reactNative = require("react-native");
11
+
12
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
13
+
14
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
15
+
16
+ function Container(props) {
17
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
18
+ const {
19
+ stackPresentation: _,
20
+ ...rest
21
+ } = props;
22
+ return /*#__PURE__*/React.createElement(_reactNative.View, rest);
23
+ }
24
+ //# sourceMappingURL=DebugContainer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["DebugContainer.tsx"],"names":["Container","props","stackPresentation","_","rest"],"mappings":";;;;;;;AAAA;;AACA;;;;;;AAQe,SAASA,SAAT,CAAmBC,KAAnB,EAA0C;AACvD;AACA,QAAM;AAAEC,IAAAA,iBAAiB,EAAEC,CAArB;AAAwB,OAAGC;AAA3B,MAAoCH,KAA1C;AACA,sBAAO,oBAAC,iBAAD,EAAUG,IAAV,CAAP;AACD","sourcesContent":["import * as React from 'react';\nimport { View, ViewProps } from 'react-native';\nimport type { StackPresentationTypes } from 'react-native-screens';\n\ntype ContainerProps = ViewProps & {\n stackPresentation: StackPresentationTypes;\n children: React.ReactNode;\n};\n\nexport default function Container(props: ContainerProps) {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { stackPresentation: _, ...rest } = props;\n return <View {...rest} />;\n}\n"]}
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var React = _interopRequireWildcard(require("react"));
9
+
10
+ var _reactNative = require("react-native");
11
+
12
+ var _AppContainer = _interopRequireDefault(require("react-native/Libraries/ReactNative/AppContainer"));
13
+
14
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
+
16
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
17
+
18
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
19
+
20
+ // @ts-ignore Getting private component
21
+ let Container = _reactNative.View;
22
+
23
+ if (process.env.NODE_ENV !== 'production') {
24
+ const DebugContainer = props => {
25
+ const {
26
+ stackPresentation,
27
+ ...rest
28
+ } = props;
29
+
30
+ if (_reactNative.Platform.OS === 'ios' && stackPresentation !== 'push') {
31
+ // This is necessary for LogBox
32
+ return /*#__PURE__*/React.createElement(_AppContainer.default, null, /*#__PURE__*/React.createElement(_reactNative.View, rest));
33
+ }
34
+
35
+ return /*#__PURE__*/React.createElement(_reactNative.View, rest);
36
+ };
37
+
38
+ Container = DebugContainer;
39
+ }
40
+
41
+ var _default = Container;
42
+ exports.default = _default;
43
+ //# sourceMappingURL=DebugContainer.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["DebugContainer.native.tsx"],"names":["Container","View","process","env","NODE_ENV","DebugContainer","props","stackPresentation","rest","Platform","OS"],"mappings":";;;;;;;AAAA;;AACA;;AAEA;;;;;;;;AADA;AASA,IAAIA,SAAS,GAAGC,iBAAhB;;AAEA,IAAIC,OAAO,CAACC,GAAR,CAAYC,QAAZ,KAAyB,YAA7B,EAA2C;AACzC,QAAMC,cAAc,GAAIC,KAAD,IAA2B;AAChD,UAAM;AAAEC,MAAAA,iBAAF;AAAqB,SAAGC;AAAxB,QAAiCF,KAAvC;;AAEA,QAAIG,sBAASC,EAAT,KAAgB,KAAhB,IAAyBH,iBAAiB,KAAK,MAAnD,EAA2D;AACzD;AACA,0BACE,oBAAC,qBAAD,qBACE,oBAAC,iBAAD,EAAUC,IAAV,CADF,CADF;AAKD;;AAED,wBAAO,oBAAC,iBAAD,EAAUA,IAAV,CAAP;AACD,GAbD;;AAeAR,EAAAA,SAAS,GAAGK,cAAZ;AACD;;eAEcL,S","sourcesContent":["import * as React from 'react';\nimport { Platform, View, ViewProps } from 'react-native';\n// @ts-ignore Getting private component\nimport AppContainer from 'react-native/Libraries/ReactNative/AppContainer';\nimport type { StackPresentationTypes } from 'react-native-screens';\n\ntype ContainerProps = ViewProps & {\n stackPresentation: StackPresentationTypes;\n children: React.ReactNode;\n};\n\nlet Container = View as unknown as React.ComponentType<ContainerProps>;\n\nif (process.env.NODE_ENV !== 'production') {\n const DebugContainer = (props: ContainerProps) => {\n const { stackPresentation, ...rest } = props;\n\n if (Platform.OS === 'ios' && stackPresentation !== 'push') {\n // This is necessary for LogBox\n return (\n <AppContainer>\n <View {...rest} />\n </AppContainer>\n );\n }\n\n return <View {...rest} />;\n };\n\n Container = DebugContainer;\n}\n\nexport default Container;\n"]}
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.processFonts = processFonts;
7
+
8
+ function processFonts(_) {
9
+ throw new Error('Not supported on Web');
10
+ }
11
+ //# sourceMappingURL=FontProcessor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["FontProcessor.tsx"],"names":["processFonts","_","Error"],"mappings":";;;;;;;AAAO,SAASA,YAAT,CACLC,CADK,EAEmB;AACxB,QAAM,IAAIC,KAAJ,CAAU,sBAAV,CAAN;AACD","sourcesContent":["export function processFonts(\n _: (string | undefined)[]\n): (string | undefined)[] {\n throw new Error('Not supported on Web');\n}\n"]}
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.processFonts = processFonts;
7
+
8
+ var _ReactNativeStyleAttributes = _interopRequireDefault(require("react-native/Libraries/Components/View/ReactNativeStyleAttributes"));
9
+
10
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
+
12
+ // @ts-ignore: No declaration available
13
+ function processFonts(fontFamilies) {
14
+ var _ReactNativeStyleAttr;
15
+
16
+ // @ts-ignore: React Native types are incorrect here and don't consider fontFamily a style value
17
+ const fontFamilyProcessor = (_ReactNativeStyleAttr = _ReactNativeStyleAttributes.default.fontFamily) === null || _ReactNativeStyleAttr === void 0 ? void 0 : _ReactNativeStyleAttr.process;
18
+
19
+ if (typeof fontFamilyProcessor === 'function') {
20
+ return fontFamilies.map(fontFamilyProcessor);
21
+ }
22
+
23
+ return fontFamilies;
24
+ }
25
+ //# sourceMappingURL=FontProcessor.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["FontProcessor.native.tsx"],"names":["processFonts","fontFamilies","fontFamilyProcessor","ReactNativeStyleAttributes","fontFamily","process","map"],"mappings":";;;;;;;AACA;;;;AADA;AAGO,SAASA,YAAT,CACLC,YADK,EAEmB;AAAA;;AACxB;AACA,QAAMC,mBAAmB,4BAAGC,oCAA2BC,UAA9B,0DAAG,sBAAuCC,OAAnE;;AACA,MAAI,OAAOH,mBAAP,KAA+B,UAAnC,EAA+C;AAC7C,WAAOD,YAAY,CAACK,GAAb,CAAiBJ,mBAAjB,CAAP;AACD;;AACD,SAAOD,YAAP;AACD","sourcesContent":["// @ts-ignore: No declaration available\nimport ReactNativeStyleAttributes from 'react-native/Libraries/Components/View/ReactNativeStyleAttributes';\n\nexport function processFonts(\n fontFamilies: (string | undefined)[]\n): (string | undefined)[] {\n // @ts-ignore: React Native types are incorrect here and don't consider fontFamily a style value\n const fontFamilyProcessor = ReactNativeStyleAttributes.fontFamily?.process;\n if (typeof fontFamilyProcessor === 'function') {\n return fontFamilies.map(fontFamilyProcessor);\n }\n return fontFamilies;\n}\n"]}
@@ -0,0 +1,157 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = HeaderConfig;
7
+
8
+ var _elements = require("@react-navigation/elements");
9
+
10
+ var _native = require("@react-navigation/native");
11
+
12
+ var React = _interopRequireWildcard(require("react"));
13
+
14
+ var _reactNative = require("react-native");
15
+
16
+ var _reactNativeSafeAreaContext = require("react-native-safe-area-context");
17
+
18
+ var _reactNativeScreens = require("react-native-screens");
19
+
20
+ var _FontProcessor = require("./FontProcessor");
21
+
22
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
23
+
24
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
25
+
26
+ function HeaderConfig({
27
+ headerBackImageSource,
28
+ headerBackButtonMenuEnabled,
29
+ headerBackTitle,
30
+ headerBackTitleStyle,
31
+ headerBackTitleVisible = true,
32
+ headerBackVisible,
33
+ headerShadowVisible,
34
+ headerLargeStyle,
35
+ headerLargeTitle,
36
+ headerLargeTitleShadowVisible,
37
+ headerLargeTitleStyle,
38
+ headerLeft,
39
+ headerRight,
40
+ headerShown,
41
+ headerStyle,
42
+ headerBlurEffect,
43
+ headerTintColor,
44
+ headerTitle,
45
+ headerTitleAlign,
46
+ headerTitleStyle,
47
+ headerTransparent,
48
+ headerSearchBarOptions,
49
+ route,
50
+ title,
51
+ canGoBack
52
+ }) {
53
+ var _ref, _headerTitleStyleFlat, _headerStyleFlattened;
54
+
55
+ const insets = (0, _reactNativeSafeAreaContext.useSafeAreaInsets)();
56
+ const {
57
+ colors
58
+ } = (0, _native.useTheme)();
59
+ const tintColor = (headerTintColor !== null && headerTintColor !== void 0 ? headerTintColor : _reactNative.Platform.OS === 'ios') ? colors.primary : colors.text;
60
+ const headerBackTitleStyleFlattened = _reactNative.StyleSheet.flatten(headerBackTitleStyle) || {};
61
+ const headerLargeTitleStyleFlattened = _reactNative.StyleSheet.flatten(headerLargeTitleStyle) || {};
62
+ const headerTitleStyleFlattened = _reactNative.StyleSheet.flatten(headerTitleStyle) || {};
63
+ const headerStyleFlattened = _reactNative.StyleSheet.flatten(headerStyle) || {};
64
+ const headerLargeStyleFlattened = _reactNative.StyleSheet.flatten(headerLargeStyle) || {};
65
+ const [backTitleFontFamily, largeTitleFontFamily, titleFontFamily] = (0, _FontProcessor.processFonts)([headerBackTitleStyleFlattened.fontFamily, headerLargeTitleStyleFlattened.fontFamily, headerTitleStyleFlattened.fontFamily]);
66
+ const titleText = title !== undefined ? title : route.name;
67
+ const titleColor = (_ref = (_headerTitleStyleFlat = headerTitleStyleFlattened.color) !== null && _headerTitleStyleFlat !== void 0 ? _headerTitleStyleFlat : headerTintColor) !== null && _ref !== void 0 ? _ref : colors.text;
68
+ const titleFontSize = headerTitleStyleFlattened.fontSize;
69
+ const titleFontWeight = headerTitleStyleFlattened.fontWeight;
70
+ const headerTitleStyleSupported = {
71
+ color: titleColor
72
+ };
73
+
74
+ if (headerTitleStyleFlattened.fontFamily != null) {
75
+ headerTitleStyleSupported.fontFamily = headerTitleStyleFlattened.fontFamily;
76
+ }
77
+
78
+ if (titleFontSize != null) {
79
+ headerTitleStyleSupported.fontSize = titleFontSize;
80
+ }
81
+
82
+ if (titleFontWeight != null) {
83
+ headerTitleStyleSupported.fontWeight = titleFontWeight;
84
+ }
85
+
86
+ const headerLeftElement = headerLeft === null || headerLeft === void 0 ? void 0 : headerLeft({
87
+ tintColor,
88
+ label: headerBackTitle,
89
+ canGoBack
90
+ });
91
+ const headerRightElement = headerRight === null || headerRight === void 0 ? void 0 : headerRight({
92
+ tintColor
93
+ });
94
+ const headerTitleElement = typeof headerTitle === 'function' ? headerTitle({
95
+ tintColor,
96
+ children: titleText
97
+ }) : null;
98
+
99
+ if (_reactNative.Platform.OS === 'ios' && headerSearchBarOptions != null && _reactNativeScreens.SearchBar == null) {
100
+ throw new Error(`The current version of 'react-native-screens' doesn't support SearchBar in the header. Please update to the latest version to use this option.`);
101
+ }
102
+ /**
103
+ * We need to set this in if:
104
+ * - Back button should stay visible when `headerLeft` is specified
105
+ * - If `headerTitle` for Android is specified, so we only need to remove the title and keep the back button
106
+ */
107
+
108
+
109
+ const backButtonInCustomView = headerBackVisible ? headerLeftElement != null : _reactNative.Platform.OS === 'android' && headerTitleElement != null;
110
+ return /*#__PURE__*/React.createElement(_reactNativeScreens.ScreenStackHeaderConfig, {
111
+ backButtonInCustomView: backButtonInCustomView,
112
+ backgroundColor: (_headerStyleFlattened = headerStyleFlattened.backgroundColor) !== null && _headerStyleFlattened !== void 0 ? _headerStyleFlattened : headerTransparent ? 'transparent' : colors.card,
113
+ backTitle: headerBackTitleVisible ? headerBackTitle : ' ',
114
+ backTitleFontFamily: backTitleFontFamily,
115
+ backTitleFontSize: headerBackTitleStyleFlattened.fontSize,
116
+ blurEffect: headerBlurEffect,
117
+ color: tintColor,
118
+ direction: _reactNative.I18nManager.isRTL ? 'rtl' : 'ltr',
119
+ disableBackButtonMenu: headerBackButtonMenuEnabled === false,
120
+ hidden: headerShown === false,
121
+ hideBackButton: headerBackVisible === false,
122
+ hideShadow: headerShadowVisible === false,
123
+ largeTitle: headerLargeTitle,
124
+ largeTitleBackgroundColor: headerLargeStyleFlattened.backgroundColor,
125
+ largeTitleColor: headerLargeTitleStyleFlattened.color,
126
+ largeTitleFontFamily: largeTitleFontFamily,
127
+ largeTitleFontSize: headerLargeTitleStyleFlattened.fontSize,
128
+ largeTitleFontWeight: headerLargeTitleStyleFlattened.fontWeight,
129
+ largeTitleHideShadow: headerLargeTitleShadowVisible === false,
130
+ title: typeof headerTitle === 'string' ? headerTitle : titleText,
131
+ titleColor: titleColor,
132
+ titleFontFamily: titleFontFamily,
133
+ titleFontSize: titleFontSize,
134
+ titleFontWeight: titleFontWeight,
135
+ topInsetEnabled: insets.top !== 0,
136
+ translucent: // This defaults to `true`, so we can't pass `undefined`
137
+ headerTransparent === true
138
+ }, _reactNative.Platform.OS === 'ios' ? /*#__PURE__*/React.createElement(React.Fragment, null, headerLeftElement != null ? /*#__PURE__*/React.createElement(_reactNativeScreens.ScreenStackHeaderLeftView, null, headerLeftElement) : null, headerTitleElement != null ? /*#__PURE__*/React.createElement(_reactNativeScreens.ScreenStackHeaderCenterView, null, headerTitleElement) : null) : /*#__PURE__*/React.createElement(React.Fragment, null, headerLeftElement != null || typeof headerTitle === 'function' ? /*#__PURE__*/React.createElement(_reactNativeScreens.ScreenStackHeaderLeftView, null, /*#__PURE__*/React.createElement(_reactNative.View, {
139
+ style: styles.row
140
+ }, headerLeftElement, headerTitleAlign !== 'center' ? typeof headerTitle === 'function' ? headerTitleElement : /*#__PURE__*/React.createElement(_elements.HeaderTitle, {
141
+ tintColor: tintColor,
142
+ style: headerTitleStyleSupported
143
+ }, titleText) : null)) : null, headerTitleAlign === 'center' ? /*#__PURE__*/React.createElement(_reactNativeScreens.ScreenStackHeaderCenterView, null, typeof headerTitle === 'function' ? headerTitleElement : /*#__PURE__*/React.createElement(_elements.HeaderTitle, {
144
+ tintColor: tintColor,
145
+ style: headerTitleStyleSupported
146
+ }, titleText)) : null), headerBackImageSource !== undefined ? /*#__PURE__*/React.createElement(_reactNativeScreens.ScreenStackHeaderBackButtonImage, {
147
+ source: headerBackImageSource
148
+ }) : null, headerRightElement != null ? /*#__PURE__*/React.createElement(_reactNativeScreens.ScreenStackHeaderRightView, null, headerRightElement) : null, _reactNative.Platform.OS === 'ios' && headerSearchBarOptions != null ? /*#__PURE__*/React.createElement(_reactNativeScreens.ScreenStackHeaderSearchBarView, null, /*#__PURE__*/React.createElement(_reactNativeScreens.SearchBar, headerSearchBarOptions)) : null);
149
+ }
150
+
151
+ const styles = _reactNative.StyleSheet.create({
152
+ row: {
153
+ flexDirection: 'row',
154
+ alignItems: 'center'
155
+ }
156
+ });
157
+ //# sourceMappingURL=HeaderConfig.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["HeaderConfig.tsx"],"names":["HeaderConfig","headerBackImageSource","headerBackButtonMenuEnabled","headerBackTitle","headerBackTitleStyle","headerBackTitleVisible","headerBackVisible","headerShadowVisible","headerLargeStyle","headerLargeTitle","headerLargeTitleShadowVisible","headerLargeTitleStyle","headerLeft","headerRight","headerShown","headerStyle","headerBlurEffect","headerTintColor","headerTitle","headerTitleAlign","headerTitleStyle","headerTransparent","headerSearchBarOptions","route","title","canGoBack","insets","colors","tintColor","Platform","OS","primary","text","headerBackTitleStyleFlattened","StyleSheet","flatten","headerLargeTitleStyleFlattened","headerTitleStyleFlattened","headerStyleFlattened","headerLargeStyleFlattened","backTitleFontFamily","largeTitleFontFamily","titleFontFamily","fontFamily","titleText","undefined","name","titleColor","color","titleFontSize","fontSize","titleFontWeight","fontWeight","headerTitleStyleSupported","headerLeftElement","label","headerRightElement","headerTitleElement","children","SearchBar","Error","backButtonInCustomView","backgroundColor","card","I18nManager","isRTL","top","styles","row","create","flexDirection","alignItems"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;AAOA;;AACA;;AAWA;;;;;;AAOe,SAASA,YAAT,CAAsB;AACnCC,EAAAA,qBADmC;AAEnCC,EAAAA,2BAFmC;AAGnCC,EAAAA,eAHmC;AAInCC,EAAAA,oBAJmC;AAKnCC,EAAAA,sBAAsB,GAAG,IALU;AAMnCC,EAAAA,iBANmC;AAOnCC,EAAAA,mBAPmC;AAQnCC,EAAAA,gBARmC;AASnCC,EAAAA,gBATmC;AAUnCC,EAAAA,6BAVmC;AAWnCC,EAAAA,qBAXmC;AAYnCC,EAAAA,UAZmC;AAanCC,EAAAA,WAbmC;AAcnCC,EAAAA,WAdmC;AAenCC,EAAAA,WAfmC;AAgBnCC,EAAAA,gBAhBmC;AAiBnCC,EAAAA,eAjBmC;AAkBnCC,EAAAA,WAlBmC;AAmBnCC,EAAAA,gBAnBmC;AAoBnCC,EAAAA,gBApBmC;AAqBnCC,EAAAA,iBArBmC;AAsBnCC,EAAAA,sBAtBmC;AAuBnCC,EAAAA,KAvBmC;AAwBnCC,EAAAA,KAxBmC;AAyBnCC,EAAAA;AAzBmC,CAAtB,EA0BQ;AAAA;;AACrB,QAAMC,MAAM,GAAG,oDAAf;AACA,QAAM;AAAEC,IAAAA;AAAF,MAAa,uBAAnB;AACA,QAAMC,SAAS,GACb,CAAAX,eAAe,SAAf,IAAAA,eAAe,WAAf,GAAAA,eAAe,GAAIY,sBAASC,EAAT,KAAgB,KAAnC,IAA2CH,MAAM,CAACI,OAAlD,GAA4DJ,MAAM,CAACK,I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GACEuC,kBADF,gBAGE,oBAAC,qBAAD;AACE,IAAA,SAAS,EAAE7B,SADb;AAEE,IAAA,KAAK,EAAEyB;AAFT,KAIGT,SAJH,CAJH,GAWG,IAbN,CADF,CADD,GAkBG,IAnBN,EAoBGzB,gBAAgB,KAAK,QAArB,gBACC,oBAAC,+CAAD,QACG,OAAOD,WAAP,KAAuB,UAAvB,GACCuC,kBADD,gBAGC,oBAAC,qBAAD;AACE,IAAA,SAAS,EAAE7B,SADb;AAEE,IAAA,KAAK,EAAEyB;AAFT,KAIGT,SAJH,CAJJ,CADD,GAaG,IAjCN,CAhDJ,EAoFG3C,qBAAqB,KAAK4C,SAA1B,gBACC,oBAAC,oDAAD;AAAkC,IAAA,MAAM,EAAE5C;AAA1C,IADD,GAEG,IAtFN,EAuFGuD,kBAAkB,IAAI,IAAtB,gBACC,oBAAC,8CAAD,QACGA,kBADH,CADD,GAIG,IA3FN,EA4FG3B,sBAASC,EAAT,KAAgB,KAAhB,IAAyBR,sBAAsB,IAAI,IAAnD,gBACC,oBAAC,kDAAD,qBACE,oBAAC,6BAAD,EAAeA,sBAAf,CADF,CADD,GAIG,IAhGN,CADF;AAoGD;;AAED,MAAM6C,MAAM,GAAGjC,wBAAWmC,MAAX,CAAkB;AAC/BD,EAAAA,GAAG,EAAE;AACHE,IAAAA,aAAa,EAAE,KADZ;AAEHC,IAAAA,UAAU,EAAE;AAFT;AAD0B,CAAlB,CAAf","sourcesContent":["import { HeaderTitle } from '@react-navigation/elements';\nimport { Route, useTheme } from '@react-navigation/native';\nimport * as React from 'react';\nimport {\n I18nManager,\n Platform,\n StyleSheet,\n TextStyle,\n View,\n} from 'react-native';\nimport { useSafeAreaInsets } from 'react-native-safe-area-context';\nimport {\n ScreenStackHeaderBackButtonImage,\n ScreenStackHeaderCenterView,\n ScreenStackHeaderConfig,\n ScreenStackHeaderLeftView,\n ScreenStackHeaderRightView,\n ScreenStackHeaderSearchBarView,\n SearchBar,\n} from 'react-native-screens';\n\nimport type { NativeStackNavigationOptions } from '../types';\nimport { processFonts } from './FontProcessor';\n\ntype Props = NativeStackNavigationOptions & {\n route: Route<string>;\n canGoBack: boolean;\n};\n\nexport default function HeaderConfig({\n headerBackImageSource,\n headerBackButtonMenuEnabled,\n headerBackTitle,\n headerBackTitleStyle,\n headerBackTitleVisible = true,\n headerBackVisible,\n headerShadowVisible,\n headerLargeStyle,\n headerLargeTitle,\n headerLargeTitleShadowVisible,\n headerLargeTitleStyle,\n headerLeft,\n headerRight,\n headerShown,\n headerStyle,\n headerBlurEffect,\n headerTintColor,\n headerTitle,\n headerTitleAlign,\n headerTitleStyle,\n headerTransparent,\n headerSearchBarOptions,\n route,\n title,\n canGoBack,\n}: Props): JSX.Element {\n const insets = useSafeAreaInsets();\n const { colors } = useTheme();\n const tintColor =\n headerTintColor ?? Platform.OS === 'ios' ? colors.primary : colors.text;\n\n const headerBackTitleStyleFlattened =\n StyleSheet.flatten(headerBackTitleStyle) || {};\n const headerLargeTitleStyleFlattened =\n StyleSheet.flatten(headerLargeTitleStyle) || {};\n const headerTitleStyleFlattened = StyleSheet.flatten(headerTitleStyle) || {};\n const headerStyleFlattened = StyleSheet.flatten(headerStyle) || {};\n const headerLargeStyleFlattened = StyleSheet.flatten(headerLargeStyle) || {};\n\n const [backTitleFontFamily, largeTitleFontFamily, titleFontFamily] =\n processFonts([\n headerBackTitleStyleFlattened.fontFamily,\n headerLargeTitleStyleFlattened.fontFamily,\n headerTitleStyleFlattened.fontFamily,\n ]);\n\n const titleText = title !== undefined ? title : route.name;\n const titleColor =\n headerTitleStyleFlattened.color ?? headerTintColor ?? colors.text;\n const titleFontSize = headerTitleStyleFlattened.fontSize;\n const titleFontWeight = headerTitleStyleFlattened.fontWeight;\n\n const headerTitleStyleSupported: TextStyle = { color: titleColor };\n\n if (headerTitleStyleFlattened.fontFamily != null) {\n headerTitleStyleSupported.fontFamily = headerTitleStyleFlattened.fontFamily;\n }\n\n if (titleFontSize != null) {\n headerTitleStyleSupported.fontSize = titleFontSize;\n }\n\n if (titleFontWeight != null) {\n headerTitleStyleSupported.fontWeight = titleFontWeight;\n }\n\n const headerLeftElement = headerLeft?.({\n tintColor,\n label: headerBackTitle,\n canGoBack,\n });\n const headerRightElement = headerRight?.({ tintColor });\n const headerTitleElement =\n typeof headerTitle === 'function'\n ? headerTitle({ tintColor, children: titleText })\n : null;\n\n if (\n Platform.OS === 'ios' &&\n headerSearchBarOptions != null &&\n SearchBar == null\n ) {\n throw new Error(\n `The current version of 'react-native-screens' doesn't support SearchBar in the header. Please update to the latest version to use this option.`\n );\n }\n\n /**\n * We need to set this in if:\n * - Back button should stay visible when `headerLeft` is specified\n * - If `headerTitle` for Android is specified, so we only need to remove the title and keep the back button\n */\n const backButtonInCustomView = headerBackVisible\n ? headerLeftElement != null\n : Platform.OS === 'android' && headerTitleElement != null;\n\n return (\n <ScreenStackHeaderConfig\n backButtonInCustomView={backButtonInCustomView}\n backgroundColor={\n headerStyleFlattened.backgroundColor ??\n (headerTransparent ? 'transparent' : colors.card)\n }\n backTitle={headerBackTitleVisible ? headerBackTitle : ' '}\n backTitleFontFamily={backTitleFontFamily}\n backTitleFontSize={headerBackTitleStyleFlattened.fontSize}\n blurEffect={headerBlurEffect}\n color={tintColor}\n direction={I18nManager.isRTL ? 'rtl' : 'ltr'}\n disableBackButtonMenu={headerBackButtonMenuEnabled === false}\n hidden={headerShown === false}\n hideBackButton={headerBackVisible === false}\n hideShadow={headerShadowVisible === false}\n largeTitle={headerLargeTitle}\n largeTitleBackgroundColor={headerLargeStyleFlattened.backgroundColor}\n largeTitleColor={headerLargeTitleStyleFlattened.color}\n largeTitleFontFamily={largeTitleFontFamily}\n largeTitleFontSize={headerLargeTitleStyleFlattened.fontSize}\n largeTitleFontWeight={headerLargeTitleStyleFlattened.fontWeight}\n largeTitleHideShadow={headerLargeTitleShadowVisible === false}\n title={typeof headerTitle === 'string' ? headerTitle : titleText}\n titleColor={titleColor}\n titleFontFamily={titleFontFamily}\n titleFontSize={titleFontSize}\n titleFontWeight={titleFontWeight}\n topInsetEnabled={insets.top !== 0}\n translucent={\n // This defaults to `true`, so we can't pass `undefined`\n headerTransparent === true\n }\n >\n {Platform.OS === 'ios' ? (\n <>\n {headerLeftElement != null ? (\n <ScreenStackHeaderLeftView>\n {headerLeftElement}\n </ScreenStackHeaderLeftView>\n ) : null}\n {headerTitleElement != null ? (\n <ScreenStackHeaderCenterView>\n {headerTitleElement}\n </ScreenStackHeaderCenterView>\n ) : null}\n </>\n ) : (\n <>\n {headerLeftElement != null || typeof headerTitle === 'function' ? (\n <ScreenStackHeaderLeftView>\n <View style={styles.row}>\n {headerLeftElement}\n {headerTitleAlign !== 'center' ? (\n typeof headerTitle === 'function' ? (\n headerTitleElement\n ) : (\n <HeaderTitle\n tintColor={tintColor}\n style={headerTitleStyleSupported}\n >\n {titleText}\n </HeaderTitle>\n )\n ) : null}\n </View>\n </ScreenStackHeaderLeftView>\n ) : null}\n {headerTitleAlign === 'center' ? (\n <ScreenStackHeaderCenterView>\n {typeof headerTitle === 'function' ? (\n headerTitleElement\n ) : (\n <HeaderTitle\n tintColor={tintColor}\n style={headerTitleStyleSupported}\n >\n {titleText}\n </HeaderTitle>\n )}\n </ScreenStackHeaderCenterView>\n ) : null}\n </>\n )}\n {headerBackImageSource !== undefined ? (\n <ScreenStackHeaderBackButtonImage source={headerBackImageSource} />\n ) : null}\n {headerRightElement != null ? (\n <ScreenStackHeaderRightView>\n {headerRightElement}\n </ScreenStackHeaderRightView>\n ) : null}\n {Platform.OS === 'ios' && headerSearchBarOptions != null ? (\n <ScreenStackHeaderSearchBarView>\n <SearchBar {...headerSearchBarOptions} />\n </ScreenStackHeaderSearchBarView>\n ) : null}\n </ScreenStackHeaderConfig>\n );\n}\n\nconst styles = StyleSheet.create({\n row: {\n flexDirection: 'row',\n alignItems: 'center',\n },\n});\n"]}
@@ -0,0 +1,133 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = NativeStackView;
7
+
8
+ var _elements = require("@react-navigation/elements");
9
+
10
+ var React = _interopRequireWildcard(require("react"));
11
+
12
+ var _reactNative = require("react-native");
13
+
14
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
15
+
16
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
17
+
18
+ function NativeStackView({
19
+ state,
20
+ descriptors
21
+ }) {
22
+ return /*#__PURE__*/React.createElement(_elements.SafeAreaProviderCompat, null, /*#__PURE__*/React.createElement(_reactNative.View, {
23
+ style: styles.container
24
+ }, state.routes.map((route, i) => {
25
+ var _state$routes;
26
+
27
+ const isFocused = state.index === i;
28
+ const canGoBack = i !== 0;
29
+ const previousKey = (_state$routes = state.routes[i - 1]) === null || _state$routes === void 0 ? void 0 : _state$routes.key;
30
+ const previousDescriptor = previousKey ? descriptors[previousKey] : undefined;
31
+ const {
32
+ options,
33
+ navigation,
34
+ render
35
+ } = descriptors[route.key];
36
+ const {
37
+ header,
38
+ headerShown,
39
+ headerTintColor,
40
+ headerBackImageSource,
41
+ headerLeft,
42
+ headerRight,
43
+ headerTitle,
44
+ headerTitleAlign,
45
+ headerTitleStyle,
46
+ headerStyle,
47
+ headerShadowVisible,
48
+ headerTransparent,
49
+ contentStyle,
50
+ headerBackTitle
51
+ } = options;
52
+ return /*#__PURE__*/React.createElement(_elements.Screen, {
53
+ key: route.key,
54
+ focused: isFocused,
55
+ route: route,
56
+ navigation: navigation,
57
+ headerShown: headerShown,
58
+ headerTransparent: headerTransparent,
59
+ header: header !== undefined ? header({
60
+ back: previousDescriptor ? {
61
+ title: (0, _elements.getHeaderTitle)(previousDescriptor.options, previousDescriptor.route.name)
62
+ } : undefined,
63
+ options,
64
+ route,
65
+ navigation
66
+ }) : /*#__PURE__*/React.createElement(_elements.Header, {
67
+ title: (0, _elements.getHeaderTitle)(options, route.name),
68
+ headerTintColor: headerTintColor,
69
+ headerLeft: typeof headerLeft === 'function' ? ({
70
+ tintColor
71
+ }) => headerLeft({
72
+ tintColor,
73
+ canGoBack,
74
+ label: headerBackTitle
75
+ }) : headerLeft === undefined && canGoBack ? ({
76
+ tintColor
77
+ }) => /*#__PURE__*/React.createElement(_elements.HeaderBackButton, {
78
+ tintColor: tintColor,
79
+ backImage: headerBackImageSource !== undefined ? () => /*#__PURE__*/React.createElement(_reactNative.Image, {
80
+ source: headerBackImageSource,
81
+ style: [styles.backImage, {
82
+ tintColor
83
+ }]
84
+ }) : undefined,
85
+ onPress: navigation.goBack,
86
+ canGoBack: canGoBack
87
+ }) : headerLeft,
88
+ headerRight: typeof headerRight === 'function' ? ({
89
+ tintColor
90
+ }) => headerRight({
91
+ tintColor
92
+ }) : headerRight,
93
+ headerTitle: typeof headerTitle === 'function' ? ({
94
+ children,
95
+ tintColor
96
+ }) => headerTitle({
97
+ children,
98
+ tintColor
99
+ }) : headerTitle,
100
+ headerTitleAlign: headerTitleAlign,
101
+ headerTitleStyle: headerTitleStyle,
102
+ headerStyle: [headerTransparent ? {
103
+ position: 'absolute',
104
+ backgroundColor: 'transparent'
105
+ } : null, headerStyle, headerShadowVisible === false ? {
106
+ shadowOpacity: 0,
107
+ borderBottomWidth: 0
108
+ } : null]
109
+ }),
110
+ style: [_reactNative.StyleSheet.absoluteFill, {
111
+ display: isFocused ? 'flex' : 'none'
112
+ }]
113
+ }, /*#__PURE__*/React.createElement(_reactNative.View, {
114
+ style: [styles.contentContainer, contentStyle]
115
+ }, render()));
116
+ })));
117
+ }
118
+
119
+ const styles = _reactNative.StyleSheet.create({
120
+ container: {
121
+ flex: 1
122
+ },
123
+ contentContainer: {
124
+ flex: 1
125
+ },
126
+ backImage: {
127
+ height: 24,
128
+ width: 24,
129
+ margin: 3,
130
+ resizeMode: 'contain'
131
+ }
132
+ });
133
+ //# sourceMappingURL=NativeStackView.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["NativeStackView.tsx"],"names":["NativeStackView","state","descriptors","styles","container","routes","map","route","i","isFocused","index","canGoBack","previousKey","key","previousDescriptor","undefined","options","navigation","render","header","headerShown","headerTintColor","headerBackImageSource","headerLeft","headerRight","headerTitle","headerTitleAlign","headerTitleStyle","headerStyle","headerShadowVisible","headerTransparent","contentStyle","headerBackTitle","back","title","name","tintColor","label","backImage","goBack","children","position","backgroundColor","shadowOpacity","borderBottomWidth","StyleSheet","absoluteFill","display","contentContainer","create","flex","height","width","margin","resizeMode"],"mappings":";;;;;;;AAAA;;AAWA;;AACA;;;;;;AAee,SAASA,eAAT,CAAyB;AAAEC,EAAAA,KAAF;AAASC,EAAAA;AAAT,CAAzB,EAAwD;AACrE,sBACE,oBAAC,gCAAD,qBACE,oBAAC,iBAAD;AAAM,IAAA,KAAK,EAAEC,MAAM,CAACC;AAApB,KACGH,KAAK,CAACI,MAAN,CAAaC,GAAb,CAAiB,CAACC,KAAD,EAAQC,CAAR,KAAc;AAAA;;AAC9B,UAAMC,SAAS,GAAGR,KAAK,CAACS,KAAN,KAAgBF,CAAlC;AACA,UAAMG,SAAS,GAAGH,CAAC,KAAK,CAAxB;AACA,UAAMI,WAAW,oBAAGX,KAAK,CAACI,MAAN,CAAaG,CAAC,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AAa,EAAE,CAAjB;AAAoBC,UAAAA,iBAAiB,EAAE;AAAvC,SADJ,GAEI,IAVO;AA/Cf,QAvBN;AAqFE,MAAA,KAAK,EAAE,CACLC,wBAAWC,YADN,EAEL;AAAEC,QAAAA,OAAO,EAAEtC,SAAS,GAAG,MAAH,GAAY;AAAhC,OAFK;AArFT,oBA0FE,oBAAC,iBAAD;AAAM,MAAA,KAAK,EAAE,CAACN,MAAM,CAAC6C,gBAAR,EAA0BjB,YAA1B;AAAb,OACGb,MAAM,EADT,CA1FF,CADF;AAgGD,GA1HA,CADH,CADF,CADF;AAiID;;AAED,MAAMf,MAAM,GAAG0C,wBAAWI,MAAX,CAAkB;AAC/B7C,EAAAA,SAAS,EAAE;AACT8C,IAAAA,IAAI,EAAE;AADG,GADoB;AAI/BF,EAAAA,gBAAgB,EAAE;AAChBE,IAAAA,IAAI,EAAE;AADU,GAJa;AAO/BZ,EAAAA,SAAS,EAAE;AACTa,IAAAA,MAAM,EAAE,EADC;AAETC,IAAAA,KAAK,EAAE,EAFE;AAGTC,IAAAA,MAAM,EAAE,CAHC;AAITC,IAAAA,UAAU,EAAE;AAJH;AAPoB,CAAlB,CAAf","sourcesContent":["import {\n getHeaderTitle,\n Header,\n HeaderBackButton,\n SafeAreaProviderCompat,\n Screen,\n} from '@react-navigation/elements';\nimport type {\n ParamListBase,\n StackNavigationState,\n} from '@react-navigation/native';\nimport * as React from 'react';\nimport { Image, StyleSheet, View } from 'react-native';\n\nimport type {\n NativeStackDescriptorMap,\n NativeStackNavigationHelpers,\n} from '../types';\n\ntype Props = {\n state: StackNavigationState<ParamListBase>;\n // This is used for the native implementation of the stack.\n // eslint-disable-next-line react/no-unused-prop-types\n navigation: NativeStackNavigationHelpers;\n descriptors: NativeStackDescriptorMap;\n};\n\nexport default function NativeStackView({ state, descriptors }: Props) {\n return (\n <SafeAreaProviderCompat>\n <View style={styles.container}>\n {state.routes.map((route, i) => {\n const isFocused = state.index === i;\n const canGoBack = i !== 0;\n const previousKey = state.routes[i - 1]?.key;\n const previousDescriptor = previousKey\n ? descriptors[previousKey]\n : undefined;\n const { options, navigation, render } = descriptors[route.key];\n\n const {\n header,\n headerShown,\n headerTintColor,\n headerBackImageSource,\n headerLeft,\n headerRight,\n headerTitle,\n headerTitleAlign,\n headerTitleStyle,\n headerStyle,\n headerShadowVisible,\n headerTransparent,\n contentStyle,\n headerBackTitle,\n } = options;\n\n return (\n <Screen\n key={route.key}\n focused={isFocused}\n route={route}\n navigation={navigation}\n headerShown={headerShown}\n headerTransparent={headerTransparent}\n header={\n header !== undefined ? (\n header({\n back: previousDescriptor\n ? {\n title: getHeaderTitle(\n previousDescriptor.options,\n previousDescriptor.route.name\n ),\n }\n : undefined,\n options,\n route,\n navigation,\n })\n ) : (\n <Header\n title={getHeaderTitle(options, route.name)}\n headerTintColor={headerTintColor}\n headerLeft={\n typeof headerLeft === 'function'\n ? ({ tintColor }) =>\n headerLeft({\n tintColor,\n canGoBack,\n label: headerBackTitle,\n })\n : headerLeft === undefined && canGoBack\n ? ({ tintColor }) => (\n <HeaderBackButton\n tintColor={tintColor}\n backImage={\n headerBackImageSource !== undefined\n ? () => (\n <Image\n source={headerBackImageSource}\n style={[\n styles.backImage,\n { tintColor },\n ]}\n />\n )\n : undefined\n }\n onPress={navigation.goBack}\n canGoBack={canGoBack}\n />\n )\n : headerLeft\n }\n headerRight={\n typeof headerRight === 'function'\n ? ({ tintColor }) => headerRight({ tintColor })\n : headerRight\n }\n headerTitle={\n typeof headerTitle === 'function'\n ? ({ children, tintColor }) =>\n headerTitle({ children, tintColor })\n : headerTitle\n }\n headerTitleAlign={headerTitleAlign}\n headerTitleStyle={headerTitleStyle}\n headerStyle={[\n headerTransparent\n ? {\n position: 'absolute',\n backgroundColor: 'transparent',\n }\n : null,\n headerStyle,\n headerShadowVisible === false\n ? { shadowOpacity: 0, borderBottomWidth: 0 }\n : null,\n ]}\n />\n )\n }\n style={[\n StyleSheet.absoluteFill,\n { display: isFocused ? 'flex' : 'none' },\n ]}\n >\n <View style={[styles.contentContainer, contentStyle]}>\n {render()}\n </View>\n </Screen>\n );\n })}\n </View>\n </SafeAreaProviderCompat>\n );\n}\n\nconst styles = StyleSheet.create({\n container: {\n flex: 1,\n },\n contentContainer: {\n flex: 1,\n },\n backImage: {\n height: 24,\n width: 24,\n margin: 3,\n resizeMode: 'contain',\n },\n});\n"]}