@ohos-ports/react-native-navigation 8.9.0-beta.4 → 8.9.0-beta.6

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 (271) hide show
  1. package/README.md +7 -20
  2. package/lib/cjs/Mock/Application.js +67 -0
  3. package/lib/cjs/Mock/ComponentProps.js +16 -0
  4. package/lib/cjs/Mock/Components/BottomTabs.js +50 -0
  5. package/lib/cjs/Mock/Components/ComponentScreen.js +135 -0
  6. package/lib/cjs/Mock/Components/LayoutComponent.js +85 -0
  7. package/lib/cjs/Mock/Components/Modals.js +56 -0
  8. package/lib/cjs/Mock/Components/NavigationButton.js +104 -0
  9. package/lib/cjs/Mock/Components/Overlays.js +57 -0
  10. package/lib/cjs/Mock/Components/SideMenu.js +69 -0
  11. package/lib/cjs/Mock/Components/Stack.js +52 -0
  12. package/lib/cjs/Mock/Components/TopBar.js +115 -0
  13. package/lib/cjs/Mock/Layouts/BottomTabsNode.js +60 -0
  14. package/lib/cjs/Mock/Layouts/ComponentNode.js +132 -0
  15. package/lib/cjs/Mock/Layouts/LayoutNodeFactory.js +59 -0
  16. package/lib/cjs/Mock/Layouts/Node.js +32 -0
  17. package/lib/cjs/Mock/Layouts/ParentNode.js +99 -0
  18. package/lib/cjs/Mock/Layouts/SideMenu.js +112 -0
  19. package/lib/cjs/Mock/Layouts/StackNode.js +42 -0
  20. package/lib/cjs/Mock/Stores/EventsStore.js +85 -0
  21. package/lib/{module → cjs}/Mock/Stores/LayoutStore.js +56 -24
  22. package/lib/cjs/Mock/actions/layoutActions.js +47 -0
  23. package/lib/cjs/Mock/connect.js +31 -0
  24. package/lib/cjs/Mock/constants.js +31 -0
  25. package/lib/cjs/Mock/index.js +48 -0
  26. package/lib/cjs/Mock/mocks/AppRegistryService.js +31 -0
  27. package/lib/cjs/Mock/mocks/NativeCommandsSender.js +181 -0
  28. package/lib/cjs/Mock/mocks/NativeEventsReceiver.js +146 -0
  29. package/lib/cjs/Navigation.js +259 -0
  30. package/lib/{module → cjs}/NavigationDelegate.js +33 -34
  31. package/lib/cjs/adapters/AndroidCustomRowForwarder.js +84 -0
  32. package/lib/cjs/adapters/AppRegistryService.js +33 -0
  33. package/lib/cjs/adapters/AssetResolver.js +33 -0
  34. package/lib/cjs/adapters/ColorService.js +33 -0
  35. package/lib/cjs/adapters/Constants.js +43 -0
  36. package/lib/{module → cjs}/adapters/NativeCommandsSender.js +39 -5
  37. package/lib/cjs/adapters/NativeEventsReceiver.js +99 -0
  38. package/lib/cjs/adapters/NativeEventsReceiver.mock.js +30 -0
  39. package/lib/cjs/adapters/NativeRNNTurboEventEmitter.js +27 -0
  40. package/lib/cjs/adapters/NativeRNNTurboModule.js +26 -0
  41. package/lib/cjs/adapters/TouchablePreview.js +137 -0
  42. package/lib/cjs/adapters/UniqueIdProvider.js +43 -0
  43. package/lib/cjs/commands/Commands.js +276 -0
  44. package/lib/cjs/commands/Deprecations.js +101 -0
  45. package/lib/cjs/commands/LayoutTreeCrawler.js +56 -0
  46. package/lib/cjs/commands/LayoutTreeParser.js +154 -0
  47. package/lib/cjs/commands/LayoutType.js +40 -0
  48. package/lib/cjs/commands/OptionsCrawler.js +106 -0
  49. package/lib/{module → cjs}/commands/OptionsProcessor.js +102 -67
  50. package/lib/{module → cjs}/components/ComponentRegistry.js +27 -3
  51. package/lib/cjs/components/ComponentWrapper.js +114 -0
  52. package/lib/cjs/components/Modal.js +159 -0
  53. package/lib/{module → cjs}/components/Store.js +27 -3
  54. package/lib/cjs/events/CommandsObserver.js +43 -0
  55. package/lib/cjs/events/ComponentEventsObserver.js +128 -0
  56. package/lib/{module → cjs}/events/EventsRegistry.js +27 -3
  57. package/lib/cjs/index.js +63 -0
  58. package/lib/cjs/interfaces/CommandName.js +46 -0
  59. package/lib/cjs/interfaces/ComponentEvents.js +1 -0
  60. package/lib/cjs/interfaces/EventSubscription.js +1 -0
  61. package/lib/cjs/interfaces/Events.js +1 -0
  62. package/lib/cjs/interfaces/Layout.js +16 -0
  63. package/lib/cjs/interfaces/NavigationComponent.js +62 -0
  64. package/lib/cjs/interfaces/NavigationComponentListener.js +16 -0
  65. package/lib/cjs/interfaces/NavigationComponentProps.js +1 -0
  66. package/lib/cjs/interfaces/NavigationFunctionComponent.js +16 -0
  67. package/lib/cjs/interfaces/Options.js +47 -0
  68. package/lib/cjs/interfaces/ProcessorSubscription.js +1 -0
  69. package/lib/cjs/interfaces/Processors.js +16 -0
  70. package/lib/cjs/linking/DeferredLinkQueue.js +66 -0
  71. package/lib/{module → cjs}/linking/LinkingHandler.js +40 -43
  72. package/lib/cjs/linking/ModalLayoutBuilder.js +59 -0
  73. package/lib/{module → cjs}/linking/RouteMatcher.js +31 -15
  74. package/lib/cjs/linking/URLParser.js +70 -0
  75. package/lib/cjs/linking/types.js +16 -0
  76. package/lib/cjs/processors/LayoutProcessor.js +39 -0
  77. package/lib/cjs/processors/LayoutProcessorsStore.js +42 -0
  78. package/lib/cjs/processors/OptionProcessorsStore.js +43 -0
  79. package/lib/cjs/types.js +1 -0
  80. package/package.json +6 -9
  81. package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/statusbar/StatusBarPresenter.kt +0 -212
  82. package/lib/module/ARCHITECTURE.md +0 -331
  83. package/lib/module/Mock/Application.js +0 -33
  84. package/lib/module/Mock/Application.js.map +0 -1
  85. package/lib/module/Mock/ComponentProps.js +0 -4
  86. package/lib/module/Mock/ComponentProps.js.map +0 -1
  87. package/lib/module/Mock/Components/BottomTabs.js +0 -16
  88. package/lib/module/Mock/Components/BottomTabs.js.map +0 -1
  89. package/lib/module/Mock/Components/ComponentScreen.js +0 -101
  90. package/lib/module/Mock/Components/ComponentScreen.js.map +0 -1
  91. package/lib/module/Mock/Components/LayoutComponent.js +0 -50
  92. package/lib/module/Mock/Components/LayoutComponent.js.map +0 -1
  93. package/lib/module/Mock/Components/Modals.js +0 -22
  94. package/lib/module/Mock/Components/Modals.js.map +0 -1
  95. package/lib/module/Mock/Components/NavigationButton.js +0 -72
  96. package/lib/module/Mock/Components/NavigationButton.js.map +0 -1
  97. package/lib/module/Mock/Components/Overlays.js +0 -23
  98. package/lib/module/Mock/Components/Overlays.js.map +0 -1
  99. package/lib/module/Mock/Components/SideMenu.js +0 -29
  100. package/lib/module/Mock/Components/SideMenu.js.map +0 -1
  101. package/lib/module/Mock/Components/Stack.js +0 -18
  102. package/lib/module/Mock/Components/Stack.js.map +0 -1
  103. package/lib/module/Mock/Components/TopBar.js +0 -81
  104. package/lib/module/Mock/Components/TopBar.js.map +0 -1
  105. package/lib/module/Mock/Layouts/BottomTabsNode.js +0 -30
  106. package/lib/module/Mock/Layouts/BottomTabsNode.js.map +0 -1
  107. package/lib/module/Mock/Layouts/ComponentNode.js +0 -102
  108. package/lib/module/Mock/Layouts/ComponentNode.js.map +0 -1
  109. package/lib/module/Mock/Layouts/LayoutNodeFactory.js +0 -28
  110. package/lib/module/Mock/Layouts/LayoutNodeFactory.js.map +0 -1
  111. package/lib/module/Mock/Layouts/Node.js +0 -14
  112. package/lib/module/Mock/Layouts/Node.js.map +0 -1
  113. package/lib/module/Mock/Layouts/ParentNode.js +0 -66
  114. package/lib/module/Mock/Layouts/ParentNode.js.map +0 -1
  115. package/lib/module/Mock/Layouts/SideMenu.js +0 -72
  116. package/lib/module/Mock/Layouts/SideMenu.js.map +0 -1
  117. package/lib/module/Mock/Layouts/StackNode.js +0 -12
  118. package/lib/module/Mock/Layouts/StackNode.js.map +0 -1
  119. package/lib/module/Mock/Stores/EventsStore.js +0 -53
  120. package/lib/module/Mock/Stores/EventsStore.js.map +0 -1
  121. package/lib/module/Mock/Stores/LayoutStore.js.map +0 -1
  122. package/lib/module/Mock/actions/layoutActions.js +0 -19
  123. package/lib/module/Mock/actions/layoutActions.js.map +0 -1
  124. package/lib/module/Mock/connect.js +0 -8
  125. package/lib/module/Mock/connect.js.map +0 -1
  126. package/lib/module/Mock/constants.js +0 -5
  127. package/lib/module/Mock/constants.js.map +0 -1
  128. package/lib/module/Mock/index.js +0 -20
  129. package/lib/module/Mock/index.js.map +0 -1
  130. package/lib/module/Mock/mocks/AppRegistryService.js +0 -6
  131. package/lib/module/Mock/mocks/AppRegistryService.js.map +0 -1
  132. package/lib/module/Mock/mocks/NativeCommandsSender.js +0 -146
  133. package/lib/module/Mock/mocks/NativeCommandsSender.js.map +0 -1
  134. package/lib/module/Mock/mocks/NativeEventsReceiver.js +0 -103
  135. package/lib/module/Mock/mocks/NativeEventsReceiver.js.map +0 -1
  136. package/lib/module/Navigation.js +0 -250
  137. package/lib/module/Navigation.js.map +0 -1
  138. package/lib/module/NavigationDelegate.js.map +0 -1
  139. package/lib/module/adapters/AndroidCustomRowForwarder.js +0 -75
  140. package/lib/module/adapters/AndroidCustomRowForwarder.js.map +0 -1
  141. package/lib/module/adapters/AppRegistryService.js +0 -9
  142. package/lib/module/adapters/AppRegistryService.js.map +0 -1
  143. package/lib/module/adapters/AssetResolver.js +0 -9
  144. package/lib/module/adapters/AssetResolver.js.map +0 -1
  145. package/lib/module/adapters/ColorService.js +0 -9
  146. package/lib/module/adapters/ColorService.js.map +0 -1
  147. package/lib/module/adapters/Constants.js +0 -19
  148. package/lib/module/adapters/Constants.js.map +0 -1
  149. package/lib/module/adapters/NativeCommandsSender.js.map +0 -1
  150. package/lib/module/adapters/NativeEventsReceiver.js +0 -65
  151. package/lib/module/adapters/NativeEventsReceiver.js.map +0 -1
  152. package/lib/module/adapters/NativeEventsReceiver.mock.js +0 -6
  153. package/lib/module/adapters/NativeEventsReceiver.mock.js.map +0 -1
  154. package/lib/module/adapters/NativeRNNTurboEventEmitter.js +0 -7
  155. package/lib/module/adapters/NativeRNNTurboEventEmitter.js.map +0 -1
  156. package/lib/module/adapters/NativeRNNTurboModule.js +0 -6
  157. package/lib/module/adapters/NativeRNNTurboModule.js.map +0 -1
  158. package/lib/module/adapters/TouchablePreview.js +0 -115
  159. package/lib/module/adapters/TouchablePreview.js.map +0 -1
  160. package/lib/module/adapters/UniqueIdProvider.js +0 -9
  161. package/lib/module/adapters/UniqueIdProvider.js.map +0 -1
  162. package/lib/module/commands/Commands.js +0 -241
  163. package/lib/module/commands/Commands.js.map +0 -1
  164. package/lib/module/commands/Commands.test.js +0 -759
  165. package/lib/module/commands/Commands.test.js.map +0 -1
  166. package/lib/module/commands/Deprecations.js +0 -66
  167. package/lib/module/commands/Deprecations.js.map +0 -1
  168. package/lib/module/commands/LayoutTreeCrawler.js +0 -32
  169. package/lib/module/commands/LayoutTreeCrawler.js.map +0 -1
  170. package/lib/module/commands/LayoutTreeCrawler.test.js +0 -82
  171. package/lib/module/commands/LayoutTreeCrawler.test.js.map +0 -1
  172. package/lib/module/commands/LayoutTreeParser.js +0 -130
  173. package/lib/module/commands/LayoutTreeParser.js.map +0 -1
  174. package/lib/module/commands/LayoutTreeParser.test.js +0 -359
  175. package/lib/module/commands/LayoutTreeParser.test.js.map +0 -1
  176. package/lib/module/commands/LayoutType.js +0 -16
  177. package/lib/module/commands/LayoutType.js.map +0 -1
  178. package/lib/module/commands/LayoutType.test.js +0 -12
  179. package/lib/module/commands/LayoutType.test.js.map +0 -1
  180. package/lib/module/commands/OptionsCrawler.js +0 -72
  181. package/lib/module/commands/OptionsCrawler.js.map +0 -1
  182. package/lib/module/commands/OptionsCrawler.test.js +0 -351
  183. package/lib/module/commands/OptionsCrawler.test.js.map +0 -1
  184. package/lib/module/commands/OptionsProcessor.js.map +0 -1
  185. package/lib/module/commands/OptionsProcessor.test.js +0 -1234
  186. package/lib/module/commands/OptionsProcessor.test.js.map +0 -1
  187. package/lib/module/components/ComponentRegistry.js.map +0 -1
  188. package/lib/module/components/ComponentRegistry.test.js +0 -57
  189. package/lib/module/components/ComponentRegistry.test.js.map +0 -1
  190. package/lib/module/components/ComponentWrapper.js +0 -80
  191. package/lib/module/components/ComponentWrapper.js.map +0 -1
  192. package/lib/module/components/ComponentWrapper.test.js +0 -333
  193. package/lib/module/components/ComponentWrapper.test.js.map +0 -1
  194. package/lib/module/components/Modal.js +0 -125
  195. package/lib/module/components/Modal.js.map +0 -1
  196. package/lib/module/components/Store.js.map +0 -1
  197. package/lib/module/components/Store.test.js +0 -148
  198. package/lib/module/components/Store.test.js.map +0 -1
  199. package/lib/module/events/CommandsObserver.js +0 -19
  200. package/lib/module/events/CommandsObserver.js.map +0 -1
  201. package/lib/module/events/CommandsObserver.test.js +0 -43
  202. package/lib/module/events/CommandsObserver.test.js.map +0 -1
  203. package/lib/module/events/ComponentEventsObserver.js +0 -94
  204. package/lib/module/events/ComponentEventsObserver.js.map +0 -1
  205. package/lib/module/events/ComponentEventsObserver.test.js +0 -391
  206. package/lib/module/events/ComponentEventsObserver.test.js.map +0 -1
  207. package/lib/module/events/EventsRegistry.js.map +0 -1
  208. package/lib/module/events/EventsRegistry.test.js +0 -131
  209. package/lib/module/events/EventsRegistry.test.js.map +0 -1
  210. package/lib/module/index.js +0 -22
  211. package/lib/module/index.js.map +0 -1
  212. package/lib/module/interfaces/CommandName.js +0 -22
  213. package/lib/module/interfaces/CommandName.js.map +0 -1
  214. package/lib/module/interfaces/ComponentEvents.js +0 -2
  215. package/lib/module/interfaces/ComponentEvents.js.map +0 -1
  216. package/lib/module/interfaces/EventSubscription.js +0 -2
  217. package/lib/module/interfaces/EventSubscription.js.map +0 -1
  218. package/lib/module/interfaces/Events.js +0 -2
  219. package/lib/module/interfaces/Events.js.map +0 -1
  220. package/lib/module/interfaces/Layout.js +0 -4
  221. package/lib/module/interfaces/Layout.js.map +0 -1
  222. package/lib/module/interfaces/NavigationComponent.js +0 -21
  223. package/lib/module/interfaces/NavigationComponent.js.map +0 -1
  224. package/lib/module/interfaces/NavigationComponentListener.js +0 -4
  225. package/lib/module/interfaces/NavigationComponentListener.js.map +0 -1
  226. package/lib/module/interfaces/NavigationComponentProps.js +0 -2
  227. package/lib/module/interfaces/NavigationComponentProps.js.map +0 -1
  228. package/lib/module/interfaces/NavigationFunctionComponent.js +0 -4
  229. package/lib/module/interfaces/NavigationFunctionComponent.js.map +0 -1
  230. package/lib/module/interfaces/Options.js +0 -47
  231. package/lib/module/interfaces/Options.js.map +0 -1
  232. package/lib/module/interfaces/ProcessorSubscription.js +0 -2
  233. package/lib/module/interfaces/ProcessorSubscription.js.map +0 -1
  234. package/lib/module/interfaces/Processors.js +0 -4
  235. package/lib/module/interfaces/Processors.js.map +0 -1
  236. package/lib/module/linking/DeferredLinkQueue.js +0 -52
  237. package/lib/module/linking/DeferredLinkQueue.js.map +0 -1
  238. package/lib/module/linking/DeferredLinkQueue.test.js +0 -54
  239. package/lib/module/linking/DeferredLinkQueue.test.js.map +0 -1
  240. package/lib/module/linking/LinkingHandler.js.map +0 -1
  241. package/lib/module/linking/LinkingHandler.test.js +0 -384
  242. package/lib/module/linking/LinkingHandler.test.js.map +0 -1
  243. package/lib/module/linking/ModalLayoutBuilder.js +0 -56
  244. package/lib/module/linking/ModalLayoutBuilder.js.map +0 -1
  245. package/lib/module/linking/ModalLayoutBuilder.test.js +0 -154
  246. package/lib/module/linking/ModalLayoutBuilder.test.js.map +0 -1
  247. package/lib/module/linking/RouteMatcher.js.map +0 -1
  248. package/lib/module/linking/RouteMatcher.test.js +0 -164
  249. package/lib/module/linking/RouteMatcher.test.js.map +0 -1
  250. package/lib/module/linking/URLParser.js +0 -56
  251. package/lib/module/linking/URLParser.js.map +0 -1
  252. package/lib/module/linking/URLParser.test.js +0 -100
  253. package/lib/module/linking/URLParser.test.js.map +0 -1
  254. package/lib/module/linking/types.js +0 -4
  255. package/lib/module/linking/types.js.map +0 -1
  256. package/lib/module/package.json +0 -1
  257. package/lib/module/processors/LayoutProcessor.js +0 -15
  258. package/lib/module/processors/LayoutProcessor.js.map +0 -1
  259. package/lib/module/processors/LayoutProcessor.test.js +0 -53
  260. package/lib/module/processors/LayoutProcessor.test.js.map +0 -1
  261. package/lib/module/processors/LayoutProcessorsStore.js +0 -18
  262. package/lib/module/processors/LayoutProcessorsStore.js.map +0 -1
  263. package/lib/module/processors/LayoutProcessorsStore.test.js +0 -31
  264. package/lib/module/processors/LayoutProcessorsStore.test.js.map +0 -1
  265. package/lib/module/processors/OptionProcessorsStore.js +0 -19
  266. package/lib/module/processors/OptionProcessorsStore.js.map +0 -1
  267. package/lib/module/processors/OptionProcessorsStore.test.js +0 -31
  268. package/lib/module/processors/OptionProcessorsStore.test.js.map +0 -1
  269. package/lib/module/types.js +0 -2
  270. package/lib/module/types.js.map +0 -1
  271. package/scripts/setup-esm-shim.js +0 -53
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var LayoutProcessorsStore_exports = {};
20
+ __export(LayoutProcessorsStore_exports, {
21
+ LayoutProcessorsStore: () => LayoutProcessorsStore
22
+ });
23
+ module.exports = __toCommonJS(LayoutProcessorsStore_exports);
24
+ class LayoutProcessorsStore {
25
+ layoutProcessors = [];
26
+ addProcessor(processor) {
27
+ this.layoutProcessors.push(processor);
28
+ return {
29
+ remove: () => this.removeProcessor(processor)
30
+ };
31
+ }
32
+ getProcessors() {
33
+ return this.layoutProcessors;
34
+ }
35
+ removeProcessor(processor) {
36
+ this.layoutProcessors.splice(this.layoutProcessors.indexOf(processor));
37
+ }
38
+ }
39
+ // Annotate the CommonJS export names for ESM import in node:
40
+ 0 && (module.exports = {
41
+ LayoutProcessorsStore
42
+ });
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var OptionProcessorsStore_exports = {};
20
+ __export(OptionProcessorsStore_exports, {
21
+ OptionProcessorsStore: () => OptionProcessorsStore
22
+ });
23
+ module.exports = __toCommonJS(OptionProcessorsStore_exports);
24
+ class OptionProcessorsStore {
25
+ optionsProcessorsByObjectPath = {};
26
+ addProcessor(optionPath, processor) {
27
+ if (!this.optionsProcessorsByObjectPath[optionPath]) this.optionsProcessorsByObjectPath[optionPath] = [];
28
+ this.optionsProcessorsByObjectPath[optionPath].push(processor);
29
+ return {
30
+ remove: () => this.removeProcessor(optionPath, processor)
31
+ };
32
+ }
33
+ getProcessors(optionPath) {
34
+ return this.optionsProcessorsByObjectPath[optionPath];
35
+ }
36
+ removeProcessor(optionPath, processor) {
37
+ this.optionsProcessorsByObjectPath[optionPath].splice(this.optionsProcessorsByObjectPath[optionPath].indexOf(processor));
38
+ }
39
+ }
40
+ // Annotate the CommonJS export names for ESM import in node:
41
+ 0 && (module.exports = {
42
+ OptionProcessorsStore
43
+ });
@@ -0,0 +1 @@
1
+ "use strict";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ohos-ports/react-native-navigation",
3
- "version": "8.9.0-beta.4",
3
+ "version": "8.9.0-beta.6",
4
4
  "description": "React Native Navigation - truly native navigation for iOS and Android (HarmonyOS port)",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
@@ -15,28 +15,24 @@
15
15
  "url": "https://github.com/ohos-ports/ohos-ports.git",
16
16
  "directory": "ports/react-native-navigation/8.9.0"
17
17
  },
18
- "main": "./lib/module/index.js",
18
+ "main": "./lib/cjs/index.js",
19
19
  "types": "./lib/typescript/index.d.ts",
20
20
  "exports": {
21
21
  ".": {
22
22
  "types": "./lib/typescript/index.d.ts",
23
- "default": "./lib/module/index.js"
23
+ "default": "./lib/cjs/index.js"
24
24
  },
25
25
  "./Mock": {
26
26
  "types": "./lib/typescript/Mock/index.d.ts",
27
- "default": "./lib/module/Mock/index.js"
27
+ "default": "./lib/cjs/Mock/index.js"
28
28
  },
29
29
  "./package.json": "./package.json"
30
30
  },
31
31
  "files": [
32
32
  "lib",
33
- "scripts",
34
33
  "README.md",
35
34
  "LICENSE"
36
35
  ],
37
- "scripts": {
38
- "postinstall": "node scripts/setup-esm-shim.js"
39
- },
40
36
  "peerDependencies": {
41
37
  "react": "*",
42
38
  "@ohos-ports/react-native": "^0.87.1-beta.1"
@@ -51,6 +47,7 @@
51
47
  "lodash": "4.18.1",
52
48
  "prop-types": "15.x.x",
53
49
  "react-lifecycles-compat": "^3.0.4",
54
- "tslib": "1.9.3"
50
+ "tslib": "1.9.3",
51
+ "react-native": "npm:@ohos-ports/react-native@^0.87.1-beta.1"
55
52
  }
56
53
  }
@@ -1,212 +0,0 @@
1
- package com.reactnativenavigation.viewcontrollers.statusbar
2
-
3
- import android.animation.Animator
4
- import android.app.Activity
5
- import android.graphics.Color
6
- import android.view.View
7
- import android.view.Window
8
- import com.reactnativenavigation.RNNFeatureToggles.isEnabled
9
- import com.reactnativenavigation.RNNToggles
10
- import com.reactnativenavigation.options.Options
11
- import com.reactnativenavigation.options.StatusBarOptions
12
- import com.reactnativenavigation.options.StatusBarOptions.TextColorScheme
13
- import com.reactnativenavigation.options.params.Bool
14
- import com.reactnativenavigation.utils.ColorUtils.isColorLight
15
- import com.reactnativenavigation.utils.StubAnimationListener.Companion.onAnimatorEnd
16
- import com.reactnativenavigation.utils.SystemUiUtils.clearStatusBarTranslucency
17
- import com.reactnativenavigation.utils.SystemUiUtils.getStatusBarColor
18
- import com.reactnativenavigation.utils.SystemUiUtils.hideStatusBar
19
- import com.reactnativenavigation.utils.SystemUiUtils.isTranslucent
20
- import com.reactnativenavigation.utils.SystemUiUtils.setStatusBarColor
21
- import com.reactnativenavigation.utils.SystemUiUtils.setStatusBarColorScheme
22
- import com.reactnativenavigation.utils.SystemUiUtils.setStatusBarTranslucent
23
- import com.reactnativenavigation.utils.SystemUiUtils.showStatusBar
24
- import com.reactnativenavigation.viewcontrollers.viewcontroller.StatusBarColorAnimator
25
- import com.reactnativenavigation.viewcontrollers.viewcontroller.ViewController
26
- import java.lang.ref.WeakReference
27
-
28
- class StatusBarPresenter private constructor(
29
- activity: Activity,
30
- private val sbColorAnimator: StatusBarColorAnimator = StatusBarColorAnimator(activity)) {
31
-
32
- private val window = WeakReference(activity.window)
33
- private var hasPendingColorAnim = false
34
-
35
- fun applyOptions(viewController: ViewController<*>, options: StatusBarOptions) {
36
- if (!hasPendingColorAnim) {
37
- setStatusBarBackgroundColor(options)
38
- setTranslucent(options)
39
- }
40
- setTextColorScheme(options)
41
- setStatusBarVisible(viewController, options.visible)
42
- }
43
-
44
- fun mergeOptions(view: View, statusBar: StatusBarOptions) {
45
- mergeStatusBarBackgroundColor(statusBar)
46
- mergeTextColorScheme(statusBar)
47
- mergeTranslucent(statusBar)
48
- mergeStatusBarVisible(view, statusBar.visible)
49
- }
50
-
51
- fun onConfigurationChanged(options: StatusBarOptions) {
52
- setStatusBarBackgroundColor(options)
53
- setTextColorScheme(options)
54
- }
55
-
56
- fun bindViewController(newOptions: StatusBarOptions) {
57
- if (!isEnabled(RNNToggles.TOP_BAR_COLOR_ANIMATION__TABS)) {
58
- return
59
- }
60
-
61
- if (newOptions.backgroundColor.canApplyValue()) {
62
- val currentColor = getCurrentStatusBarBackgroundColor() ?: return
63
- val newColor = getStatusBarBackgroundColor(newOptions)
64
- createStatusBarColorAnimation(
65
- from = currentColor,
66
- to = newColor,
67
- translucent = newOptions.translucent.isTrue,
68
- ).start()
69
- }
70
- }
71
-
72
- fun getStatusBarPushAnimation(appearingOptions: Options): Animator? =
73
- if (isEnabled(RNNToggles.TOP_BAR_COLOR_ANIMATION__PUSH)) {
74
- getStatusBarColorAnimation(appearingOptions.statusBar)
75
- } else null
76
-
77
- fun getStatusBarPopAnimation(appearingOptions: Options, disappearingOptions: Options): Animator? =
78
- if (isEnabled(RNNToggles.TOP_BAR_COLOR_ANIMATION__PUSH)) {
79
- getStatusBarColorAnimation(appearingOptions.statusBar)
80
- } else null
81
-
82
- private fun setStatusBarBackgroundColor(statusBar: StatusBarOptions) {
83
- if (statusBar.backgroundColor.canApplyValue()) {
84
- val statusBarBackgroundColor: Int = getStatusBarBackgroundColor(statusBar)
85
- setStatusBarBackgroundColor(statusBarBackgroundColor, statusBar.translucent.isTrue)
86
- }
87
- }
88
-
89
- private fun setStatusBarBackgroundColor(color: Int, translucent: Boolean) {
90
- setStatusBarColor(window.get(), color, translucent)
91
- }
92
-
93
- private fun getStatusBarBackgroundColor(statusBar: StatusBarOptions): Int {
94
- val defaultColor =
95
- if (statusBar.visible.isTrueOrUndefined) Color.BLACK else Color.TRANSPARENT
96
- return statusBar.backgroundColor.get(defaultColor)!!
97
- }
98
-
99
- private fun setTextColorScheme(statusBar: StatusBarOptions) {
100
- val view = window.get()?.decorView
101
- //View.post is a Workaround, added to solve internal Samsung
102
- //Android 9 issues. For more info see https://github.com/wix/react-native-navigation/pull/7231
103
- view?.post {
104
- setStatusBarColorScheme(
105
- window.get(),
106
- view,
107
- isDarkTextColorScheme(statusBar)
108
- )
109
- }
110
- }
111
-
112
- private fun setTranslucent(options: StatusBarOptions) {
113
- val window = window.get()
114
- if (options.translucent.isTrue) {
115
- setStatusBarTranslucent(window)
116
- } else if (isTranslucent(window)) {
117
- clearStatusBarTranslucency(window)
118
- }
119
- }
120
-
121
- private fun setStatusBarVisible(viewController: ViewController<*>, visible: Bool) {
122
- val window = window.get() ?: return
123
- val view = if (viewController.view != null) viewController.view else window.decorView
124
- if (visible.isFalse) {
125
- hideStatusBar(window, view)
126
- } else {
127
- showStatusBar(window, view)
128
- }
129
- }
130
-
131
- private fun mergeStatusBarBackgroundColor(statusBar: StatusBarOptions) {
132
- if (statusBar.backgroundColor.hasValue()) {
133
- val statusBarBackgroundColor = getStatusBarBackgroundColor(statusBar)
134
- setStatusBarColor(
135
- window.get(), statusBarBackgroundColor,
136
- statusBar.translucent.isTrue
137
- )
138
- }
139
- }
140
-
141
- private fun mergeTextColorScheme(statusBar: StatusBarOptions) {
142
- if (!statusBar.textColorScheme.hasValue()) return
143
- setTextColorScheme(statusBar)
144
- }
145
-
146
- private fun mergeTranslucent(options: StatusBarOptions) {
147
- val window: Window = window.get() ?: return
148
- if (options.translucent.isTrue) {
149
- setStatusBarTranslucent(window)
150
- } else if (options.translucent.isFalse && isTranslucent(window)) {
151
- clearStatusBarTranslucency(window)
152
- }
153
- }
154
-
155
- private fun mergeStatusBarVisible(view: View, visible: Bool) {
156
- if (visible.hasValue()) {
157
- if (visible.isTrue) {
158
- showStatusBar(window.get(), view)
159
- } else {
160
- hideStatusBar(window.get(), view)
161
- }
162
- }
163
- }
164
-
165
- private fun isDarkTextColorScheme(statusBar: StatusBarOptions): Boolean {
166
- if (statusBar.textColorScheme == TextColorScheme.Dark) {
167
- return true
168
- }
169
-
170
- if (statusBar.textColorScheme == TextColorScheme.Light) {
171
- return false
172
- }
173
- return isColorLight(getStatusBarBackgroundColor(statusBar))
174
- }
175
-
176
- private fun getStatusBarColorAnimation(statusBarOptions: StatusBarOptions): Animator? {
177
- if (isEnabled(RNNToggles.TOP_BAR_COLOR_ANIMATION__TABS)) {
178
- getCurrentStatusBarBackgroundColor()?.let { currentColor ->
179
- val targetColor = statusBarOptions.backgroundColor
180
-
181
- if (targetColor.hasValue()) {
182
- val translucent = statusBarOptions.translucent.isTrue
183
- return createStatusBarColorAnimation(
184
- from = currentColor,
185
- to = targetColor.get(),
186
- translucent = translucent,
187
- )
188
- }
189
- }
190
- }
191
- return null
192
- }
193
-
194
- private fun createStatusBarColorAnimation(from: Int, to: Int, translucent: Boolean): Animator =
195
- sbColorAnimator.getAnimator(from, to, translucent).apply {
196
- addListener(onAnimatorEnd {
197
- hasPendingColorAnim = false
198
- })
199
- hasPendingColorAnim = true
200
- }
201
-
202
- private fun getCurrentStatusBarBackgroundColor() =
203
- getStatusBarColor(window.get())
204
-
205
- companion object {
206
- lateinit var instance: StatusBarPresenter
207
-
208
- fun init(activity: Activity) {
209
- instance = StatusBarPresenter(activity)
210
- }
211
- }
212
- }
@@ -1,331 +0,0 @@
1
- # JavaScript/TypeScript Architecture
2
-
3
- The JavaScript layer provides the public API and orchestrates communication between React components and native navigation implementations.
4
-
5
- ## Entry Point
6
-
7
- `index.ts` exports the `Navigation` singleton (a `NavigationDelegate` instance) along with re-exports from `Modal`, `EventsRegistry`, `Constants`, and all interfaces. Applications use `Navigation.*` for commands and `Navigation.events().*` for event subscriptions.
8
-
9
- ## Module Structure
10
-
11
- ```
12
- src/
13
- ├── index.ts # Main entry point, exports Navigation singleton
14
- ├── Navigation.ts # NavigationRoot - core orchestrator
15
- ├── NavigationDelegate.ts # Public API facade
16
- ├── adapters/ # Native bridge layer
17
- ├── commands/ # Command processing
18
- ├── components/ # React component management
19
- ├── events/ # Event system
20
- ├── interfaces/ # TypeScript type definitions
21
- ├── linking/ # Deep-linking framework (URL → command)
22
- └── processors/ # Extensibility hooks
23
- ```
24
-
25
- ## Core Classes
26
-
27
- ### NavigationDelegate (Public API)
28
- **File**: `NavigationDelegate.ts`
29
-
30
- Facade providing the public `Navigation` API. All methods proxy to `NavigationRoot`.
31
-
32
- ```typescript
33
- // Usage
34
- import { Navigation } from 'react-native-navigation';
35
- Navigation.setRoot({ root: { stack: { children: [...] } } });
36
- ```
37
-
38
- ### NavigationRoot (Core Orchestrator)
39
- **File**: `Navigation.ts`
40
-
41
- Coordinates all subsystems. Constructed with dependencies:
42
- - `NativeCommandsSender` - sends commands to native
43
- - `NativeEventsReceiver` - receives events from native
44
- - `AppRegistryService` - manages React Native component registry
45
-
46
- Initializes and coordinates:
47
- - `Store` - component instance & props storage
48
- - `ComponentRegistry` - component registration
49
- - `LayoutTreeParser` - converts layouts to internal nodes
50
- - `LayoutTreeCrawler` - processes layout trees
51
- - `Commands` - command execution
52
- - `EventsRegistry` - event subscriptions
53
- - `OptionsProcessor` - option processing
54
- - `LayoutProcessor` - layout transformations
55
-
56
- ## Adapters Layer
57
-
58
- Bridge between JavaScript and native/React Native APIs.
59
-
60
- | Adapter | Purpose |
61
- |---------|---------|
62
- | `NativeCommandsSender` | Wraps TurboModule for command dispatch |
63
- | `NativeEventsReceiver` | Wraps NativeEventEmitter for events |
64
- | `NativeRNNTurboModule` | TurboModule spec interface |
65
- | `NativeRNNTurboEventEmitter` | TurboModule event emitter spec |
66
- | `UniqueIdProvider` | Generates unique component/command IDs |
67
- | `ColorService` | Converts colors to native format |
68
- | `AssetResolver` | Resolves require() image assets (class: AssetService) |
69
- | `AppRegistryService` | Registers components with React Native |
70
- | `Constants` | Platform dimension constants |
71
- | `TouchablePreview` | 3D Touch / Haptic preview handling |
72
-
73
- ## Commands Layer
74
-
75
- ### Commands Class
76
- **File**: `commands/Commands.ts`
77
-
78
- Central command dispatcher. Each navigation command:
79
- 1. Validates input
80
- 2. Processes layout through pipeline
81
- 3. Sends to native via adapter
82
- 4. Returns promise with result
83
-
84
- ### Processing Pipeline
85
-
86
- The pipeline executes in this exact order:
87
-
88
- ```
89
- Input Layout (from API)
90
- ↓
91
- 1. OptionsCrawler.crawl() # Extract static options from component classes
92
- ↓
93
- 2. LayoutProcessor.process() # Apply registered layout processors
94
- ↓
95
- 3. LayoutTreeParser.parse() # Convert to internal LayoutNode tree
96
- ↓
97
- 4. LayoutTreeCrawler.crawl() # Process options, save props to Store
98
- ↓
99
- 5. OptionsProcessor (during crawl) # Resolve colors, assets, custom processors
100
- ↓
101
- 6. NativeCommandsSender # Send to native module
102
- ```
103
-
104
- ### LayoutNode (Internal Tree)
105
- ```typescript
106
- interface LayoutNode {
107
- id: string; // Unique identifier
108
- type: LayoutType; // Component|Stack|BottomTabs|etc
109
- data: {
110
- name?: string; // Component name
111
- options?: any; // Processed options
112
- passProps?: any; // Component props (cleared before native)
113
- };
114
- children: LayoutNode[];
115
- }
116
- ```
117
-
118
- ### LayoutType Enum
119
- ```typescript
120
- enum LayoutType {
121
- Component = 'Component',
122
- Stack = 'Stack',
123
- BottomTabs = 'BottomTabs',
124
- SideMenuRoot = 'SideMenuRoot',
125
- SideMenuCenter = 'SideMenuCenter',
126
- SideMenuLeft = 'SideMenuLeft',
127
- SideMenuRight = 'SideMenuRight',
128
- TopTabs = 'TopTabs',
129
- ExternalComponent = 'ExternalComponent',
130
- SplitView = 'SplitView',
131
- }
132
- ```
133
-
134
- ## Components Layer
135
-
136
- ### ComponentRegistry
137
- **File**: `components/ComponentRegistry.ts`
138
-
139
- Manages React component registration and wrapping.
140
-
141
- ```typescript
142
- Navigation.registerComponent('ScreenName', () => MyComponent);
143
- ```
144
-
145
- ### ComponentWrapper
146
- **File**: `components/ComponentWrapper.tsx`
147
-
148
- Higher-order component that:
149
- - Wraps original component with lifecycle management
150
- - Stores instance in `Store` for event dispatch
151
- - Injects `componentId` and `componentName` props
152
-
153
- ### Store
154
- **File**: `components/Store.ts`
155
-
156
- Centralized storage for:
157
- - `componentsByName` - registered component providers
158
- - `componentsInstancesById` - mounted component instances
159
- - `propsById` - static props by component ID
160
- - `pendingPropsById` - props awaiting component mount
161
- - `wrappedComponents` - cached wrapped components
162
- - `lazyRegistratorFn` - function for lazy component registration
163
-
164
- ## Events Layer
165
-
166
- ### EventsRegistry
167
- **File**: `events/EventsRegistry.ts`
168
-
169
- Public API for event subscriptions:
170
-
171
- ```typescript
172
- Navigation.events().registerComponentDidAppearListener(({ componentId }) => {});
173
- Navigation.events().registerCommandCompletedListener(({ commandId }) => {});
174
- ```
175
-
176
- ### ComponentEventsObserver
177
- **File**: `events/ComponentEventsObserver.ts`
178
-
179
- Dispatches events to component instance methods:
180
- - `componentWillAppear()`
181
- - `componentDidAppear()`
182
- - `componentDidDisappear()`
183
- - `navigationButtonPressed()`
184
- - `screenPopped()`
185
-
186
- ### CommandsObserver
187
- **File**: `events/CommandsObserver.ts`
188
-
189
- Notifies listeners of command lifecycle (start, complete).
190
-
191
- ## Events (Native → JS)
192
-
193
- | Event | Description |
194
- |-------|-------------|
195
- | `RNN.AppLaunched` | App initialization complete |
196
- | `RNN.ComponentWillAppear` | Component about to appear |
197
- | `RNN.ComponentDidAppear` | Component now visible |
198
- | `RNN.ComponentDidDisappear` | Component hidden |
199
- | `RNN.NavigationButtonPressed` | TopBar button tapped |
200
- | `RNN.BottomTabPressed` | Tab pressed (even if selected) |
201
- | `RNN.BottomTabSelected` | Tab selection changed |
202
- | `RNN.BottomTabLongPressed` | Tab long-pressed |
203
- | `RNN.ModalDismissed` | Modal was dismissed |
204
- | `RNN.ModalAttemptedToDismiss` | Swipe-to-dismiss attempted |
205
- | `RNN.ScreenPopped` | Screen removed from stack |
206
- | `RNN.SearchBarUpdated` | Search text changed |
207
- | `RNN.SearchBarCancelPressed` | Search cancelled |
208
- | `RNN.PreviewCompleted` | 3D Touch preview completed |
209
- | `RNN.CommandCompleted` | Navigation command finished |
210
-
211
- ## Linking Layer
212
-
213
- Implements URL-to-screen routing on top of the standard command pipeline. The whole feature is JS-only; it consumes URLs from RN's `Linking` module and dispatches `showModal` (or a user-supplied command) when a match is found.
214
-
215
- **Public surface** (proxied through `NavigationDelegate`):
216
- - `Navigation.setLinking(config)` — configure prefixes, screen map, and customization hooks
217
- - `Navigation.handleDeepLink(url)` — manually feed a URL (push notifications, branch.io, App Clips)
218
- - `Navigation.setLinkingReady(ready)` — user-controlled gate for deferred deep links
219
-
220
- **Internal modules** (`src/linking/`):
221
-
222
- | File | Purpose |
223
- |------|---------|
224
- | `LinkingHandler.ts` | Orchestrator. Subscribes to `Linking.url`/`getInitialURL`, drives the queue, dispatches matches. Instantiated by `NavigationRoot`. |
225
- | `URLParser.ts` | Strips prefix (longest match), removes fragment, decodes path segments + query params. |
226
- | `RouteMatcher.ts` | Compiles `ScreensConfig` into a `RouteNode` tree; matches paths to screen chains with parameter extraction. |
227
- | `DeferredLinkQueue.ts` | FIFO queue. Holds URLs until both gates open (root-ready + user-ready). |
228
- | `ModalLayoutBuilder.ts` | Default presentation: wraps the matched chain in a `stack`, merges params into `passProps`, filters React-reserved keys (`ref`, `key`). |
229
- | `types.ts` | Public types: `LinkingConfig`, `RouteMatch`, `ScreensConfig`, etc. (re-exported via `src/index.ts`). |
230
-
231
- **Readiness gates** — a URL is dispatched only when both are true:
232
- 1. **Root-ready** (automatic): the first `Navigation.setRoot()` has resolved. `NavigationRoot.setRoot` calls `linkingHandler.setRootReady()` after the promise resolves.
233
- 2. **User-ready** (optional): `config.isReady()` returns `true`, or `setLinkingReady(true)` was called.
234
-
235
- **Resolution priority** when a match is found:
236
- 1. `config.onLink(match)` — full escape hatch, RNN does nothing else
237
- 2. `config.getModal(match)` — custom modal layout
238
- 3. Default `ModalLayoutBuilder` output
239
-
240
- ## Processors Layer
241
-
242
- ### OptionProcessorsStore
243
- **File**: `processors/OptionProcessorsStore.ts`
244
-
245
- Registers custom option processors:
246
-
247
- ```typescript
248
- Navigation.addOptionProcessor('topBar.title.text', (value, commandName) => {
249
- return value.toUpperCase(); // Transform all titles
250
- });
251
- ```
252
-
253
- ### LayoutProcessorsStore
254
- **File**: `processors/LayoutProcessorsStore.ts`
255
-
256
- Registers layout transformers:
257
-
258
- ```typescript
259
- Navigation.addLayoutProcessor((layout, commandName) => {
260
- // Add default options to all components
261
- return layout;
262
- });
263
- ```
264
-
265
- ## Interfaces
266
-
267
- ### Layout Types
268
- **File**: `interfaces/Layout.ts`
269
-
270
- ```typescript
271
- interface LayoutRoot {
272
- root: Layout;
273
- modals?: any[];
274
- overlays?: any[];
275
- }
276
-
277
- type Layout = {
278
- component?: LayoutComponent;
279
- stack?: LayoutStack;
280
- bottomTabs?: LayoutBottomTabs;
281
- sideMenu?: LayoutSideMenu;
282
- splitView?: LayoutSplitView;
283
- topTabs?: LayoutTopTabs;
284
- externalComponent?: ExternalComponent;
285
- }
286
- ```
287
-
288
- ### Options Interface
289
- **File**: `interfaces/Options.ts` (comprehensive)
290
-
291
- Contains all configuration options for:
292
- - Status bar, navigation bars
293
- - Top bar (buttons, title, search)
294
- - Bottom tabs
295
- - Side menus
296
- - Modals, overlays
297
- - Animations
298
- - Layout parameters
299
-
300
- ### NavigationComponent
301
- **File**: `interfaces/NavigationComponent.ts`
302
-
303
- Base class for navigation-aware components:
304
-
305
- ```typescript
306
- class MyScreen extends NavigationComponent<Props> {
307
- static options: Options = { ... };
308
-
309
- componentDidAppear(event) { }
310
- navigationButtonPressed(event) { }
311
- }
312
- ```
313
-
314
- ## Dependencies
315
-
316
- **Production**:
317
- - `lodash` - utility functions
318
- - `hoist-non-react-statics` - HOC support
319
- - `react-lifecycles-compat` - lifecycle polyfill
320
- - `tslib` - TypeScript helpers
321
-
322
- **Peer**:
323
- - `react`, `react-native` (required)
324
- - `remx` (optional state management)
325
-
326
- ## Build Output
327
-
328
- Uses `react-native-builder-bob`:
329
- - **Source**: `src/`
330
- - **Output**: `lib/`
331
- - **Targets**: ESM modules + TypeScript declarations