@admin-layout/gluestack-ui-mobile 6.5.1-alpha.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 (199) hide show
  1. package/CHANGELOG.md +117 -0
  2. package/LICENSE +21 -0
  3. package/README.md +4 -0
  4. package/assets/logo.png +0 -0
  5. package/babel.config.js +26 -0
  6. package/jest-react-navigation-setup.js +14 -0
  7. package/jest.config.js +39 -0
  8. package/jest.env.js +2 -0
  9. package/lib/__tests__/prolayout-layout-feature.test.d.ts +1 -0
  10. package/lib/__tests__/prolayout-layout-feature.test.js +202 -0
  11. package/lib/__tests__/prolayout-layout-feature.test.js.map +1 -0
  12. package/lib/components/ApplicationErrorFillWrapper.d.ts +2 -0
  13. package/lib/components/ApplicationErrorFillWrapper.js +7 -0
  14. package/lib/components/ApplicationErrorFillWrapper.js.map +1 -0
  15. package/lib/components/ApplicationErrorHandler.d.ts +2 -0
  16. package/lib/components/ApplicationErrorHandler.js +24 -0
  17. package/lib/components/ApplicationErrorHandler.js.map +1 -0
  18. package/lib/components/ErrorBounday.d.ts +18 -0
  19. package/lib/components/ErrorBounday.js +22 -0
  20. package/lib/components/ErrorBounday.js.map +1 -0
  21. package/lib/components/Fallback.d.ts +6 -0
  22. package/lib/components/Fallback.js +53 -0
  23. package/lib/components/Fallback.js.map +1 -0
  24. package/lib/components/Layout/components/BasicLayout.d.ts +5 -0
  25. package/lib/components/Layout/components/BasicLayout.js +28 -0
  26. package/lib/components/Layout/components/BasicLayout.js.map +1 -0
  27. package/lib/components/Layout/components/BottomTabBar.d.ts +2 -0
  28. package/lib/components/Layout/components/BottomTabBar.js +90 -0
  29. package/lib/components/Layout/components/BottomTabBar.js.map +1 -0
  30. package/lib/components/Layout/components/Drawer.d.ts +2 -0
  31. package/lib/components/Layout/components/Drawer.js +253 -0
  32. package/lib/components/Layout/components/Drawer.js.map +1 -0
  33. package/lib/components/Layout/components/Header.d.ts +2 -0
  34. package/lib/components/Layout/components/Header.js +130 -0
  35. package/lib/components/Layout/components/Header.js.map +1 -0
  36. package/lib/components/Layout/components/Sample.d.ts +2 -0
  37. package/lib/components/Layout/components/Sample.js +7 -0
  38. package/lib/components/Layout/components/Sample.js.map +1 -0
  39. package/lib/components/Layout/components/SettingDrawer/LayoutButton.d.ts +3 -0
  40. package/lib/components/Layout/components/SettingDrawer/LayoutButton.js +66 -0
  41. package/lib/components/Layout/components/SettingDrawer/LayoutButton.js.map +1 -0
  42. package/lib/components/Layout/components/SettingDrawer/SettingDrawer.d.ts +2 -0
  43. package/lib/components/Layout/components/SettingDrawer/SettingDrawer.js +23 -0
  44. package/lib/components/Layout/components/SettingDrawer/SettingDrawer.js.map +1 -0
  45. package/lib/components/Layout/components/SettingDrawer/ThemeColorButton.d.ts +3 -0
  46. package/lib/components/Layout/components/SettingDrawer/ThemeColorButton.js +24 -0
  47. package/lib/components/Layout/components/SettingDrawer/ThemeColorButton.js.map +1 -0
  48. package/lib/components/Layout/components/SettingDrawer/index.d.ts +1 -0
  49. package/lib/components/Layout/components/SettingDrawer/index.js +2 -0
  50. package/lib/components/Layout/components/SettingDrawer/index.js.map +1 -0
  51. package/lib/components/Layout/components/SideBar.d.ts +10 -0
  52. package/lib/components/Layout/components/SideBar.js +59 -0
  53. package/lib/components/Layout/components/SideBar.js.map +1 -0
  54. package/lib/components/Layout/components/defaultSettings.d.ts +4 -0
  55. package/lib/components/Layout/components/defaultSettings.js +16 -0
  56. package/lib/components/Layout/components/defaultSettings.js.map +1 -0
  57. package/lib/components/Layout/components/index.d.ts +4 -0
  58. package/lib/components/Layout/components/index.js +5 -0
  59. package/lib/components/Layout/components/index.js.map +1 -0
  60. package/lib/components/Layout/components/util.d.ts +1 -0
  61. package/lib/components/Layout/components/util.js +15 -0
  62. package/lib/components/Layout/components/util.js.map +1 -0
  63. package/lib/components/Layout/compute.d.ts +6 -0
  64. package/lib/components/Layout/compute.js +316 -0
  65. package/lib/components/Layout/compute.js.map +1 -0
  66. package/lib/components/Layout/compute.test.d.ts +6 -0
  67. package/lib/components/Layout/compute.test.js +120 -0
  68. package/lib/components/Layout/compute.test.js.map +1 -0
  69. package/lib/components/Layout/index.d.ts +4 -0
  70. package/lib/components/Layout/index.js +4 -0
  71. package/lib/components/Layout/index.js.map +1 -0
  72. package/lib/components/Layout/typings.d.ts +1 -0
  73. package/lib/components/Layout/typings.js +2 -0
  74. package/lib/components/Layout/typings.js.map +1 -0
  75. package/lib/components/NavigationComponent.d.ts +15 -0
  76. package/lib/components/NavigationComponent.js +120 -0
  77. package/lib/components/NavigationComponent.js.map +1 -0
  78. package/lib/components/PluginArea.d.ts +2 -0
  79. package/lib/components/PluginArea.js +8 -0
  80. package/lib/components/PluginArea.js.map +1 -0
  81. package/lib/components/ToastAlert.d.ts +12 -0
  82. package/lib/components/ToastAlert.js +17 -0
  83. package/lib/components/ToastAlert.js.map +1 -0
  84. package/lib/components/index.d.ts +9 -0
  85. package/lib/components/index.js +10 -0
  86. package/lib/components/index.js.map +1 -0
  87. package/lib/components/with-interactions-managed.d.ts +2 -0
  88. package/lib/components/with-interactions-managed.js +18 -0
  89. package/lib/components/with-interactions-managed.js.map +1 -0
  90. package/lib/config/config.d.ts +17 -0
  91. package/lib/config/config.js +18 -0
  92. package/lib/config/config.js.map +1 -0
  93. package/lib/config/index.d.ts +1 -0
  94. package/lib/config/index.js +2 -0
  95. package/lib/config/index.js.map +1 -0
  96. package/lib/constants/routes.d.ts +3 -0
  97. package/lib/constants/routes.js +5 -0
  98. package/lib/constants/routes.js.map +1 -0
  99. package/lib/containers/layout/BasicLayout.d.ts +7 -0
  100. package/lib/containers/layout/BasicLayout.js +36 -0
  101. package/lib/containers/layout/BasicLayout.js.map +1 -0
  102. package/lib/containers/layout/DrawerBottomNavigationConfig.d.ts +128 -0
  103. package/lib/containers/layout/DrawerBottomNavigationConfig.js +72 -0
  104. package/lib/containers/layout/DrawerBottomNavigationConfig.js.map +1 -0
  105. package/lib/containers/layout/DrawerConfig.d.ts +85 -0
  106. package/lib/containers/layout/DrawerConfig.js +48 -0
  107. package/lib/containers/layout/DrawerConfig.js.map +1 -0
  108. package/lib/containers/layout/Lifecycle.d.ts +13 -0
  109. package/lib/containers/layout/Lifecycle.js +18 -0
  110. package/lib/containers/layout/Lifecycle.js.map +1 -0
  111. package/lib/containers/layout/ProLayout.d.ts +5 -0
  112. package/lib/containers/layout/ProLayout.js +35 -0
  113. package/lib/containers/layout/ProLayout.js.map +1 -0
  114. package/lib/containers/layout/module.d.ts +5 -0
  115. package/lib/containers/layout/module.js +22 -0
  116. package/lib/containers/layout/module.js.map +1 -0
  117. package/lib/hooks/use-after-interactions.d.ts +6 -0
  118. package/lib/hooks/use-after-interactions.js +29 -0
  119. package/lib/hooks/use-after-interactions.js.map +1 -0
  120. package/lib/hooks/useIsReady.d.ts +2 -0
  121. package/lib/hooks/useIsReady.js +24 -0
  122. package/lib/hooks/useIsReady.js.map +1 -0
  123. package/lib/hooks/useLayoutSetting/index.d.ts +11 -0
  124. package/lib/hooks/useLayoutSetting/index.js +68 -0
  125. package/lib/hooks/useLayoutSetting/index.js.map +1 -0
  126. package/lib/index.d.ts +14 -0
  127. package/lib/index.js +26 -0
  128. package/lib/index.js.map +1 -0
  129. package/lib/interfaces/index.d.ts +1 -0
  130. package/lib/interfaces/index.js +2 -0
  131. package/lib/interfaces/index.js.map +1 -0
  132. package/lib/interfaces/settings.d.ts +4 -0
  133. package/lib/interfaces/settings.js +2 -0
  134. package/lib/interfaces/settings.js.map +1 -0
  135. package/lib/redux/settings.d.ts +80 -0
  136. package/lib/redux/settings.js +16 -0
  137. package/lib/redux/settings.js.map +1 -0
  138. package/lib/utils/ThemeColor.d.ts +8 -0
  139. package/lib/utils/ThemeColor.js +9 -0
  140. package/lib/utils/ThemeColor.js.map +1 -0
  141. package/lib/utils/routeConfigKeyReplace.d.ts +7 -0
  142. package/lib/utils/routeConfigKeyReplace.js +77 -0
  143. package/lib/utils/routeConfigKeyReplace.js.map +1 -0
  144. package/lib/utils/routeConfigKeyReplace.test.d.ts +1 -0
  145. package/lib/utils/routeConfigKeyReplace.test.js +102 -0
  146. package/lib/utils/routeConfigKeyReplace.test.js.map +1 -0
  147. package/package.json +40 -0
  148. package/src/__tests__/prolayout-layout-feature.test.tsx +207 -0
  149. package/src/components/ApplicationErrorFillWrapper.tsx +7 -0
  150. package/src/components/ApplicationErrorHandler.tsx +30 -0
  151. package/src/components/ErrorBounday.tsx +31 -0
  152. package/src/components/Fallback.tsx +65 -0
  153. package/src/components/Layout/README.md +11 -0
  154. package/src/components/Layout/components/BasicLayout.tsx +70 -0
  155. package/src/components/Layout/components/BottomTabBar.tsx +135 -0
  156. package/src/components/Layout/components/Drawer.tsx +412 -0
  157. package/src/components/Layout/components/Header.tsx +195 -0
  158. package/src/components/Layout/components/Sample.tsx +10 -0
  159. package/src/components/Layout/components/SettingDrawer/LayoutButton.tsx +102 -0
  160. package/src/components/Layout/components/SettingDrawer/SettingDrawer.tsx +60 -0
  161. package/src/components/Layout/components/SettingDrawer/ThemeColorButton.tsx +26 -0
  162. package/src/components/Layout/components/SettingDrawer/index.ts +1 -0
  163. package/src/components/Layout/components/SideBar.tsx +109 -0
  164. package/src/components/Layout/components/defaultSettings.ts +19 -0
  165. package/src/components/Layout/components/index.ts +4 -0
  166. package/src/components/Layout/components/util.ts +14 -0
  167. package/src/components/Layout/compute.test.tsx +129 -0
  168. package/src/components/Layout/compute.tsx +384 -0
  169. package/src/components/Layout/eslint.json +1 -0
  170. package/src/components/Layout/index.ts +5 -0
  171. package/src/components/Layout/typings.ts +1 -0
  172. package/src/components/NavigationComponent.tsx +154 -0
  173. package/src/components/PluginArea.tsx +11 -0
  174. package/src/components/ToastAlert.tsx +44 -0
  175. package/src/components/index.ts +9 -0
  176. package/src/components/with-interactions-managed.tsx +33 -0
  177. package/src/config/config.ts +17 -0
  178. package/src/config/index.ts +1 -0
  179. package/src/constants/routes.ts +3 -0
  180. package/src/containers/layout/BasicLayout.tsx +61 -0
  181. package/src/containers/layout/DrawerBottomNavigationConfig.tsx +85 -0
  182. package/src/containers/layout/DrawerConfig.tsx +59 -0
  183. package/src/containers/layout/Lifecycle.tsx +23 -0
  184. package/src/containers/layout/ProLayout.tsx +42 -0
  185. package/src/containers/layout/module.ts +24 -0
  186. package/src/hooks/use-after-interactions.ts +35 -0
  187. package/src/hooks/useIsReady.ts +31 -0
  188. package/src/hooks/useLayoutSetting/index.ts +99 -0
  189. package/src/index.ts +41 -0
  190. package/src/interfaces/index.ts +1 -0
  191. package/src/interfaces/settings.ts +5 -0
  192. package/src/redux/settings.ts +28 -0
  193. package/src/utils/ThemeColor.ts +9 -0
  194. package/src/utils/__snapshots__/routeConfigKeyReplace.test.ts.snap +117 -0
  195. package/src/utils/routeConfigKeyReplace.test.ts +114 -0
  196. package/src/utils/routeConfigKeyReplace.ts +74 -0
  197. package/tsconfig.json +37 -0
  198. package/types.d.ts +11 -0
  199. package/webpack.config.js +104 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,117 @@
1
+ # Change Log
2
+
3
+ All notable changes to this project will be documented in this file.
4
+ See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
+
6
+ ## [6.5.1-alpha.0](https://github.com/cdmbase/admin-layout/compare/v3.0.0-alpha.50...v6.5.1-alpha.0) (2024-04-27)
7
+
8
+ **Note:** Version bump only for package @admin-layout/gluestack-ui-mobile
9
+
10
+ # [3.0.0-alpha.50](https://github.com/CDEBase/admin-layout/compare/v3.0.0-alpha.49...v3.0.0-alpha.50) (2023-02-07)
11
+
12
+ **Note:** Version bump only for package @admin-layout/mobile-layout
13
+
14
+ # [3.0.0-alpha.49](https://github.com/CDEBase/admin-layout/compare/v3.0.0-alpha.48...v3.0.0-alpha.49) (2023-02-06)
15
+
16
+ **Note:** Version bump only for package @admin-layout/mobile-layout
17
+
18
+ # [3.0.0-alpha.47](https://github.com/CDEBase/admin-layout/compare/v3.0.0-alpha.46...v3.0.0-alpha.47) (2023-02-06)
19
+
20
+ **Note:** Version bump only for package @admin-layout/mobile-layout
21
+
22
+ # [3.0.0-alpha.45](https://github.com/CDEBase/admin-layout/compare/v3.0.0-alpha.44...v3.0.0-alpha.45) (2023-02-05)
23
+
24
+ ### Bug Fixes
25
+
26
+ - refactored app error handler for mobile ([556ba7c](https://github.com/CDEBase/admin-layout/commit/556ba7c8452c50cc0dc6e3a1552aea6523e77d7c))
27
+
28
+ # [3.0.0-alpha.44](https://github.com/CDEBase/admin-layout/compare/v3.0.0-alpha.43...v3.0.0-alpha.44) (2023-02-04)
29
+
30
+ **Note:** Version bump only for package @admin-layout/mobile-layout
31
+
32
+ # [3.0.0-alpha.42](https://github.com/CDEBase/admin-layout/compare/v3.0.0-alpha.41...v3.0.0-alpha.42) (2023-01-27)
33
+
34
+ **Note:** Version bump only for package @admin-layout/mobile-layout
35
+
36
+ # [3.0.0-alpha.41](https://github.com/cdmbase/admin-layout/compare/v3.0.0-alpha.40...v3.0.0-alpha.41) (2023-01-27)
37
+
38
+ ### Bug Fixes
39
+
40
+ - trigger locationchange epic only on route change ([098a3d0](https://github.com/cdmbase/admin-layout/commit/098a3d092d562642c6adc7d20af1c8b7bfb9033d))
41
+
42
+ # [3.0.0-alpha.40](https://github.com/CDEBase/admin-layout/compare/v3.0.0-alpha.39...v3.0.0-alpha.40) (2023-01-26)
43
+
44
+ **Note:** Version bump only for package @admin-layout/mobile-layout
45
+
46
+ # [3.0.0-alpha.38](https://github.com/CDEBase/admin-layout/compare/v3.0.0-alpha.37...v3.0.0-alpha.38) (2023-01-23)
47
+
48
+ **Note:** Version bump only for package @admin-layout/mobile-layout
49
+
50
+ # [3.0.0-alpha.34](https://github.com/CDEBase/admin-layout/compare/v3.0.0-alpha.33...v3.0.0-alpha.34) (2023-01-21)
51
+
52
+ **Note:** Version bump only for package @admin-layout/mobile-layout
53
+
54
+ # [3.0.0-alpha.33](https://github.com/CDEBase/admin-layout/compare/v3.0.0-alpha.32...v3.0.0-alpha.33) (2023-01-21)
55
+
56
+ **Note:** Version bump only for package @admin-layout/mobile-layout
57
+
58
+ # [3.0.0-alpha.32](https://github.com/CDEBase/admin-layout/compare/v3.0.0-alpha.31...v3.0.0-alpha.32) (2023-01-21)
59
+
60
+ **Note:** Version bump only for package @admin-layout/mobile-layout
61
+
62
+ # [3.0.0-alpha.30](https://github.com/CDEBase/admin-layout/compare/v2.0.1-alpha.89...v3.0.0-alpha.30) (2023-01-20)
63
+
64
+ # [3.0.0-alpha.28](https://github.com/CDEBase/admin-layout/compare/v3.0.0-alpha.27...v3.0.0-alpha.28) (2023-01-18)
65
+
66
+ # [3.0.0-alpha.25](https://github.com/CDEBase/admin-layout/compare/v2.0.1-alpha.88...v3.0.0-alpha.25) (2023-01-12)
67
+
68
+ # [3.0.0-alpha.15](https://github.com/CDEBase/admin-layout/compare/v3.0.0-alpha.14...v3.0.0-alpha.15) (2023-01-02)
69
+
70
+ # [3.0.0-alpha.11](https://github.com/CDEBase/admin-layout/compare/v2.0.1-alpha.81...v3.0.0-alpha.11) (2022-12-28)
71
+
72
+ **Note:** Version bump only for package @admin-layout/mobile-layout
73
+
74
+ # [3.0.0-alpha.28](https://github.com/CDEBase/admin-layout/compare/v3.0.0-alpha.27...v3.0.0-alpha.28) (2023-01-18)
75
+
76
+ ## [2.0.1-alpha.88](https://github.com/CDEBase/admin-layout/compare/v2.0.1-alpha.87...v2.0.1-alpha.88) (2023-01-12)
77
+
78
+ ## [2.0.1-alpha.87](https://github.com/CDEBase/admin-layout/compare/v2.0.1-alpha.86...v2.0.1-alpha.87) (2023-01-10)
79
+
80
+ **Note:** Version bump only for package @admin-layout/mobile-layout
81
+
82
+ # [3.0.0-alpha.25](https://github.com/CDEBase/admin-layout/compare/v2.0.1-alpha.86...v3.0.0-alpha.25) (2023-01-12)
83
+
84
+ # [3.0.0-alpha.15](https://github.com/CDEBase/admin-layout/compare/v3.0.0-alpha.14...v3.0.0-alpha.15) (2023-01-02)
85
+
86
+ # [3.0.0-alpha.11](https://github.com/CDEBase/admin-layout/compare/v2.0.1-alpha.81...v3.0.0-alpha.11) (2022-12-28)
87
+
88
+ **Note:** Version bump only for package @admin-layout/mobile-layout
89
+
90
+ # [3.0.0-alpha.15](https://github.com/cdebase/admin-layout/compare/v3.0.0-alpha.14...v3.0.0-alpha.15) (2023-01-02)
91
+
92
+ **Note:** Version bump only for package @admin-layout/mobile-layout
93
+
94
+ # 3.0.0-alpha.11 (2022-12-28)
95
+
96
+ ### Bug Fixes
97
+
98
+ - added toast for mobile ([ca38f5c](https://github.com/cdebase/admin-layout/commit/ca38f5c2c5ba16d3e512ad690bb80257d511c74a))
99
+ - issue with toast for react navigation ([f2397cc](https://github.com/cdebase/admin-layout/commit/f2397cc433c1627e3af7ecc31ff949606bc9eac1))
100
+
101
+ # [3.0.0-alpha.3](https://github.com/cdmbase/admin-layout/compare/v3.0.0-alpha.2...v3.0.0-alpha.3) (2022-11-22)
102
+
103
+ **Note:** Version bump only for package @admin-layout/mobile-layout
104
+
105
+ # 3.0.0-alpha.2 (2022-11-20)
106
+
107
+ ### Bug Fixes
108
+
109
+ - added toast for mobile ([ca38f5c](https://github.com/cdmbase/admin-layout/commit/ca38f5c2c5ba16d3e512ad690bb80257d511c74a))
110
+ - issue with toast for react navigation ([f2397cc](https://github.com/cdmbase/admin-layout/commit/f2397cc433c1627e3af7ecc31ff949606bc9eac1))
111
+
112
+ # 3.0.0-alpha.0 (2022-11-09)
113
+
114
+ ### Bug Fixes
115
+
116
+ - added toast for mobile ([ca38f5c](https://github.com/cdmbase/admin-layout/commit/ca38f5c2c5ba16d3e512ad690bb80257d511c74a))
117
+ - issue with toast for react navigation ([f2397cc](https://github.com/cdmbase/admin-layout/commit/f2397cc433c1627e3af7ecc31ff949606bc9eac1))
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License
2
+
3
+ Copyright (c) 2017 CDMBase LLC.
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
13
+ all 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
21
+ THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,4 @@
1
+ # Gluestack-ui mobile
2
+
3
+ Readme:
4
+ Gluestack-ui mobile component layout
Binary file
@@ -0,0 +1,26 @@
1
+ module.exports = {
2
+ compact: false,
3
+ presets: [
4
+ "module:metro-react-native-babel-preset",
5
+ '@babel/preset-typescript',
6
+ '@babel/preset-react',
7
+ ['@babel/preset-env', { modules: 'commonjs', loose: true }],
8
+ ],
9
+ plugins: [
10
+ '@babel/plugin-transform-modules-commonjs',
11
+ '@babel/plugin-transform-destructuring',
12
+ '@babel/plugin-transform-for-of',
13
+ '@babel/plugin-transform-regenerator',
14
+ '@babel/plugin-transform-runtime',
15
+ '@babel/plugin-syntax-dynamic-import',
16
+ '@babel/plugin-transform-flow-strip-types',
17
+ '@babel/plugin-proposal-class-properties',
18
+ ['@babel/plugin-proposal-decorators', { legacy: true }],
19
+ '@babel/plugin-proposal-object-rest-spread',
20
+ ],
21
+ env: {
22
+ production: {
23
+ compact: true,
24
+ },
25
+ },
26
+ };
@@ -0,0 +1,14 @@
1
+ import 'react-native-gesture-handler/jestSetup';
2
+
3
+ jest.mock('react-native-reanimated', () => {
4
+ const Reanimated = require('react-native-reanimated/mock');
5
+
6
+ // The mock for `call` immediately calls the callback which is incorrect
7
+ // So we override it with a no-op
8
+ Reanimated.default.call = () => {};
9
+
10
+ return Reanimated;
11
+ });
12
+
13
+ // Silence the warning: Animated: `useNativeDriver` is not supported because the native animated module is missing
14
+ jest.mock('react-native/Libraries/Animated/NativeAnimatedHelper');
package/jest.config.js ADDED
@@ -0,0 +1,39 @@
1
+
2
+ const packageJson = require('./package');
3
+ const merge = require('merge')
4
+ const baseConfig = require('../../../jest.config.base');
5
+ const mergeData = merge.recursive(
6
+ baseConfig,
7
+ {
8
+ globals: {
9
+ 'ts-jest': {
10
+ babelConfig: true,
11
+ },
12
+ },
13
+ name: packageJson.name,
14
+ displayName: packageJson.name,
15
+ testEnvironment: "jsdom",
16
+ preset: "react-native",
17
+ setupFiles: [
18
+ "<rootDir>/jest-react-navigation-setup.js"
19
+ ],
20
+ setupFilesAfterEnv: ["@testing-library/jest-native/extend-expect", "./jest.env.js"],
21
+ "transform": {
22
+ "\\.(js|jsx)?$": "../../../transform.js",
23
+ },
24
+ transformIgnorePatterns: ["<rootDir>/node_modules/(?!(@react-native|react-native|@expo/vector-icons)/).*/"],
25
+ moduleNameMapper: {
26
+ '^__mocks__/(.*)$': '<rootDir>/../../__mocks__/$1',
27
+ // we'll use commonjs version of lodash for tests 👌
28
+ // because we don't need to use any kind of tree shaking right?!
29
+ '^lodash-es$': '<rootDir>../../../node_modules/lodash/index.js',
30
+ // 'react-native-code-push': '<rootDir>/__mocks__/react-native-code-push.js',
31
+ // '@react-navigation': '<rootDir>/__mocks__/@react-navigation.js',
32
+ },
33
+ roots: [
34
+ "src/utils"
35
+ ],
36
+ },
37
+ );
38
+
39
+ module.exports = mergeData;
package/jest.env.js ADDED
@@ -0,0 +1,2 @@
1
+ // global.setImmediate = jest.useRealTimers;
2
+ global.setImmediate = global.setImmediate || ((fn, ...args) => global.setTimeout(fn, 0, ...args));
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,202 @@
1
+ import React from 'react';
2
+ import renderer from 'react-test-renderer';
3
+ import { ProLayout } from '../containers/layout/ProLayout';
4
+ import { Feature } from '@common-stack/client-react';
5
+ import { createStackNavigator } from '@react-navigation/stack';
6
+ import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
7
+ import { createDrawerNavigator } from '@react-navigation/drawer';
8
+ const MyComponent = () => {
9
+ const routerConfig = {
10
+ ['/']: {
11
+ exact: false,
12
+ container: createStackNavigator(),
13
+ name: 'MainStack',
14
+ props: {
15
+ initialRouteName: 'MainStack.MainDrawer',
16
+ screenOptions: {
17
+ headerShown: false,
18
+ },
19
+ },
20
+ },
21
+ ['//maindrawer']: {
22
+ container: createDrawerNavigator(),
23
+ exact: false,
24
+ name: 'MainDrawer',
25
+ props: {
26
+ initialRouteName: 'MainStack.MainDrawer.MainBottomTab',
27
+ screenOptions: {
28
+ headerShown: false,
29
+ tabBarLabel: 'About',
30
+ // tabBarIcon: ({ color }) => <Ionicons name="person" size={24} color={color} />,
31
+ },
32
+ },
33
+ },
34
+ ['//maindrawer/bottom_tab']: {
35
+ container: createBottomTabNavigator(),
36
+ exact: false,
37
+ name: 'MainBottomTab',
38
+ props: {
39
+ initialRouteName: 'MainStack.MainDrawer.MainBottomTab.Home',
40
+ screenOptions: {
41
+ headerShown: false,
42
+ tabBarLabel: 'About',
43
+ // tabBarIcon: ({ color }) => <Ionicons name="person" size={24} color={color} />,
44
+ },
45
+ },
46
+ },
47
+ ['//maindrawer/bottom_tab/home']: {
48
+ name: 'Home',
49
+ props: {
50
+ priority: 1,
51
+ initialParams: { orgName: 'test' },
52
+ component: MyComponent,
53
+ options: {
54
+ headerShown: true,
55
+ tabBarLabel: 'Home',
56
+ headerTitle: 'Home',
57
+ // tabBarIcon: ({ color }) => <Ionicons name="home" size={24} color={color} />,
58
+ },
59
+ },
60
+ },
61
+ ['//maindrawer/bottom_tab/home/:about']: {
62
+ exact: false,
63
+ container: createStackNavigator(),
64
+ name: 'About',
65
+ props: {
66
+ initialRouteName: 'Hello',
67
+ },
68
+ },
69
+ ['//maindrawer/bottom_tab/home/:about/info']: {
70
+ name: 'Info',
71
+ props: {
72
+ priority: 2,
73
+ initialParams: {},
74
+ component: MyComponent,
75
+ options: {
76
+ headerTitle: 'Info',
77
+ },
78
+ },
79
+ },
80
+ ['//maindrawer/bottom_tab/account']: {
81
+ name: 'Account',
82
+ props: {
83
+ priority: 3,
84
+ initialParams: {},
85
+ component: MyComponent,
86
+ options: {
87
+ headerShown: true,
88
+ tabBarLabel: 'Account',
89
+ headerTitle: 'Account',
90
+ // tabBarIcon: ({ color }) => <Ionicons name="home" size={24} color={color} />,
91
+ },
92
+ },
93
+ },
94
+ };
95
+ const feature = new Feature({ routeConfig: routerConfig });
96
+ return React.createElement(ProLayout, { features: feature });
97
+ };
98
+ test('renders correctly', () => {
99
+ const tree = renderer.create(React.createElement(MyComponent, null)).toJSON();
100
+ expect(tree).toMatchSnapshot();
101
+ });
102
+ // import { Feature, IRouteData, getNavigation, getSortedNavigations } from '@common-stack/client-react';
103
+ // import { createStackNavigator } from '@react-navigation/stack';
104
+ // import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
105
+ // import { createDrawerNavigator } from '@react-navigation/drawer';
106
+ // const MyComponent = () => {};
107
+ // describe('prolayout feature testing with basic routes', () => {
108
+ // const routerConfig: IRouteData = {
109
+ // ['/']: {
110
+ // exact: false,
111
+ // container: createStackNavigator(),
112
+ // name: 'MainStack',
113
+ // props: {
114
+ // initialRouteName: 'MainStack.MainDrawer',
115
+ // screenOptions: {
116
+ // headerShown: false,
117
+ // },
118
+ // },
119
+ // },
120
+ // ['//maindrawer']: {
121
+ // container: createDrawerNavigator(),
122
+ // exact: false,
123
+ // name: 'MainDrawer',
124
+ // props: {
125
+ // initialRouteName: 'MainStack.MainDrawer.MainBottomTab',
126
+ // screenOptions: {
127
+ // headerShown: false,
128
+ // tabBarLabel: 'About',
129
+ // // tabBarIcon: ({ color }) => <Ionicons name="person" size={24} color={color} />,
130
+ // },
131
+ // },
132
+ // },
133
+ // ['//maindrawer/bottom_tab']: {
134
+ // container: createBottomTabNavigator(),
135
+ // exact: false,
136
+ // name: 'MainBottomTab',
137
+ // props: {
138
+ // initialRouteName: 'MainStack.MainDrawer.MainBottomTab.Home',
139
+ // screenOptions: {
140
+ // headerShown: false,
141
+ // tabBarLabel: 'About',
142
+ // // tabBarIcon: ({ color }) => <Ionicons name="person" size={24} color={color} />,
143
+ // },
144
+ // },
145
+ // },
146
+ // ['//maindrawer/bottom_tab/home']: {
147
+ // name: 'Home',
148
+ // props: {
149
+ // priority: 1,
150
+ // initialParams: { orgName: 'test' },
151
+ // component: MyComponent,
152
+ // options: {
153
+ // headerShown: true,
154
+ // tabBarLabel: 'Home',
155
+ // headerTitle: 'Home',
156
+ // // tabBarIcon: ({ color }) => <Ionicons name="home" size={24} color={color} />,
157
+ // },
158
+ // },
159
+ // },
160
+ // ['//maindrawer/bottom_tab/home/:about']: {
161
+ // exact: false,
162
+ // container: createStackNavigator(),
163
+ // name: 'About',
164
+ // props: {
165
+ // initialRouteName: 'Hello',
166
+ // },
167
+ // },
168
+ // ['//maindrawer/bottom_tab/home/:about/info']: {
169
+ // name: 'Info',
170
+ // props: {
171
+ // priority: 2,
172
+ // initialParams: {},
173
+ // component: MyComponent,
174
+ // options: {
175
+ // headerTitle: 'Info',
176
+ // },
177
+ // },
178
+ // },
179
+ // ['//maindrawer/bottom_tab/account']: {
180
+ // name: 'Account',
181
+ // props: {
182
+ // priority: 3,
183
+ // initialParams: {},
184
+ // component: MyComponent,
185
+ // options: {
186
+ // headerShown: true,
187
+ // tabBarLabel: 'Account',
188
+ // headerTitle: 'Account',
189
+ // // tabBarIcon: ({ color }) => <Ionicons name="home" size={24} color={color} />,
190
+ // },
191
+ // },
192
+ // },
193
+ // };
194
+ // it('get prolayout getSortedNavigations', () => {
195
+ // const feature = new Feature({ routeConfig: routerConfig });
196
+ // const Render = feature.getRoutes2('/', 'MainStack');
197
+ // const Nav = getSortedNavigations('/', routerConfig);
198
+ // console.log('Nav1', JSON.stringify(Nav));
199
+ // expect(Render).toMatchSnapshot();
200
+ // });
201
+ // });
202
+ //# sourceMappingURL=prolayout-layout-feature.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prolayout-layout-feature.test.js","sourceRoot":"","sources":["../../src/__tests__/prolayout-layout-feature.test.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,QAAQ,MAAM,qBAAqB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,OAAO,EAAmD,MAAM,4BAA4B,CAAC;AACtG,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AACjE,MAAM,WAAW,GAAG,GAAG,EAAE;IACrB,MAAM,YAAY,GAAG;QACjB,CAAC,GAAG,CAAC,EAAE;YACH,KAAK,EAAE,KAAK;YACZ,SAAS,EAAE,oBAAoB,EAAE;YACjC,IAAI,EAAE,WAAW;YACjB,KAAK,EAAE;gBACH,gBAAgB,EAAE,sBAAsB;gBACxC,aAAa,EAAE;oBACX,WAAW,EAAE,KAAK;iBACrB;aACJ;SACJ;QACD,CAAC,cAAc,CAAC,EAAE;YACd,SAAS,EAAE,qBAAqB,EAAE;YAClC,KAAK,EAAE,KAAK;YACZ,IAAI,EAAE,YAAY;YAClB,KAAK,EAAE;gBACH,gBAAgB,EAAE,oCAAoC;gBACtD,aAAa,EAAE;oBACX,WAAW,EAAE,KAAK;oBAClB,WAAW,EAAE,OAAO;oBACpB,iFAAiF;iBACpF;aACJ;SACJ;QACD,CAAC,yBAAyB,CAAC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ACrD,4BAA4B;AAC5B,iDAAiD;AACjD,6BAA6B;AAC7B,uBAAuB;AACvB,6CAA6C;AAC7C,iBAAiB;AACjB,aAAa;AACb,0DAA0D;AAC1D,4BAA4B;AAC5B,uBAAuB;AACvB,+BAA+B;AAC/B,qCAAqC;AACrC,0CAA0C;AAC1C,6BAA6B;AAC7B,2CAA2C;AAC3C,qBAAqB;AACrB,iBAAiB;AACjB,aAAa;AACb,iDAAiD;AACjD,+BAA+B;AAC/B,uBAAuB;AACvB,+BAA+B;AAC/B,qCAAqC;AACrC,0CAA0C;AAC1C,6BAA6B;AAC7B,yCAAyC;AACzC,8CAA8C;AAC9C,8CAA8C;AAC9C,sGAAsG;AACtG,qBAAqB;AACrB,iBAAiB;AACjB,aAAa;AACb,SAAS;AAET,uDAAuD;AACvD,sEAAsE;AACtE,+DAA+D;AAC/D,+DAA+D;AAC/D,oDAAoD;AACpD,4CAA4C;AAC5C,UAAU;AACV,MAAM"}
@@ -0,0 +1,2 @@
1
+ import * as React from 'react';
2
+ export declare const ApplicationErrorFillWrapper: (props: any) => React.JSX.Element;
@@ -0,0 +1,7 @@
1
+ import { Fill } from '@common-stack/components-pro';
2
+ import { APPLICATION_ERROR_SLOT_FILL } from '@admin-layout/client';
3
+ import * as React from 'react';
4
+ export const ApplicationErrorFillWrapper = (props) => {
5
+ return React.createElement(Fill, Object.assign({}, props, { name: APPLICATION_ERROR_SLOT_FILL }));
6
+ };
7
+ //# sourceMappingURL=ApplicationErrorFillWrapper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ApplicationErrorFillWrapper.js","sourceRoot":"","sources":["../../src/components/ApplicationErrorFillWrapper.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,8BAA8B,CAAC;AACpD,OAAO,EAAE,2BAA2B,EAAE,MAAM,sBAAsB,CAAC;AACnE,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,KAAK,EAAE,EAAE;IACnD,OAAO,oBAAC,IAAI,oBAAK,KAAK,IAAE,IAAI,EAAE,2BAA2B,IAAI,CAAA;AAC/D,CAAC,CAAA"}
@@ -0,0 +1,2 @@
1
+ import * as React from 'react';
2
+ export declare const ApplicationErrorHandler: (props: any) => React.JSX.Element;
@@ -0,0 +1,24 @@
1
+ import { ApplicationErrorHandlerCommon, APPLICATION_ERROR_SLOT_FILL } from '@admin-layout/client';
2
+ import { Slot } from '@common-stack/components-pro';
3
+ import Toast from 'react-native-toast-message';
4
+ import * as React from 'react';
5
+ const FallbackComponent = () => {
6
+ React.useLayoutEffect(() => {
7
+ Toast.show({
8
+ type: 'error',
9
+ text1: 'Something went wrong...'
10
+ });
11
+ }, []);
12
+ return null;
13
+ };
14
+ const RendererComponent = (props) => {
15
+ const { applicationErrors, backendError } = props;
16
+ return (React.createElement(React.Fragment, null,
17
+ !!backendError && React.createElement(FallbackComponent, null),
18
+ !!(applicationErrors === null || applicationErrors === void 0 ? void 0 : applicationErrors.length) && React.createElement(Slot, { name: APPLICATION_ERROR_SLOT_FILL, fillProps: { active: true, applicationErrors: applicationErrors } })));
19
+ };
20
+ export const ApplicationErrorHandler = (props) => {
21
+ const CommonHandler = ApplicationErrorHandlerCommon(FallbackComponent, Slot, RendererComponent);
22
+ return React.createElement(CommonHandler, Object.assign({}, props));
23
+ };
24
+ //# sourceMappingURL=ApplicationErrorHandler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ApplicationErrorHandler.js","sourceRoot":"","sources":["../../src/components/ApplicationErrorHandler.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,2BAA2B,EAAE,MAAM,sBAAsB,CAAA;AACjG,OAAO,EAAE,IAAI,EAAE,MAAM,8BAA8B,CAAA;AACnD,OAAO,KAAK,MAAM,4BAA4B,CAAC;AAC/C,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,MAAM,iBAAiB,GAAG,GAAG,EAAE;IAC7B,KAAK,CAAC,eAAe,CAAC,GAAG,EAAE;QACzB,KAAK,CAAC,IAAI,CAAC;YACT,IAAI,EAAE,OAAO;YACb,KAAK,EAAE,yBAAyB;SACjC,CAAC,CAAC;IACL,CAAC,EAAE,EAAE,CAAC,CAAA;IAEN,OAAO,IAAI,CAAC;AACd,CAAC,CAAA;AAED,MAAM,iBAAiB,GAAG,CAAC,KAAK,EAAE,EAAE;IAClC,MAAM,EAAE,iBAAiB,EAAE,YAAY,EAAE,GAAG,KAAK,CAAC;IAClD,OAAO,CACL;QACG,CAAC,CAAC,YAAY,IAAI,oBAAC,iBAAiB,OAAG;QACvC,CAAC,CAAC,CAAA,iBAAiB,aAAjB,iBAAiB,uBAAjB,iBAAiB,CAAE,MAAM,CAAA,IAAI,oBAAC,IAAI,IAAC,IAAI,EAAE,2BAA2B,EAAE,SAAS,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,GAAI,CAC7I,CACJ,CAAA;AACH,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,KAAK,EAAE,EAAE;IAC/C,MAAM,aAAa,GAAG,6BAA6B,CAAC,iBAAiB,EAAE,IAAI,EAAE,iBAAiB,CAAC,CAAC;IAChG,OAAO,oBAAC,aAAa,oBAAK,KAAK,EAAI,CAAA;AACrC,CAAC,CAAA"}
@@ -0,0 +1,18 @@
1
+ import React, { ReactElement } from 'react';
2
+ type IErrorBoundryState = {
3
+ hasError: boolean;
4
+ error: Error | null;
5
+ };
6
+ type IErrorBoundryProps = {
7
+ children: ReactElement;
8
+ };
9
+ export declare class ErrorBoundary extends React.Component<IErrorBoundryProps, IErrorBoundryState> {
10
+ constructor(props: IErrorBoundryProps);
11
+ static getDerivedStateFromError(error: Error): {
12
+ hasError: boolean;
13
+ error: Error;
14
+ };
15
+ componentDidCatch(error: Error): void;
16
+ render(): React.JSX.Element;
17
+ }
18
+ export {};
@@ -0,0 +1,22 @@
1
+ import React from 'react';
2
+ import { FallbackComponent } from './Fallback';
3
+ import { logger } from '@cdm-logger/client';
4
+ export class ErrorBoundary extends React.Component {
5
+ constructor(props) {
6
+ super(props);
7
+ this.state = { hasError: false, error: null };
8
+ }
9
+ static getDerivedStateFromError(error) {
10
+ return { hasError: true, error };
11
+ }
12
+ componentDidCatch(error) {
13
+ logger.debug(error);
14
+ }
15
+ render() {
16
+ if (this.state.hasError) {
17
+ return React.createElement(FallbackComponent, { error: this.state.error });
18
+ }
19
+ return this.props.children;
20
+ }
21
+ }
22
+ //# sourceMappingURL=ErrorBounday.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ErrorBounday.js","sourceRoot":"","sources":["../../src/components/ErrorBounday.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAuB,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAQ5C,MAAM,OAAO,aAAc,SAAQ,KAAK,CAAC,SAAiD;IACxF,YAAY,KAAyB;QACnC,KAAK,CAAC,KAAK,CAAC,CAAC;QACb,IAAI,CAAC,KAAK,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;IAChD,CAAC;IAED,MAAM,CAAC,wBAAwB,CAAC,KAAY;QAC1C,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;IACnC,CAAC;IAED,iBAAiB,CAAC,KAAY;QAC5B,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;IACrB,CAAC;IAED,MAAM;QACJ,IAAI,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE;YACvB,OAAO,oBAAC,iBAAiB,IAAC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAc,GAAI,CAAC;SAChE;QACD,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC;IAC7B,CAAC;CACF"}
@@ -0,0 +1,6 @@
1
+ import * as React from 'react';
2
+ type Props = {
3
+ error: Error;
4
+ };
5
+ export declare const FallbackComponent: (props: Props) => React.JSX.Element;
6
+ export {};
@@ -0,0 +1,53 @@
1
+ import { navigationRef } from '@common-stack/client-react';
2
+ import { Button, ButtonText } from '@gluestack-ui/themed';
3
+ import * as React from 'react';
4
+ import { StyleSheet } from 'react-native';
5
+ import { SafeAreaView, Text, View, } from 'react-native';
6
+ import { useDispatch } from 'react-redux';
7
+ export const FallbackComponent = (props) => {
8
+ var _a;
9
+ const dispatch = useDispatch();
10
+ return (React.createElement(SafeAreaView, { style: styles.container },
11
+ React.createElement(View, { style: styles.content },
12
+ React.createElement(Text, { style: styles.title }, "Oops!"),
13
+ React.createElement(Text, { style: styles.subtitle }, 'There\'s an error'),
14
+ React.createElement(Text, { style: styles.error }, (_a = props === null || props === void 0 ? void 0 : props.error) === null || _a === void 0 ? void 0 : _a.message),
15
+ React.createElement(Button, { style: styles.button, onPress: () => navigationRef.navigate("MainStack.Layout.Home") },
16
+ React.createElement(ButtonText, { style: styles.buttonText }, "Go to homepage")))));
17
+ };
18
+ const styles = StyleSheet.create({
19
+ container: {
20
+ backgroundColor: '#fafafa',
21
+ flex: 1,
22
+ justifyContent: 'center'
23
+ },
24
+ content: {
25
+ marginHorizontal: 16
26
+ },
27
+ title: {
28
+ fontSize: 48,
29
+ fontWeight: '300',
30
+ paddingBottom: 16,
31
+ color: '#000'
32
+ },
33
+ subtitle: {
34
+ fontSize: 32,
35
+ fontWeight: '800',
36
+ color: '#000'
37
+ },
38
+ error: {
39
+ paddingVertical: 16
40
+ },
41
+ button: {
42
+ backgroundColor: '#2196f3',
43
+ borderRadius: 50,
44
+ padding: 25,
45
+ height: 40
46
+ },
47
+ buttonText: {
48
+ color: '#fff',
49
+ fontWeight: '600',
50
+ textAlign: 'center'
51
+ }
52
+ });
53
+ //# sourceMappingURL=Fallback.js.map
@@ -0,0 +1 @@
1
+ {"version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,IAAI,EAAE,CAAC;QACP,cAAc,EAAE,QAAQ;KACzB;IACD,OAAO,EAAE;QACP,gBAAgB,EAAE,EAAE;KACrB;IACD,KAAK,EAAE;QACL,QAAQ,EAAE,EAAE;QACZ,UAAU,EAAE,KAAK;QACjB,aAAa,EAAE,EAAE;QACjB,KAAK,EAAE,MAAM;KACd;IACD,QAAQ,EAAE;QACR,QAAQ,EAAE,EAAE;QACZ,UAAU,EAAE,KAAK;QACjB,KAAK,EAAE,MAAM;KACd;IACD,KAAK,EAAE;QACL,eAAe,EAAE,EAAE;KACpB;IACD,MAAM,EAAE;QACN,eAAe,EAAE,SAAS;QAC1B,YAAY,EAAE,EAAE;QAChB,OAAO,EAAE,EAAE;QACX,MAAM,EAAE,EAAE;KACX;IACD,UAAU,EAAE;QACV,KAAK,EAAE,MAAM;QACb,UAAU,EAAE,KAAK;QACjB,SAAS,EAAE,QAAQ;KACpB;CACF,CAAC,CAAA"}
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ declare const BasicLayout: React.FC<any & {
3
+ routeParams: any;
4
+ }>;
5
+ export default BasicLayout;
@@ -0,0 +1,28 @@
1
+ import React, { useRef, useState } from 'react';
2
+ import { Route } from 'react-router-native';
3
+ import { Box, Divider } from '@gluestack-ui/themed';
4
+ import { Header } from './Header';
5
+ import { Drawer } from './Drawer';
6
+ import defaultSettings from './defaultSettings';
7
+ import { SettingDrawer } from './SettingDrawer';
8
+ import { BottomTabBar } from './BottomTabBar';
9
+ const BasicLayout = (props) => {
10
+ const { route, rightContentRender, onSettingChange, settings, routeParams, showSettings, currentRoute } = props;
11
+ const drawerRef = useRef();
12
+ const [settingToggle, setSettingToggle] = useState(false);
13
+ return (React.createElement(Box, { flex: 1 },
14
+ React.createElement(Header, { layout: settings.layout, setSettingToggle: setSettingToggle, title: currentRoute.name, drawerRef: drawerRef, rightContentRender: rightContentRender, settingToggle: settingToggle, navTheme: settings.navTheme, showSettings: showSettings, route: currentRoute.key, nextButton: currentRoute.nextButton }),
15
+ React.createElement(Divider, null),
16
+ !!settings && settings.layout !== 'bottom' ? (React.createElement(Drawer, { navTheme: settings.navTheme, match: props.match, routeParams: routeParams, routes: route.routes, drawerRef: drawerRef })) : null,
17
+ settings && settings.layout === 'bottom'
18
+ ? route.routes.map((route) => (React.createElement(Route, { key: route.path, path: route.path, Component: route.component })))
19
+ : null,
20
+ !!settingToggle ? (React.createElement(SettingDrawer, { onSettingChange: (settings) => {
21
+ onSettingChange(settings);
22
+ setSettingToggle(false);
23
+ } })) : null,
24
+ settings && (settings.layout === 'mixSide' || settings.layout === 'bottom') && (React.createElement(BottomTabBar, { navTheme: settings.navTheme, routes: route.routes }))));
25
+ };
26
+ BasicLayout.defaultProps = Object.assign({}, defaultSettings);
27
+ export default BasicLayout;
28
+ //# sourceMappingURL=BasicLayout.js.map