@apexnative/navigation 1.0.0-alpha.1 → 1.0.0-alpha.11

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 (581) hide show
  1. package/ApexNavigation.podspec +2 -1
  2. package/CHANGELOG.md +132 -0
  3. package/README.md +147 -51
  4. package/android/CLAUDE.md +78 -25
  5. package/android/CORE.md +49 -25
  6. package/android/RECIPES.md +13 -6
  7. package/android/consumer-rules.pro +6 -0
  8. package/android/src/main/java/dev/apexnative/navigation/NavigationActivity.kt +85 -10
  9. package/android/src/main/java/dev/apexnative/navigation/NavigationApplication.kt +34 -13
  10. package/android/src/main/java/dev/apexnative/navigation/layout/LayoutChecks.kt +5 -1
  11. package/android/src/main/java/dev/apexnative/navigation/layout/LayoutNode.kt +6 -2
  12. package/android/src/main/java/dev/apexnative/navigation/nativescreen/NativeScreenContext.kt +2 -2
  13. package/android/src/main/java/dev/apexnative/navigation/options/AnimationsOptions.kt +2 -2
  14. package/android/src/main/java/dev/apexnative/navigation/options/BottomTabOptions.kt +1 -1
  15. package/android/src/main/java/dev/apexnative/navigation/options/BottomTabsOptions.kt +13 -8
  16. package/android/src/main/java/dev/apexnative/navigation/options/ButtonMenuOptions.kt +2 -2
  17. package/android/src/main/java/dev/apexnative/navigation/options/ButtonOptions.kt +3 -3
  18. package/android/src/main/java/dev/apexnative/navigation/options/HardwareBackButtonOptions.kt +9 -1
  19. package/android/src/main/java/dev/apexnative/navigation/options/LargeTitleOptions.kt +1 -1
  20. package/android/src/main/java/dev/apexnative/navigation/options/LayoutAnimation.kt +1 -1
  21. package/android/src/main/java/dev/apexnative/navigation/options/OptionKey.kt +18 -0
  22. package/android/src/main/java/dev/apexnative/navigation/options/OptionPaths.kt +91 -0
  23. package/android/src/main/java/dev/apexnative/navigation/options/OptionsCache.kt +8 -4
  24. package/android/src/main/java/dev/apexnative/navigation/options/SheetOptions.kt +7 -4
  25. package/android/src/main/java/dev/apexnative/navigation/options/SideMenuOptions.kt +6 -1
  26. package/android/src/main/java/dev/apexnative/navigation/options/StackAnimationOptions.kt +40 -2
  27. package/android/src/main/java/dev/apexnative/navigation/options/StatusBarOptions.kt +7 -3
  28. package/android/src/main/java/dev/apexnative/navigation/options/TitleOptions.kt +2 -2
  29. package/android/src/main/java/dev/apexnative/navigation/options/TopBarAppearanceOptions.kt +1 -1
  30. package/android/src/main/java/dev/apexnative/navigation/options/TopBarOptions.kt +16 -7
  31. package/android/src/main/java/dev/apexnative/navigation/options/UserChoices.kt +159 -0
  32. package/android/src/main/java/dev/apexnative/navigation/react/CommandAnswer.kt +29 -36
  33. package/android/src/main/java/dev/apexnative/navigation/react/CommandContract.kt +59 -0
  34. package/android/src/main/java/dev/apexnative/navigation/react/ContentHeights.kt +95 -0
  35. package/android/src/main/java/dev/apexnative/navigation/react/ContentMounts.kt +66 -0
  36. package/android/src/main/java/dev/apexnative/navigation/react/ErrorTexts.kt +75 -60
  37. package/android/src/main/java/dev/apexnative/navigation/react/Hinge.kt +35 -23
  38. package/android/src/main/java/dev/apexnative/navigation/react/NavigationTurboModule.kt +12 -7
  39. package/android/src/main/java/dev/apexnative/navigation/react/OptionsCommands.kt +42 -4
  40. package/android/src/main/java/dev/apexnative/navigation/react/PendingCalls.kt +48 -0
  41. package/android/src/main/java/dev/apexnative/navigation/react/ReactView.kt +54 -20
  42. package/android/src/main/java/dev/apexnative/navigation/react/ReloadCoordinator.kt +7 -6
  43. package/android/src/main/java/dev/apexnative/navigation/react/ScreenEnvironment.kt +177 -0
  44. package/android/src/main/java/dev/apexnative/navigation/react/ScreenRegions.kt +19 -50
  45. package/android/src/main/java/dev/apexnative/navigation/react/ScrollEvents.kt +49 -128
  46. package/android/src/main/java/dev/apexnative/navigation/react/events/AppearanceDispatcher.kt +50 -81
  47. package/android/src/main/java/dev/apexnative/navigation/react/events/EventContract.kt +226 -0
  48. package/android/src/main/java/dev/apexnative/navigation/react/events/EventEmitter.kt +135 -94
  49. package/android/src/main/java/dev/apexnative/navigation/react/events/NavigationState.kt +154 -0
  50. package/android/src/main/java/dev/apexnative/navigation/react/events/ScreenAppearance.kt +0 -6
  51. package/android/src/main/java/dev/apexnative/navigation/safearea/SafeAreaView.kt +12 -10
  52. package/android/src/main/java/dev/apexnative/navigation/slots/SlotContainers.kt +10 -7
  53. package/android/src/main/java/dev/apexnative/navigation/slots/SlotScreenView.kt +39 -19
  54. package/android/src/main/java/dev/apexnative/navigation/slots/SlotView.kt +16 -4
  55. package/android/src/main/java/dev/apexnative/navigation/slots/SlotViews.kt +40 -0
  56. package/android/src/main/java/dev/apexnative/navigation/utils/ImageKey.kt +66 -0
  57. package/android/src/main/java/dev/apexnative/navigation/utils/ImageLoader.kt +7 -89
  58. package/android/src/main/java/dev/apexnative/navigation/utils/ImageRequests.kt +76 -0
  59. package/android/src/main/java/dev/apexnative/navigation/utils/MaterialTheme.kt +5 -6
  60. package/android/src/main/java/dev/apexnative/navigation/utils/OptionImages.kt +262 -0
  61. package/android/src/main/java/dev/apexnative/navigation/utils/SystemAnimations.kt +36 -0
  62. package/android/src/main/java/dev/apexnative/navigation/utils/UiUtils.kt +3 -3
  63. package/android/src/main/java/dev/apexnative/navigation/utils/ViewController.kt +3 -1
  64. package/android/src/main/java/dev/apexnative/navigation/utils/ViewExtensions.kt +0 -13
  65. package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/arrangement/ArrangementController.kt +10 -7
  66. package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/arrangement/ArrangementDefinition.kt +9 -3
  67. package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/arrangement/ArrangementPlanner.kt +20 -15
  68. package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/arrangement/SecondaryScreenPresenter.kt +13 -5
  69. package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/bottomtabs/AppliedTabCalls.kt +49 -0
  70. package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/bottomtabs/BottomTabsCollapseBehavior.kt +5 -3
  71. package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/bottomtabs/BottomTabsController.kt +108 -34
  72. package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/bottomtabs/BottomTabsPresenter.kt +25 -24
  73. package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/bottomtabs/CustomTabRowGeometry.kt +22 -0
  74. package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/bottomtabs/TabItems.kt +3 -3
  75. package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/bottomtabs/TabsRoom.kt +0 -5
  76. package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/component/ComponentPresenter.kt +28 -7
  77. package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/component/ComponentViewController.kt +12 -9
  78. package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/component/ContentReadiness.kt +2 -2
  79. package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/component/RenderWait.kt +27 -7
  80. package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/component/ScreenFrame.kt +1 -1
  81. package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/component/ScreenReadiness.kt +103 -56
  82. package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/component/ScreenSafeArea.kt +29 -11
  83. package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/externalcomponent/ExternalComponentViewController.kt +2 -6
  84. package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/modal/ModalAnimations.kt +22 -24
  85. package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/modal/ModalCoordinator.kt +109 -21
  86. package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/modal/ModalRecord.kt +21 -6
  87. package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/modal/ModalSheet.kt +476 -73
  88. package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/modal/ModalViews.kt +57 -25
  89. package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/modal/SheetBack.kt +42 -0
  90. package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/modal/SheetStops.kt +83 -0
  91. package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/navigator/BackCallbackCheck.kt +50 -0
  92. package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/navigator/BackCallbackState.kt +49 -14
  93. package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/navigator/Navigator.kt +71 -12
  94. package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/navigator/RootCoordinator.kt +37 -11
  95. package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/overlay/OverlayCoordinator.kt +10 -8
  96. package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/parent/Capabilities.kt +11 -4
  97. package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/parent/ContainerBackground.kt +3 -3
  98. package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/parent/ParentController.kt +6 -6
  99. package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/sidemenu/SideMenuController.kt +42 -9
  100. package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/sidemenu/SideMenuMotion.kt +19 -8
  101. package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/sidemenu/SideMenuPresenter.kt +16 -7
  102. package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/sidemenu/SideMenuRules.kt +43 -4
  103. package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/splitview/SplitPanes.kt +23 -0
  104. package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/splitview/SplitViewController.kt +77 -17
  105. package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/stack/BackPreview.kt +315 -0
  106. package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/stack/PreparedFrame.kt +3 -3
  107. package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/stack/StackCommands.kt +30 -20
  108. package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/stack/StackController.kt +216 -18
  109. package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/stack/StackDisplay.kt +26 -1
  110. package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/stack/StackQueue.kt +149 -41
  111. package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/stack/StackTransitions.kt +26 -8
  112. package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/stack/StackViews.kt +115 -6
  113. package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/stack/fab/FabMotion.kt +142 -0
  114. package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/stack/fab/FabPresenter.kt +222 -48
  115. package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/stack/search/ScreenSearch.kt +3 -5
  116. package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/stack/search/StackSearchPresenter.kt +30 -34
  117. package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/stack/topbar/BarComponents.kt +5 -51
  118. package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/stack/topbar/BarRowTransition.kt +3 -2
  119. package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/stack/topbar/ButtonPlaces.kt +11 -5
  120. package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/stack/topbar/MenuChecks.kt +13 -56
  121. package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/stack/topbar/TopBarPresenter.kt +219 -54
  122. package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/stack/topbar/TopBarVisibility.kt +9 -2
  123. package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/viewcontroller/ScrollEventListener.kt +6 -9
  124. package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/viewcontroller/ViewController.kt +75 -21
  125. package/android/src/main/java/dev/apexnative/navigation/views/animations/AnimationLayer.kt +73 -0
  126. package/android/src/main/java/dev/apexnative/navigation/views/animations/Curves.kt +29 -11
  127. package/android/src/main/java/dev/apexnative/navigation/views/animations/ValueInterpolation.kt +14 -0
  128. package/android/src/main/java/dev/apexnative/navigation/views/bottomtabs/BottomTabs.kt +9 -7
  129. package/android/src/main/java/dev/apexnative/navigation/views/bottomtabs/BottomTabsLayout.kt +61 -2
  130. package/android/src/main/java/dev/apexnative/navigation/views/bottomtabs/CustomBottomTabItemView.kt +0 -5
  131. package/android/src/main/java/dev/apexnative/navigation/views/bottomtabs/CustomTabRow.kt +72 -10
  132. package/android/src/main/java/dev/apexnative/navigation/views/element/ElementStep.kt +31 -0
  133. package/android/src/main/java/dev/apexnative/navigation/views/element/ElementTransitions.kt +143 -135
  134. package/android/src/main/java/dev/apexnative/navigation/views/element/TargetsWait.kt +13 -5
  135. package/android/src/main/java/dev/apexnative/navigation/views/element/TransitionLayer.kt +37 -112
  136. package/android/src/main/java/dev/apexnative/navigation/views/element/TransitionTargets.kt +9 -6
  137. package/android/src/main/java/dev/apexnative/navigation/views/element/TransitionViews.kt +100 -0
  138. package/android/src/main/java/dev/apexnative/navigation/views/element/animators/ElementPictures.kt +112 -4
  139. package/android/src/main/java/dev/apexnative/navigation/views/element/animators/FlightGeometry.kt +346 -36
  140. package/android/src/main/java/dev/apexnative/navigation/views/element/animators/ImageMorph.kt +199 -0
  141. package/android/src/main/java/dev/apexnative/navigation/views/element/animators/SharedAnimatorFactory.kt +56 -41
  142. package/android/src/main/java/dev/apexnative/navigation/views/element/animators/TextMorph.kt +176 -0
  143. package/android/src/main/java/dev/apexnative/navigation/views/element/animators/ViewMorph.kt +108 -0
  144. package/android/src/main/java/dev/apexnative/navigation/views/sidemenu/SideMenuView.kt +12 -3
  145. package/android/src/main/java/dev/apexnative/navigation/views/stack/ScreenEdge.kt +45 -0
  146. package/android/src/main/java/dev/apexnative/navigation/views/stack/StackLayout.kt +140 -1
  147. package/android/src/main/java/dev/apexnative/navigation/views/stack/fab/Fab.kt +14 -10
  148. package/android/src/main/java/dev/apexnative/navigation/views/stack/fab/FabCopy.kt +85 -0
  149. package/android/src/main/java/dev/apexnative/navigation/views/stack/fab/FabMenu.kt +13 -0
  150. package/android/src/main/java/dev/apexnative/navigation/views/stack/topbar/TitleBar.kt +5 -17
  151. package/android/src/main/java/dev/apexnative/navigation/views/stack/topbar/TopBar.kt +73 -34
  152. package/android/src/main/java/dev/apexnative/navigation/views/stack/topbar/titlebar/BarButtonComponentCell.kt +6 -6
  153. package/android/src/main/java/dev/apexnative/navigation/views/stack/topbar/titlebar/BarButtonView.kt +113 -0
  154. package/android/src/main/java/dev/apexnative/navigation/views/stack/topbar/titlebar/BarMenu.kt +219 -0
  155. package/android/src/main/java/dev/apexnative/navigation/views/stack/topbar/titlebar/ButtonBar.kt +125 -178
  156. package/android/src/main/java/dev/apexnative/navigation/views/stack/topbar/titlebar/ButtonMenus.kt +34 -64
  157. package/android/src/main/java/dev/apexnative/navigation/views/stack/topbar/titlebar/ButtonRow.kt +216 -0
  158. package/android/src/main/jni/ANNContentHeights.cpp +82 -0
  159. package/android/src/main/res/drawable/apex_navigation_ic_arrow_right.xml +14 -0
  160. package/android/src/main/res/layout/apex_navigation_menu_header.xml +19 -0
  161. package/android/src/main/res/layout/apex_navigation_menu_item.xml +68 -0
  162. package/android/src/main/res/values/styles.xml +1 -1
  163. package/android/src/main/res/values-night/styles.xml +1 -1
  164. package/cli/app.js +1 -1
  165. package/cli/doctor/checks/app.js +77 -14
  166. package/cli/doctor/checks/splash.js +4 -22
  167. package/cli/migrate/native.js +18 -0
  168. package/cli/project.js +10 -2
  169. package/cli/setup/index.js +18 -0
  170. package/cli/setup/source.js +2 -1
  171. package/cli/setup/steps/appDelegate.js +66 -11
  172. package/cli/setup/steps/mainApplication.js +134 -19
  173. package/cli/setup/steps/metro.js +46 -0
  174. package/cli/setup/steps/sceneDelegate.js +108 -0
  175. package/cli/splash/index.js +3 -1
  176. package/docs-md/architecture/native-screens.md +4 -0
  177. package/docs-md/architecture/theme-and-context.md +131 -12
  178. package/docs-md/architecture/transitions.md +58 -12
  179. package/docs-md/containers/arrangement.md +17 -1
  180. package/docs-md/containers/modals.md +8 -4
  181. package/docs-md/containers/overlays.md +3 -1
  182. package/docs-md/containers/side-menu.md +19 -2
  183. package/docs-md/containers/tabs.md +5 -1
  184. package/docs-md/flows/bottom-sheets.md +4 -2
  185. package/docs-md/flows/forms-in-a-modal.md +1 -1
  186. package/docs-md/fundamentals/screens-and-props.md +9 -1
  187. package/docs-md/fundamentals/starting-the-app.md +1 -1
  188. package/docs-md/guides/cli.md +4 -3
  189. package/docs-md/guides/deep-links.md +15 -33
  190. package/docs-md/help/glossary.md +4 -4
  191. package/docs-md/help/troubleshooting.md +44 -6
  192. package/docs-md/index.json +61 -1
  193. package/docs-md/migration/from-expo-router.md +1 -1
  194. package/docs-md/migration/from-react-native-navigation.md +9 -3
  195. package/docs-md/migration/from-react-navigation.md +2 -2
  196. package/docs-md/screen-ui/back-and-gestures.md +46 -2
  197. package/docs-md/screen-ui/bar-buttons.md +5 -5
  198. package/docs-md/screen-ui/search.md +1 -1
  199. package/docs-md/screen-ui/system-ui.md +17 -12
  200. package/docs-md/screen-ui/toolbar-and-fab.md +4 -2
  201. package/docs-md/screen-ui/top-bar.md +8 -4
  202. package/docs-md/start/installation.md +21 -3
  203. package/ios/Animations/ANNFrameDriver.h +55 -15
  204. package/ios/Animations/ANNFrameDriver.mm +216 -60
  205. package/ios/Animations/ANNTransitionAnimator.h +26 -5
  206. package/ios/Animations/ANNTransitionAnimator.mm +61 -13
  207. package/ios/Animations/ANNTransitionPlan.h +2 -2
  208. package/ios/Animations/ANNTransitionPlan.mm +10 -0
  209. package/ios/Animations/ANNTransitionWait.mm +6 -7
  210. package/ios/Animations/Elements/ANNElementFinder.h +57 -0
  211. package/ios/Animations/Elements/ANNElementFinder.mm +174 -2
  212. package/ios/Animations/Elements/ANNElementTransition.h +10 -8
  213. package/ios/Animations/Elements/ANNElementTransition.mm +19 -21
  214. package/ios/Animations/Elements/ANNSharedElementFlight.h +16 -11
  215. package/ios/Animations/Elements/ANNSharedElementFlight.mm +308 -69
  216. package/ios/Animations/Interpolators/ANNInterpolate.h +2 -30
  217. package/ios/Animations/Interpolators/ANNTransformParts.h +48 -0
  218. package/ios/Animations/Interpolators/ANNTransformParts.mm +507 -0
  219. package/ios/Animations/Interpolators/ANNViewTracks.h +9 -6
  220. package/ios/Animations/Interpolators/ANNViewTracks.mm +100 -30
  221. package/ios/CLAUDE.md +60 -24
  222. package/ios/CORE.md +44 -34
  223. package/ios/Contract/ANNCommandAnswer.h +13 -5
  224. package/ios/Contract/ANNCommandAnswer.mm +40 -32
  225. package/ios/Contract/ANNCommandContract.h +15 -0
  226. package/ios/Contract/ANNCommandContract.mm +78 -0
  227. package/ios/Contract/ANNCommandRunner.h +10 -9
  228. package/ios/Contract/ANNCommandRunner.mm +22 -28
  229. package/ios/Contract/ANNErrorTexts.h +6 -2
  230. package/ios/Contract/ANNErrorTexts.mm +18 -10
  231. package/ios/Contract/ANNLayoutNode.h +3 -3
  232. package/ios/Contract/ANNLayoutReader.h +3 -3
  233. package/ios/Core/ANNAppDelegate.mm +0 -2
  234. package/ios/Core/ANNAppearanceDispatcher.h +5 -4
  235. package/ios/Core/ANNAppearanceDispatcher.mm +12 -1
  236. package/ios/Core/ANNDeepLinkQueue.h +22 -2
  237. package/ios/Core/ANNDeepLinkQueue.mm +121 -14
  238. package/ios/Core/ANNErrorHandler.h +9 -4
  239. package/ios/Core/ANNErrorHandler.mm +20 -2
  240. package/ios/Core/ANNEventContract.h +246 -0
  241. package/ios/Core/ANNEventContract.mm +225 -0
  242. package/ios/Core/ANNEventEmitter.h +6 -2
  243. package/ios/Core/ANNEventEmitter.mm +117 -80
  244. package/ios/Core/ANNHinge.h +6 -0
  245. package/ios/Core/ANNHinge.mm +15 -4
  246. package/ios/Core/ANNJavaScriptCalls.h +33 -0
  247. package/ios/Core/ANNJavaScriptCalls.mm +52 -0
  248. package/ios/Core/ANNLayoutProtocol.h +5 -5
  249. package/ios/Core/ANNNavigationState.h +7 -5
  250. package/ios/Core/ANNNavigationState.mm +8 -7
  251. package/ios/Core/ANNNodeHelper.h +32 -12
  252. package/ios/Core/ANNNodeHelper.mm +100 -3
  253. package/ios/Core/ANNParking.h +5 -4
  254. package/ios/Core/ANNReloadCoordinator.mm +5 -12
  255. package/ios/Core/ANNRenderWait.h +20 -6
  256. package/ios/Core/ANNRenderWait.mm +143 -56
  257. package/ios/Core/ANNSceneDelegate.mm +25 -15
  258. package/ios/Core/ANNSystemUI.h +3 -2
  259. package/ios/Core/ANNSystemUI.mm +7 -0
  260. package/ios/Core/ANNUtils.h +7 -0
  261. package/ios/Core/ANNUtils.mm +10 -0
  262. package/ios/Core/ApexNavigation+Internal.h +1 -1
  263. package/ios/Core/ApexNavigation.mm +7 -6
  264. package/ios/Core/UIViewController+LayoutProtocol.h +9 -2
  265. package/ios/Core/UIViewController+LayoutProtocol.mm +8 -0
  266. package/ios/Layouts/Arrangement/ANNArrangementState.h +2 -17
  267. package/ios/Layouts/Arrangement/ANNArrangementState.mm +0 -38
  268. package/ios/Layouts/Arrangement/ANNArrangementViewController.mm +195 -21
  269. package/ios/Layouts/Modal/ANNModalCoordinator.h +1 -1
  270. package/ios/Layouts/Modal/ANNModalCoordinator.mm +57 -16
  271. package/ios/Layouts/Modal/ANNModalPresentation.h +8 -5
  272. package/ios/Layouts/Modal/ANNModalPresentation.mm +12 -12
  273. package/ios/Layouts/Modal/ANNSheetPresenter.mm +83 -1
  274. package/ios/Layouts/Overlay/ANNOverlayCoordinator.mm +2 -8
  275. package/ios/Layouts/Root/ANNRootCoordinator.mm +58 -19
  276. package/ios/Layouts/Root/ANNSplashViewController.h +5 -3
  277. package/ios/Layouts/Root/ANNSplashViewController.mm +147 -0
  278. package/ios/Layouts/Screen/ANNComponentPresenter.h +11 -3
  279. package/ios/Layouts/Screen/ANNComponentPresenter.mm +34 -6
  280. package/ios/Layouts/Screen/ANNComponentViewController.h +15 -13
  281. package/ios/Layouts/Screen/ANNComponentViewController.mm +130 -75
  282. package/ios/Layouts/Screen/ANNNativeScreenContext.mm +7 -5
  283. package/ios/Layouts/Screen/ANNPreviewInteraction.h +7 -4
  284. package/ios/Layouts/Screen/ANNPreviewInteraction.mm +72 -10
  285. package/ios/Layouts/Screen/ANNScreenEnvironment.h +63 -0
  286. package/ios/Layouts/Screen/ANNScreenEnvironment.mm +181 -0
  287. package/ios/Layouts/Screen/ANNScreenPlace.h +53 -0
  288. package/ios/Layouts/Screen/ANNScreenPlace.mm +205 -0
  289. package/ios/Layouts/Screen/ANNScreenRegions.h +3 -18
  290. package/ios/Layouts/Screen/ANNScreenRegions.mm +9 -44
  291. package/ios/Layouts/Screen/ANNScreenSafeArea.h +4 -9
  292. package/ios/Layouts/Screen/ANNScreenSafeArea.mm +14 -16
  293. package/ios/Layouts/Screen/ANNScreenSettling.h +34 -0
  294. package/ios/Layouts/Screen/ANNScreenSettling.mm +171 -0
  295. package/ios/Layouts/SideMenu/ANNSideMenuTypes.h +8 -0
  296. package/ios/Layouts/SideMenu/ANNSideMenuViewController.mm +83 -14
  297. package/ios/Layouts/SplitView/ANNSplitViewCommands.h +3 -2
  298. package/ios/Layouts/SplitView/ANNSplitViewCommands.mm +105 -39
  299. package/ios/Layouts/SplitView/ANNSplitViewController.mm +7 -8
  300. package/ios/Layouts/Stack/ANNPreviewPush.h +7 -6
  301. package/ios/Layouts/Stack/ANNPreviewPush.mm +142 -27
  302. package/ios/Layouts/Stack/ANNStackAnimatingDelegate.h +11 -2
  303. package/ios/Layouts/Stack/ANNStackAnimatingDelegate.mm +14 -7
  304. package/ios/Layouts/Stack/ANNStackCommands.mm +1 -0
  305. package/ios/Layouts/Stack/ANNStackController.h +8 -0
  306. package/ios/Layouts/Stack/ANNStackController.mm +184 -16
  307. package/ios/Layouts/Stack/ANNStackQueue.h +5 -2
  308. package/ios/Layouts/Stack/ANNStackQueue.mm +56 -43
  309. package/ios/Layouts/Stack/ANNSwipePopInteraction.h +26 -0
  310. package/ios/Layouts/Stack/ANNSwipePopInteraction.mm +185 -0
  311. package/ios/Layouts/Stack/InteractivePopGestureDelegate.mm +28 -4
  312. package/ios/Layouts/Stack/UINavigationController+ANNCommands.h +4 -2
  313. package/ios/Layouts/Stack/UINavigationController+ANNCommands.mm +2 -3
  314. package/ios/Layouts/Tabs/ANNBottomTabItemBuilder.h +4 -0
  315. package/ios/Layouts/Tabs/ANNBottomTabItemBuilder.mm +11 -0
  316. package/ios/Layouts/Tabs/ANNBottomTabsAccessoryView.h +12 -1
  317. package/ios/Layouts/Tabs/ANNBottomTabsAccessoryView.mm +23 -0
  318. package/ios/Layouts/Tabs/ANNBottomTabsController.h +3 -0
  319. package/ios/Layouts/Tabs/ANNBottomTabsController.mm +237 -57
  320. package/ios/Layouts/Tabs/ANNBottomTabsCustomRow.mm +8 -3
  321. package/ios/Layouts/Tabs/ANNBottomTabsPresenter.h +6 -2
  322. package/ios/Layouts/Tabs/ANNBottomTabsPresenter.mm +232 -43
  323. package/ios/Layouts/Tabs/ANNTabsDesign.h +6 -5
  324. package/ios/Layouts/Tabs/ANNTabsDesign.mm +9 -1
  325. package/ios/Layouts/Tabs/UITabBar+utils.h +5 -5
  326. package/ios/Layouts/Tabs/UITabBar+utils.mm +32 -13
  327. package/ios/Options/ANNAnimationOptions.h +2 -1
  328. package/ios/Options/ANNAnimationOptions.mm +1 -1
  329. package/ios/Options/ANNBottomTabsOptions.h +2 -0
  330. package/ios/Options/ANNBottomTabsOptions.mm +1 -0
  331. package/ios/Options/ANNOptions.h +25 -0
  332. package/ios/Options/ANNOptions.mm +157 -1
  333. package/ios/Options/ANNOptionsCache.h +7 -6
  334. package/ios/Options/ANNOptionsReader.mm +108 -0
  335. package/ios/Options/ANNSearchBarOptions.h +4 -3
  336. package/ios/Options/ANNSheetOptions.h +4 -1
  337. package/ios/Options/ANNSideMenuOptions.h +2 -0
  338. package/ios/Options/ANNSideMenuOptions.mm +2 -0
  339. package/ios/Options/ANNStackPopAnimationOptions.h +13 -0
  340. package/ios/Options/ANNStackPopAnimationOptions.mm +11 -0
  341. package/ios/Options/ANNUserChoice.h +57 -0
  342. package/ios/Options/ANNUserChoice.mm +44 -0
  343. package/ios/Options/Params/ANNImageSource.h +61 -0
  344. package/ios/Options/Params/ANNImageSource.mm +101 -0
  345. package/ios/Options/Params/ANNOptionImages.h +37 -0
  346. package/ios/Options/Params/ANNOptionImages.mm +284 -0
  347. package/ios/Options/Params/ANNParam.h +15 -0
  348. package/ios/Options/Params/ANNParam.mm +61 -0
  349. package/ios/Options/Params/Color.h +3 -0
  350. package/ios/Options/Params/Color.mm +21 -0
  351. package/ios/Options/Params/ColorParser.h +4 -3
  352. package/ios/Options/Params/ColorParser.mm +22 -4
  353. package/ios/Options/Params/Image.h +15 -2
  354. package/ios/Options/Params/Image.mm +35 -2
  355. package/ios/Options/Params/ImageParser.h +5 -5
  356. package/ios/Options/Params/ImageParser.mm +28 -46
  357. package/ios/Public/ApexNavigation/ANNSceneDelegate.h +3 -0
  358. package/ios/Public/ApexNavigation/ApexNavigation.h +1 -1
  359. package/ios/RECIPES.md +13 -6
  360. package/ios/React/ANNReactView.mm +6 -25
  361. package/ios/React/ANNSafeAreaViewComponentView.mm +28 -17
  362. package/ios/React/ANNSurfaceHostingView.h +14 -0
  363. package/ios/React/ANNSurfaceHostingView.mm +144 -1
  364. package/ios/React/Slots/ANNSlotComponentView.mm +24 -17
  365. package/ios/React/Slots/ANNSlotContainers.h +14 -6
  366. package/ios/React/Slots/ANNSlotContainers.mm +75 -2
  367. package/ios/React/Slots/ANNSlotHost.mm +1 -3
  368. package/ios/React/Slots/ANNSlotScreenView.mm +8 -2
  369. package/ios/TopBar/ANNBackButtonPresenter.mm +6 -5
  370. package/ios/TopBar/ANNBarAppearance.h +2 -1
  371. package/ios/TopBar/ANNBarAppearance.mm +111 -30
  372. package/ios/TopBar/ANNBarBackgroundComponent.mm +16 -0
  373. package/ios/TopBar/ANNBarButtonComponentView.h +4 -4
  374. package/ios/TopBar/ANNBarButtonComponentView.mm +1 -1
  375. package/ios/TopBar/ANNBarButtons.h +14 -8
  376. package/ios/TopBar/ANNBarButtons.mm +397 -80
  377. package/ios/TopBar/ANNIconButtonImage.h +1 -0
  378. package/ios/TopBar/ANNIconButtonImage.mm +34 -1
  379. package/ios/TopBar/ANNLargeTitlePresenter.h +13 -0
  380. package/ios/TopBar/ANNLargeTitlePresenter.mm +50 -7
  381. package/ios/TopBar/ANNMainList.h +3 -0
  382. package/ios/TopBar/ANNMainList.mm +4 -0
  383. package/ios/TopBar/ANNScrollEdgeEffects.h +22 -6
  384. package/ios/TopBar/ANNScrollEdgeEffects.mm +123 -16
  385. package/ios/TopBar/ANNSearchPresenter.mm +172 -21
  386. package/ios/TopBar/ANNSearchResultsViewController.mm +29 -6
  387. package/ios/TopBar/ANNTopBarPresenter.h +8 -2
  388. package/ios/TopBar/ANNTopBarPresenter.mm +155 -33
  389. package/ios/TurboModules/ANNTurboEventEmitter.mm +4 -35
  390. package/ios/TurboModules/ANNTurboModule.mm +104 -33
  391. package/ios/cpp/react/renderer/components/ApexNavigationSpec/ANNSlotState.cpp +20 -0
  392. package/ios/cpp/react/renderer/components/ApexNavigationSpec/ANNSlotState.h +5 -14
  393. package/lib/module/ARCHITECTURE.md +40 -27
  394. package/lib/module/adapters/NativeANNTurboModule.js.map +1 -1
  395. package/lib/module/api/app/AppRegistry.js +14 -2
  396. package/lib/module/api/app/AppRegistry.js.map +1 -1
  397. package/lib/module/api/app/createNavigation.js +190 -66
  398. package/lib/module/api/app/createNavigation.js.map +1 -1
  399. package/lib/module/api/commands/commands.js +54 -6
  400. package/lib/module/api/commands/commands.js.map +1 -1
  401. package/lib/module/api/events/navigationEvents.js +6 -2
  402. package/lib/module/api/events/navigationEvents.js.map +1 -1
  403. package/lib/module/api/hooks/useNavigation.js +8 -3
  404. package/lib/module/api/hooks/useNavigation.js.map +1 -1
  405. package/lib/module/api/hooks/useSafeAreaInsets.js +4 -3
  406. package/lib/module/api/hooks/useSafeAreaInsets.js.map +1 -1
  407. package/lib/module/api/linking/dispatchedLinks.js +23 -0
  408. package/lib/module/api/linking/dispatchedLinks.js.map +1 -0
  409. package/lib/module/api/linking/linking.js +11 -0
  410. package/lib/module/api/linking/linking.js.map +1 -1
  411. package/lib/module/api/navigation.js.map +1 -1
  412. package/lib/module/api/options/OptionsChain.js +2 -2
  413. package/lib/module/api/screens/arrangement.js +5 -2
  414. package/lib/module/api/screens/arrangement.js.map +1 -1
  415. package/lib/module/api/screens/defineScreen.js +45 -3
  416. package/lib/module/api/screens/defineScreen.js.map +1 -1
  417. package/lib/module/api/screens/nativeScreens.js +31 -6
  418. package/lib/module/api/screens/nativeScreens.js.map +1 -1
  419. package/lib/module/api/screens/registerScreens.js +193 -35
  420. package/lib/module/api/screens/registerScreens.js.map +1 -1
  421. package/lib/module/api/theme/theme.js +5 -0
  422. package/lib/module/api/theme/theme.js.map +1 -1
  423. package/lib/module/engine/commands.js +51 -9
  424. package/lib/module/engine/commands.js.map +1 -1
  425. package/lib/module/engine/layout.js +20 -11
  426. package/lib/module/engine/layout.js.map +1 -1
  427. package/lib/module/engine/nativeScreens.js +9 -0
  428. package/lib/module/engine/nativeScreens.js.map +1 -1
  429. package/lib/module/engine/options.js +49 -15
  430. package/lib/module/engine/options.js.map +1 -1
  431. package/lib/module/engine/optionsChange.js +102 -0
  432. package/lib/module/engine/optionsChange.js.map +1 -0
  433. package/lib/module/engine/places.js +52 -7
  434. package/lib/module/engine/places.js.map +1 -1
  435. package/lib/module/engine/props.js +30 -1
  436. package/lib/module/engine/props.js.map +1 -1
  437. package/lib/module/engine/refresh.js +85 -0
  438. package/lib/module/engine/refresh.js.map +1 -0
  439. package/lib/module/engine/rememberedOptions.js +61 -1
  440. package/lib/module/engine/rememberedOptions.js.map +1 -1
  441. package/lib/module/engine/screens.js +77 -16
  442. package/lib/module/engine/screens.js.map +1 -1
  443. package/lib/module/interfaces/contract/commands.json +101 -0
  444. package/lib/module/interfaces/contract/errors.json +275 -0
  445. package/lib/typescript/adapters/NativeANNTurboModule.d.ts +12 -2
  446. package/lib/typescript/adapters/NativeANNTurboModule.d.ts.map +1 -1
  447. package/lib/typescript/api/app/AppRegistry.d.ts.map +1 -1
  448. package/lib/typescript/api/app/createNavigation.d.ts +8 -3
  449. package/lib/typescript/api/app/createNavigation.d.ts.map +1 -1
  450. package/lib/typescript/api/commands/commands.d.ts.map +1 -1
  451. package/lib/typescript/api/commands/presentation.d.ts +4 -3
  452. package/lib/typescript/api/commands/presentation.d.ts.map +1 -1
  453. package/lib/typescript/api/events/navigationEvents.d.ts +3 -3
  454. package/lib/typescript/api/events/navigationEvents.d.ts.map +1 -1
  455. package/lib/typescript/api/hooks/useNavigation.d.ts +1 -1
  456. package/lib/typescript/api/hooks/useNavigation.d.ts.map +1 -1
  457. package/lib/typescript/api/hooks/useSafeAreaInsets.d.ts +4 -3
  458. package/lib/typescript/api/hooks/useSafeAreaInsets.d.ts.map +1 -1
  459. package/lib/typescript/api/index.d.ts +1 -1
  460. package/lib/typescript/api/index.d.ts.map +1 -1
  461. package/lib/typescript/api/linking/dispatchedLinks.d.ts +7 -0
  462. package/lib/typescript/api/linking/dispatchedLinks.d.ts.map +1 -0
  463. package/lib/typescript/api/linking/linking.d.ts +8 -0
  464. package/lib/typescript/api/linking/linking.d.ts.map +1 -1
  465. package/lib/typescript/api/navigation.d.ts +4 -1
  466. package/lib/typescript/api/navigation.d.ts.map +1 -1
  467. package/lib/typescript/api/options/OptionsChain.d.ts +2 -2
  468. package/lib/typescript/api/screens/arrangement.d.ts +12 -2
  469. package/lib/typescript/api/screens/arrangement.d.ts.map +1 -1
  470. package/lib/typescript/api/screens/defineScreen.d.ts +23 -4
  471. package/lib/typescript/api/screens/defineScreen.d.ts.map +1 -1
  472. package/lib/typescript/api/screens/nativeScreens.d.ts +8 -1
  473. package/lib/typescript/api/screens/nativeScreens.d.ts.map +1 -1
  474. package/lib/typescript/api/screens/registerScreens.d.ts.map +1 -1
  475. package/lib/typescript/api/theme/theme.d.ts +2 -0
  476. package/lib/typescript/api/theme/theme.d.ts.map +1 -1
  477. package/lib/typescript/engine/commands.d.ts +5 -0
  478. package/lib/typescript/engine/commands.d.ts.map +1 -1
  479. package/lib/typescript/engine/layout.d.ts.map +1 -1
  480. package/lib/typescript/engine/nativeScreens.d.ts +5 -0
  481. package/lib/typescript/engine/nativeScreens.d.ts.map +1 -1
  482. package/lib/typescript/engine/options.d.ts +5 -2
  483. package/lib/typescript/engine/options.d.ts.map +1 -1
  484. package/lib/typescript/engine/optionsChange.d.ts +28 -0
  485. package/lib/typescript/engine/optionsChange.d.ts.map +1 -0
  486. package/lib/typescript/engine/places.d.ts +7 -2
  487. package/lib/typescript/engine/places.d.ts.map +1 -1
  488. package/lib/typescript/engine/props.d.ts +8 -1
  489. package/lib/typescript/engine/props.d.ts.map +1 -1
  490. package/lib/typescript/engine/refresh.d.ts +35 -0
  491. package/lib/typescript/engine/refresh.d.ts.map +1 -0
  492. package/lib/typescript/engine/rememberedOptions.d.ts +13 -0
  493. package/lib/typescript/engine/rememberedOptions.d.ts.map +1 -1
  494. package/lib/typescript/engine/screens.d.ts +27 -6
  495. package/lib/typescript/engine/screens.d.ts.map +1 -1
  496. package/lib/typescript/interfaces/ComponentEvents.d.ts +4 -4
  497. package/lib/typescript/interfaces/ComponentEvents.d.ts.map +1 -1
  498. package/lib/typescript/interfaces/Events.d.ts +28 -10
  499. package/lib/typescript/interfaces/Events.d.ts.map +1 -1
  500. package/lib/typescript/interfaces/Options.d.ts +1 -1
  501. package/lib/typescript/interfaces/Options.d.ts.map +1 -1
  502. package/lib/typescript/interfaces/options/animations.d.ts +80 -22
  503. package/lib/typescript/interfaces/options/animations.d.ts.map +1 -1
  504. package/lib/typescript/interfaces/options/bottomTabs.d.ts +21 -7
  505. package/lib/typescript/interfaces/options/bottomTabs.d.ts.map +1 -1
  506. package/lib/typescript/interfaces/options/buttons.d.ts +23 -15
  507. package/lib/typescript/interfaces/options/buttons.d.ts.map +1 -1
  508. package/lib/typescript/interfaces/options/modals.d.ts +34 -26
  509. package/lib/typescript/interfaces/options/modals.d.ts.map +1 -1
  510. package/lib/typescript/interfaces/options/sideMenu.d.ts +23 -6
  511. package/lib/typescript/interfaces/options/sideMenu.d.ts.map +1 -1
  512. package/lib/typescript/interfaces/options/stack.d.ts +17 -3
  513. package/lib/typescript/interfaces/options/stack.d.ts.map +1 -1
  514. package/lib/typescript/interfaces/options/system.d.ts +18 -11
  515. package/lib/typescript/interfaces/options/system.d.ts.map +1 -1
  516. package/lib/typescript/interfaces/options/toolbar.d.ts +2 -2
  517. package/lib/typescript/interfaces/options/topBar.d.ts +68 -38
  518. package/lib/typescript/interfaces/options/topBar.d.ts.map +1 -1
  519. package/metro/acceptPlugin.js +57 -0
  520. package/metro/babelTransformer.js +45 -0
  521. package/metro/index.js +36 -0
  522. package/package.json +3 -1
  523. package/src/ARCHITECTURE.md +40 -27
  524. package/src/adapters/NativeANNTurboModule.ts +12 -2
  525. package/src/api/app/AppRegistry.ts +16 -2
  526. package/src/api/app/createNavigation.ts +203 -69
  527. package/src/api/commands/commands.ts +48 -7
  528. package/src/api/commands/presentation.ts +4 -3
  529. package/src/api/events/navigationEvents.ts +10 -4
  530. package/src/api/hooks/useNavigation.ts +9 -4
  531. package/src/api/hooks/useSafeAreaInsets.ts +4 -3
  532. package/src/api/index.ts +1 -0
  533. package/src/api/linking/dispatchedLinks.ts +18 -0
  534. package/src/api/linking/linking.ts +22 -1
  535. package/src/api/navigation.ts +4 -1
  536. package/src/api/options/OptionsChain.ts +2 -2
  537. package/src/api/screens/arrangement.ts +17 -4
  538. package/src/api/screens/defineScreen.ts +49 -5
  539. package/src/api/screens/nativeScreens.ts +40 -4
  540. package/src/api/screens/registerScreens.tsx +185 -42
  541. package/src/api/theme/theme.ts +5 -0
  542. package/src/engine/commands.ts +70 -13
  543. package/src/engine/layout.ts +27 -11
  544. package/src/engine/nativeScreens.ts +10 -1
  545. package/src/engine/options.ts +45 -19
  546. package/src/engine/optionsChange.ts +107 -0
  547. package/src/engine/places.ts +65 -7
  548. package/src/engine/props.ts +30 -1
  549. package/src/engine/refresh.ts +97 -0
  550. package/src/engine/rememberedOptions.ts +74 -1
  551. package/src/engine/screens.tsx +76 -21
  552. package/src/interfaces/ComponentEvents.ts +4 -4
  553. package/src/interfaces/Events.ts +29 -10
  554. package/src/interfaces/Options.ts +1 -0
  555. package/src/interfaces/contract/commands.json +101 -0
  556. package/src/interfaces/contract/errors.json +275 -0
  557. package/src/interfaces/options/animations.ts +81 -22
  558. package/src/interfaces/options/bottomTabs.ts +21 -7
  559. package/src/interfaces/options/buttons.ts +23 -15
  560. package/src/interfaces/options/modals.ts +34 -26
  561. package/src/interfaces/options/sideMenu.ts +24 -6
  562. package/src/interfaces/options/stack.ts +17 -3
  563. package/src/interfaces/options/system.ts +18 -11
  564. package/src/interfaces/options/toolbar.ts +2 -2
  565. package/src/interfaces/options/topBar.ts +68 -38
  566. package/android/src/main/java/dev/apexnative/navigation/react/ArrangementStates.kt +0 -41
  567. package/android/src/main/java/dev/apexnative/navigation/react/ScreenInsets.kt +0 -69
  568. package/android/src/main/java/dev/apexnative/navigation/react/events/NavigationStateReporter.kt +0 -62
  569. package/android/src/main/java/dev/apexnative/navigation/react/events/StateHold.kt +0 -62
  570. package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/bottomtabs/CustomTabRowPlacer.kt +0 -223
  571. package/android/src/main/java/dev/apexnative/navigation/views/element/ElementStub.kt +0 -31
  572. package/android/src/main/java/dev/apexnative/navigation/views/element/animators/ImageMatrixAnimator.kt +0 -138
  573. package/android/src/main/java/dev/apexnative/navigation/views/element/animators/PlainViewAnimator.kt +0 -88
  574. package/android/src/main/java/dev/apexnative/navigation/views/element/animators/PropertyAnimatorCreator.kt +0 -33
  575. package/android/src/main/java/dev/apexnative/navigation/views/element/animators/ReactImageAnimator.kt +0 -66
  576. package/android/src/main/java/dev/apexnative/navigation/views/element/animators/TextChangeAnimator.kt +0 -179
  577. package/android/src/main/java/dev/apexnative/navigation/views/element/animators/ViewChangeAnimator.kt +0 -139
  578. package/ios/Layouts/Screen/ANNScreenInsets.h +0 -30
  579. package/ios/Layouts/Screen/ANNScreenInsets.mm +0 -68
  580. package/ios/Layouts/Tabs/ANNTabsPreloadWindow.h +0 -27
  581. package/ios/Layouts/Tabs/ANNTabsPreloadWindow.mm +0 -55
@@ -34,20 +34,24 @@ export interface OptionsLayout {
34
34
  * indicator or navigation bar, the camera cutout. `[]` lets the content reach every edge. The array replaces the
35
35
  * one from a lower layer. The screen adds the padding itself; `useSafeAreaInsets()` returns what is still covered,
36
36
  * which is 0 on an edge the screen keeps and the whole covered size on an edge where the content goes under a bar.
37
- * Edges listed here always win, also for a screen with a large title.
37
+ * Edges listed here win, but the top under a large title: there the list keeps its first rows clear of the bar
38
+ * itself and scrolls under it, which collapses the title, so a `'top'` listed here counts for nothing.
38
39
  *
39
- * Without it, on iOS: every edge except those where the content goes under a bar that shows (the top bar, a tab
40
- * bar or toolbar at the bottom, the side of a vertical bar); a screen with a large title keeps the top free so its
41
- * list can scroll under the bar. On Android: all four edges, except the top under a top bar that hides on scroll
42
- * or under a large title, and the bottom under tabs that hide on scroll.
40
+ * Without it the screen keeps the top and the sides, and its content goes down to the bottom: under the home
41
+ * indicator or the navigation bar, and under a tab bar or toolbar it goes under. A list keeps its last rows clear
42
+ * with `useSafeAreaInsets().bottom`. The top is free where the content goes under a top bar: on iOS under a bar
43
+ * that shows, on Android under a bar that hides on scroll; on both under a large title, so the list scrolls under
44
+ * the bar. On iOS the side of a vertical bar is free too. To have the screen keep the bottom, list every edge it
45
+ * keeps: listed edges replace the default.
43
46
  */
44
47
  safeAreaEdges?: SafeAreaEdge[];
45
48
  /**
46
49
  * The color of the screen, also under its React content. On iOS it is the background of the screen's view (the
47
50
  * system background without it); stacks, tabs and side menus paint their view with the color of the screen that
48
51
  * shows, seen behind transparent bars and around screens during transitions. On Android it fills the screen and
49
- * its containers but leaves room at the top for the status bar while it shows. `null` makes the background
50
- * transparent. Without it, Android shows the window's background (the app theme).
52
+ * its containers but leaves room at the top for the status bar while it shows; without it a React screen takes
53
+ * `android:colorBackground` of the app's theme (in a sheet it shows the sheet's surface, and a native screen paints
54
+ * its own view), so the screen below never shows through. `null` makes the background transparent.
51
55
  */
52
56
  backgroundColor?: Color;
53
57
  /**
@@ -152,7 +156,9 @@ export interface OptionsStatusBar {
152
156
  * and buttons sits below the bar), and a screen without a top bar starts below the bar. `true` lets a screen without
153
157
  * a top bar start at the top of the window, with its safe area keeping content below. `false` starts the top bar
154
158
  * below the status bar, which keeps its own color. A sheet modal has no status bar above it, so this does not apply
155
- * there. On iOS the screen is always under the status bar and the safe area keeps the content below.
159
+ * there. An overlay covers the whole window, so its screens go under the status bar without it (a dimmed backdrop
160
+ * dims the status bar too), and `false`, in its options or in the default options, starts them below. On iOS the
161
+ * screen is always under the status bar and the safe area keeps the content below.
156
162
  */
157
163
  drawBehind?: boolean;
158
164
  /**
@@ -177,9 +183,10 @@ export interface OptionsStatusBar {
177
183
  */
178
184
  hideWithTopBar?: boolean;
179
185
  /**
180
- * (iOS) Whether a blur shows under the status bar, drawn over the screen in the frame the status bar has when the
181
- * option applies. It applies when the screen appears and through `mergeOptions`; `false` removes it. The blur does
182
- * not follow a rotation or a change of window size.
186
+ * (iOS) Whether a blur shows under the status bar, drawn over the screen in the status bar's frame. It applies when
187
+ * the screen appears and through `mergeOptions`; `false` removes it. The blur follows the status bar's frame as it
188
+ * changes: a rotation, a new window size, the status bar hidden or shown. Android has no blur under the status bar,
189
+ * so it does nothing there.
183
190
  * @default false
184
191
  */
185
192
  blur?: boolean;
@@ -4,7 +4,7 @@ import type { OptionsTopBarButton } from './buttons';
4
4
  export interface OptionsToolbarSpace {
5
5
  /**
6
6
  * `'flexibleSpace'` takes the free width and pushes the next buttons to the far edge; `'fixedSpace'` is a gap of zero
7
- * width that starts a new capsule on iOS 26.
7
+ * width that starts a new capsule with the glass design (iOS 26+).
8
8
  */
9
9
  systemItem: 'flexibleSpace' | 'fixedSpace';
10
10
  }
@@ -36,7 +36,7 @@ export interface OptionsToolbar {
36
36
  * The buttons from the leading edge, in the format of the bar buttons: text, icon, SF Symbol, `systemItem`, a
37
37
  * component (drawn before the screen shows), `enabled`, `color`, `style`, `menu` (it opens upward), `toggle`,
38
38
  * `showText`, `group`; also spaces and the search field. A press sends a button press. The color of a side doesn't
39
- * apply to them, and badges are not drawn. On iOS 26 each button has its own capsule, neighbor icons with the same
39
+ * apply to them, and badges are not drawn. With the glass design (iOS 26+, see `UIDesignRequiresCompatibility`) each button has its own capsule, neighbor icons with the same
40
40
  * `group` share one (the toolbar has no real groups, so text buttons never share), and a zero-width space is put
41
41
  * between neighbors of different groups unless an explicit space is there. The list is replaced as a whole;
42
42
  * `mergeOptions` animates it.
@@ -11,7 +11,11 @@ import type { Color, FontFamily, FontStyle, FontWeight, ImageResource } from './
11
11
  * `name` replaces it.
12
12
  */
13
13
  export interface OptionsTopBarTitleComponent {
14
- /** The id of the component. Without it, the library gives one. The same `name` and `id` mean the same component. */
14
+ /**
15
+ * The id of the component. Without it, the library gives one made of the screen, the component's place in the
16
+ * options and its `name`: it stays the same for every `mergeOptions` of the screen, so the mounted component stays
17
+ * and only its props change. The same `name` and `id` mean the same component.
18
+ */
15
19
  id?: string;
16
20
  /** The name of the registered component. */
17
21
  name: string;
@@ -46,7 +50,7 @@ export interface OptionsTopBarTitleDocument {
46
50
  export interface OptionsTopBarTitle {
47
51
  /**
48
52
  * The text of the title. Setting it removes a React title. On iOS it is the title of the screen's navigation item,
49
- * the label the system shows on the next screen's back button before iOS 26, and what Rename edits. On Android it
53
+ * the label the system shows on the next screen's back button without the glass design, and what Rename edits. On Android it
50
54
  * is one line cut with an ellipsis, and also the text of the large title; a title component set together with the
51
55
  * text drops the text and the subtitle (with a warning in development).
52
56
  */
@@ -90,9 +94,9 @@ export interface OptionsTopBarTitle {
90
94
  */
91
95
  document?: OptionsTopBarTitleDocument;
92
96
  /**
93
- * (iOS 26+) Puts the title on a Liquid Glass capsule like the buttons: `'regular'` or `'clear'`; `'none'` and any
97
+ * (iOS 26+, glass design) Puts the title on a Liquid Glass capsule like the buttons: `'regular'` or `'clear'`; `'none'` and any
94
98
  * other value mean no capsule. A text title and the subtitle are two lines on the capsule; a component title sits on
95
- * it as it is, the capsule taking its size. Before iOS 26 and on Android it does nothing.
99
+ * it as it is, the capsule taking its size. Without the glass design (see `UIDesignRequiresCompatibility`) and on Android it does nothing.
96
100
  */
97
101
  glass?: 'regular' | 'clear' | 'none';
98
102
  /** (Android) The height of the row of title and buttons, in dp. By default 64, regardless of `topBar.height`. */
@@ -114,15 +118,15 @@ export interface OptionsTopBarTitle {
114
118
  /** The subtitle: a second line under the title. */
115
119
  export interface OptionsTopBarSubtitle {
116
120
  /**
117
- * The text of the second line. An empty text removes it. On iOS 26 it is the system subtitle, under the title, the
118
- * large title and the collapsed bar, and on the capsule when the title has `glass`; a React title hides it. Before
119
- * iOS 26 it makes a two-line title view, only without a large title or a React title. On Android it is the line under
121
+ * The text of the second line. An empty text removes it. With the glass design (iOS 26+, see `UIDesignRequiresCompatibility`) it is the system subtitle, under the title, the
122
+ * large title and the collapsed bar, and on the capsule when the title has `glass`; a React title hides it. Without
123
+ * it, it makes a two-line title view, only without a large title or a React title. On Android it is the line under
120
124
  * the title, hidden when empty and dropped when the title is a component.
121
125
  */
122
126
  text?: string;
123
127
  /**
124
- * The size of the font. On iOS 26 only what is set goes to the system subtitle, and any font option sets the whole
125
- * font; before iOS 26 the size is 12. On Android it is in sp, 14 by default.
128
+ * The size of the font. With the glass design only what is set goes to the system subtitle, and any font option sets the whole
129
+ * font; without it the size is 12. On Android it is in sp, 14 by default.
126
130
  */
127
131
  fontSize?: number;
128
132
  /** The color of the subtitle. On Android the theme's on-surface-variant color by default. */
@@ -173,14 +177,14 @@ export interface OptionsTopBarBackButton {
173
177
  */
174
178
  visible?: boolean;
175
179
  /**
176
- * (iOS) The text of the back button. On iOS 26 the system button without it is an arrow alone, since the title of
177
- * the screen below is never shown; before iOS 26 it is that title while it fits. It is set on the screen below, as
180
+ * (iOS) The text of the back button. With the glass design (iOS 26+, see `UIDesignRequiresCompatibility`) the system button without it is an arrow alone,
181
+ * since the title of the screen below is never shown; without it, it is that title while it fits. It is set on the screen below, as
178
182
  * its back button title.
179
183
  */
180
184
  title?: string;
181
185
  /**
182
186
  * (iOS) `true` shows the title of the screen below (or `title`), `false` shows an arrow alone (the minimal mode).
183
- * Without it the system decides; on iOS 26 that is the arrow.
187
+ * Without it the system decides; with the glass design that is the arrow.
184
188
  */
185
189
  showTitle?: boolean;
186
190
  /**
@@ -203,7 +207,7 @@ export interface OptionsTopBarBackButton {
203
207
  /**
204
208
  * A shape behind the icon, as for a button. It takes effect with a `color` of the shape. On iOS the icon (the
205
209
  * chevron by default) is drawn on it and the back button becomes an own button that keeps the history menu unless
206
- * `enableMenu` is `false`; without a capsule on iOS 26 by default. On Android the arrow sits on the shape.
210
+ * `enableMenu` is `false`; without a capsule with the glass design by default. On Android the arrow sits on the shape.
207
211
  */
208
212
  iconBackground?: IconBackgroundOptions;
209
213
  /**
@@ -224,7 +228,7 @@ export interface OptionsTopBarBackButton {
224
228
  */
225
229
  displayMode?: 'default' | 'generic' | 'minimal';
226
230
  /**
227
- * (iOS 26+) Whether the Liquid Glass capsule under the back button is hidden. It works only for an own button with
231
+ * (iOS 26+, glass design) Whether the Liquid Glass capsule under the back button is hidden. It works only for an own button with
228
232
  * an `iconBackground`, where the shape is already drawn into the icon; the system button ignores it.
229
233
  * @default true
230
234
  */
@@ -241,9 +245,9 @@ export interface OptionsTopBarBackButton {
241
245
  /** The background of the bar: a color, a component, translucency and blur. */
242
246
  export interface OptionsTopBarBackground {
243
247
  /**
244
- * The color of the bar. On iOS it fills both the standard look and the one at the scroll edge; on iOS 26 the bar is
245
- * then solid in this color instead of glass. A transparent color makes a transparent bar. It beats `blur` and
246
- * `translucent`. With a large title on iOS 26 the color is drawn into the list under the title, and the collapsed bar
248
+ * The color of the bar. On iOS it fills both the standard look and the one at the scroll edge; with the glass design the bar is
249
+ * then solid in this color instead of glass; without it (`UIDesignRequiresCompatibility`) it is the opaque bar of before iOS 26. A transparent color makes a transparent bar. It beats `blur` and
250
+ * `translucent`. With a large title and the glass design the color is drawn into the list under the title, and the collapsed bar
247
251
  * paints itself. On Android it is the background of the bar with the status bar strip, by default the theme's
248
252
  * surface color, changing at once on push and pop. Together with `component` the color lies under the component.
249
253
  */
@@ -262,8 +266,8 @@ export interface OptionsTopBarBackground {
262
266
  */
263
267
  component?: OptionsTopBarBackgroundComponent;
264
268
  /**
265
- * (iOS) Whether content shows through the bar. By default `true` on iOS 26 (glass) and `false` before. With `true`
266
- * the bar is glass on iOS 26 and the system translucent bar before; with `false` it is solid in the system color.
269
+ * (iOS) Whether content shows through the bar. By default `true` with the glass design (iOS 26+, see `UIDesignRequiresCompatibility`) and `false` without it. With `true`
270
+ * the bar is glass with the glass design and the system translucent bar without it; with `false` it is solid in the system color.
267
271
  * `color` and `blur` beat it. Only an explicit `true` puts the screen under the bar.
268
272
  */
269
273
  translucent?: boolean;
@@ -276,7 +280,11 @@ export interface OptionsTopBarBackground {
276
280
 
277
281
  /** The React component that is the background of the bar. */
278
282
  export interface OptionsTopBarBackgroundComponent {
279
- /** The id of the component. Without it, the library gives one. The same `name` and `id` mean the same component. */
283
+ /**
284
+ * The id of the component. Without it, the library gives one made of the screen, the component's place in the
285
+ * options and its `name`: it stays the same for every `mergeOptions` of the screen, so the mounted component stays
286
+ * and only its props change. The same `name` and `id` mean the same component.
287
+ */
280
288
  id?: string;
281
289
  /** The name of the registered component. */
282
290
  name: string;
@@ -293,7 +301,7 @@ export interface OptionsTopBarBackgroundComponent {
293
301
  export interface OptionsTopBarScrollEdgeAppearanceTitle {
294
302
  /** The size of the font, handled like `topBar.title.fontSize`. */
295
303
  fontSize?: number;
296
- /** The color of the title at the edge. On iOS 26 it is fixed during a push, like the usual title color. */
304
+ /** The color of the title at the edge. With the glass design it is fixed during a push, like the usual title color. */
297
305
  color?: Color;
298
306
  /** The font family, handled like `topBar.title.fontFamily`. */
299
307
  fontFamily?: FontFamily;
@@ -319,7 +327,7 @@ export interface OptionsTopBarScrollEdgeAppearanceBackground {
319
327
 
320
328
  /**
321
329
  * (iOS) How the bar looks while the list is at its top edge. Without `active` the edge looks as the usual bar, except
322
- * for the transparency under a large title on iOS 26; the title and the border at the edge still come from the fields
330
+ * for the transparency under a large title with the glass design; the title and the border at the edge still come from the fields
323
331
  * here or from the usual ones. Android doesn't read it.
324
332
  */
325
333
  export interface OptionsTopBarScrollEdgeAppearance {
@@ -329,7 +337,7 @@ export interface OptionsTopBarScrollEdgeAppearance {
329
337
  background?: OptionsTopBarScrollEdgeAppearanceBackground;
330
338
  /**
331
339
  * Whether the bar has a background of its own at the edge (`background`). With it the edge isn't made transparent
332
- * under a large title, and on iOS 26 an opaque color covers the large title. A change by `mergeOptions` applies at
340
+ * under a large title, and with the glass design an opaque color covers the large title. A change by `mergeOptions` applies at
333
341
  * once.
334
342
  * @default false
335
343
  */
@@ -365,7 +373,7 @@ export interface OptionsTopBarLargeTitle {
365
373
  * Whether the large title collapses into the bar as the list scrolls. With `false` on iOS the bar follows an empty
366
374
  * scroll view instead of the list, so the title stays as at the top of the list; under the row it then needs a
367
375
  * background (`background.color`, else a system blur), and `searchBar.hideOnScroll` doesn't work. On Android `false`
368
- * leaves the bar as it is and stops listening to the list. On iOS 26 in a right-to-left layout nothing collapses.
376
+ * leaves the bar as it is and stops listening to the list. With the glass design in a right-to-left layout nothing collapses.
369
377
  * @default true
370
378
  */
371
379
  collapseOnScroll?: boolean;
@@ -432,7 +440,11 @@ export interface OptionsSearchBarSuggestion {
432
440
  * component; a different `id` or `name` replaces the component, and so the search.
433
441
  */
434
442
  export interface OptionsSearchBarResultsComponent {
435
- /** The id of the component. Without it, the library gives one. The same `name` and `id` mean the same component. */
443
+ /**
444
+ * The id of the component. Without it, the library gives one made of the screen, the component's place in the
445
+ * options and its `name`: it stays the same for every `mergeOptions` of the screen, so the mounted component stays
446
+ * and only its props change. The same `name` and `id` mean the same component.
447
+ */
436
448
  id?: string;
437
449
  /** The name of the registered component. */
438
450
  name: string;
@@ -518,8 +530,9 @@ export interface OptionsSearchBar {
518
530
  */
519
531
  scopes?: OptionsSearchBarScope[];
520
532
  /**
521
- * The id of the selected scope; without it, or with an unknown id, the first. The user's pick is written into the
522
- * options of the screen and stays after coming back. `mergeOptions` switches the scope without an event.
533
+ * The id of the selected scope; without it, or with an unknown id, the first. The user's pick stays with the screen,
534
+ * after coming back, through a `mergeOptions` that sends the same value again and `setDefaultOptions`. A
535
+ * `mergeOptions` into the screen with another value switches the scope without an event.
523
536
  */
524
537
  selectedScope?: string;
525
538
  /**
@@ -531,15 +544,15 @@ export interface OptionsSearchBar {
531
544
  scopeBarActivation?: 'automatic' | 'onTextEntry' | 'onSearchActivation';
532
545
  /**
533
546
  * (iOS) Tokens in front of the text of the field. The search events carry the ids of the tokens in the field as
534
- * `tokens`; deleting a token sends a search-updated event, and the deleted tokens (and ones brought back with Undo)
535
- * are written to the options of the screen. Closing the search clears the field and its tokens. An empty list removes
547
+ * `tokens`; deleting a token sends a search-updated event, and what the user deleted (or brought back with Undo)
548
+ * stays with the screen until a `mergeOptions` gives other tokens. Closing the search clears the field and its tokens. An empty list removes
536
549
  * them all.
537
550
  */
538
551
  tokens?: OptionsSearchBarToken[];
539
552
  /**
540
553
  * (iOS 16+, Android) The suggestions shown while searching. Picking one sends a suggestion-picked event with its id
541
- * to the screen; the text stays and the list goes. They also go when the user types on, and new ones come with
542
- * `mergeOptions`, usually on a search-updated event. An empty list removes them.
554
+ * to the screen; the text stays and the list goes. They also go when the user types on; the list a `mergeOptions`
555
+ * gives shows again, the same one too, usually on a search-updated event. An empty list removes them.
543
556
  */
544
557
  suggestions?: OptionsSearchBarSuggestion[];
545
558
  /**
@@ -624,7 +637,7 @@ export interface OptionsTopBar {
624
637
  /**
625
638
  * The shape color behind the icons of the left buttons that have an `icon` image and no `iconBackground.color`; the
626
639
  * size and corners come from the button's `iconBackground`, or the icon's size without corners. On iOS only image
627
- * buttons, not SF Symbols, and without a capsule on iOS 26. A color sent by `mergeOptions` repaints all the side's
640
+ * buttons, not SF Symbols, and without a capsule with the glass design. A color sent by `mergeOptions` repaints all the side's
628
641
  * image buttons, those with their own shape color too.
629
642
  */
630
643
  leftButtonBackgroundColor?: Color;
@@ -641,6 +654,20 @@ export interface OptionsTopBar {
641
654
  centerButtonColor?: Color;
642
655
  /** (iOS 16+) The color of the disabled center buttons that have no `disabledColor` of their own. */
643
656
  centerButtonDisabledColor?: Color;
657
+ /**
658
+ * (Android) The background of the bar's menus: "⋮" and the menus of the buttons, their submenus too. Without it the
659
+ * bar's color (`background.color`, else the theme's surface), unless the bar lets something through; then the
660
+ * theme's surface container color. It follows light and dark mode; an open menu closes as the mode switches. iOS
661
+ * draws its system menus in the system's colors.
662
+ */
663
+ menuBackgroundColor?: Color;
664
+ /**
665
+ * (Android) The color of the text and the icons of the items of the bar's menus, and of the titles of their
666
+ * submenus. Without it the title's color (`title.color`) when the menu takes the bar's color, else the theme's
667
+ * colors. A destructive item stays red, and a button moved into "⋮" keeps its own color or the side's
668
+ * (`rightButtonColor`). A disabled item is dimmed. An open menu closes when either menu color is merged.
669
+ */
670
+ menuTextColor?: Color;
644
671
  /**
645
672
  * Whether the content of the screen goes under the bar, starting at the top of the screen. The screen goes under the
646
673
  * bar by itself in some cases (a large title that may show, `hideOnScroll`, a hidden bar, an explicit translucent
@@ -802,12 +829,15 @@ export interface OptionsScrollEdge {
802
829
 
803
830
  /**
804
831
  * (iOS 26+) The scroll edge effect of the scroll views of a screen: how the content fades or blurs where it scrolls
805
- * under a bar. The scroll views draw it, and only where content goes under a bar. It applies to every scroll view in
806
- * the view of the screen when the screen appears; after React mounts it applies to the main list of the screen only; on
807
- * `mergeOptions` all is reset and applied again. Other scroll views mounted later get it at the next appearance or
808
- * `mergeOptions`. When the screen leaves, its scroll views get the system effect back. Under a bar with
809
- * `background.color` or `background.component` there is no effect at the top unless the screen sets one for the top or
810
- * for all edges. Before iOS 26 and on Android it does nothing.
832
+ * under a bar. The scroll views draw it, and only where content goes under a bar. When the screen appears, it applies
833
+ * to the vertical lists and text views (a multi-line `TextInput`) in the view of the screen, except in hidden views
834
+ * (`display: none`). A list inside another vertical list gets none (UIKit draws no edge effect there); a scroll view
835
+ * that doesn't scroll vertically, like a pager, is searched for its lists. A list nested very deep in the screen's
836
+ * views may not get it. After React mounts, the main list of the screen gets it; a list mounted later gets it at the
837
+ * next appearance, or at a `mergeOptions` of `scrollEdgeEffect` or of the bar's background. The lists get the system
838
+ * effect back when the screen leaves or is destroyed, and a list React removes from the screen gets it back too. Under
839
+ * a bar with `background.color` or `background.component` there is no effect at the top unless the screen sets one for
840
+ * the top or for all edges. Before iOS 26 and on Android it does nothing.
811
841
  */
812
842
  export interface OptionsScrollEdgeEffect {
813
843
  /** Whether the effect is hidden on all four edges. The value of an edge beats it. */
@@ -1,41 +0,0 @@
1
- package dev.apexnative.navigation.react
2
-
3
- import android.content.Context
4
- import com.facebook.react.ReactApplication
5
- import com.facebook.react.bridge.Arguments
6
- import com.facebook.react.bridge.WritableMap
7
- import dev.apexnative.navigation.react.events.EventEmitter
8
- import java.util.concurrent.ConcurrentHashMap
9
-
10
- /**
11
- * The state of each screen of a pair (`useArrangement`): which screen of the pair it is, how the pair lies, whether it
12
- * lies over the other one and whether it is out of the window. Set on the main thread as the pair lays out; JavaScript
13
- * reads it from its own thread for a screen's first render, and gets every change as `ANN.ArrangementChanged`. A
14
- * screen outside a pair has none.
15
- */
16
- internal object ArrangementStates {
17
- data class State(val placement: String, val layout: String, val front: Boolean, val hidden: Boolean)
18
-
19
- private val states = ConcurrentHashMap<String, State>()
20
-
21
- /** Keeps the screen's state, and tells JavaScript when it changed and [notify] holds. Main thread only. */
22
- fun set(context: Context, screenId: String, state: State, notify: Boolean) {
23
- if (states.put(screenId, state) == state || !notify) return
24
- val reactContext = (context.applicationContext as? ReactApplication)?.reactHost?.currentReactContext ?: return
25
- EventEmitter(reactContext).emitArrangementChanged(screenId, toMap(state))
26
- }
27
-
28
- /** `{ placement, layout, front, hidden }`, empty for a screen outside a pair. Any thread. */
29
- fun get(screenId: String): WritableMap = states[screenId]?.let(::toMap) ?: Arguments.createMap()
30
-
31
- fun remove(screenId: String) {
32
- states.remove(screenId)
33
- }
34
-
35
- private fun toMap(state: State): WritableMap = Arguments.createMap().apply {
36
- putString("placement", state.placement)
37
- putString("layout", state.layout)
38
- putBoolean("front", state.front)
39
- putBoolean("hidden", state.hidden)
40
- }
41
- }
@@ -1,69 +0,0 @@
1
- package dev.apexnative.navigation.react
2
-
3
- import android.content.Context
4
- import com.facebook.react.ReactApplication
5
- import com.facebook.react.bridge.Arguments
6
- import com.facebook.react.bridge.WritableMap
7
- import dev.apexnative.navigation.react.events.EventEmitter
8
- import java.util.concurrent.ConcurrentHashMap
9
-
10
- /**
11
- * The safe area of each screen, in dp: how much of its content the bars and the system cover on each side. The padding
12
- * is the part of it the screen's safe area view keeps its content out of: the insets on the edges the screen's options
13
- * give. JavaScript gets the rest, what still covers the content (0 on a padded edge): it reads it from its own thread
14
- * for a screen's first render, and gets every change as `ANN.ScreenInsetsChanged`.
15
- */
16
- object ScreenInsets {
17
- data class Insets(val top: Double, val right: Double, val bottom: Double, val left: Double)
18
-
19
- private val insets = ConcurrentHashMap<String, Insets>()
20
- // Main thread only.
21
- private val padding = HashMap<String, Insets>()
22
- private val paddingListeners = HashMap<String, MutableSet<() -> Unit>>()
23
-
24
- /** The padding of the screen's safe area view; none before the screen was laid out. */
25
- fun padding(screenId: String): Insets? = padding[screenId]
26
-
27
- /** Calls `listener` when the padding of the screen changes; returns the function that stops it. */
28
- fun listenToPadding(screenId: String, listener: () -> Unit): () -> Unit {
29
- paddingListeners.getOrPut(screenId) { LinkedHashSet() }.add(listener)
30
- return {
31
- paddingListeners[screenId]?.let {
32
- it.remove(listener)
33
- if (it.isEmpty()) paddingListeners.remove(screenId)
34
- }
35
- }
36
- }
37
-
38
- /** Keeps the screen's insets and padding, and tells when they changed. */
39
- fun update(context: Context, screenId: String, value: Insets, paddingValue: Insets) {
40
- if (padding.put(screenId, paddingValue) != paddingValue) {
41
- paddingListeners[screenId]?.toList()?.forEach { it() }
42
- }
43
- // JavaScript gets what still covers the content: the edges the safe area view keeps it off are 0.
44
- val uncovered = Insets(
45
- top = (value.top - paddingValue.top).coerceAtLeast(0.0),
46
- right = (value.right - paddingValue.right).coerceAtLeast(0.0),
47
- bottom = (value.bottom - paddingValue.bottom).coerceAtLeast(0.0),
48
- left = (value.left - paddingValue.left).coerceAtLeast(0.0),
49
- )
50
- if (insets.put(screenId, uncovered) == uncovered) return
51
- val reactContext = (context.applicationContext as? ReactApplication)?.reactHost?.currentReactContext ?: return
52
- EventEmitter(reactContext).emitScreenInsetsChanged(screenId, toMap(uncovered))
53
- }
54
-
55
- /** `{ top, right, bottom, left }`, empty before the screen was laid out. Any thread. */
56
- fun get(screenId: String): WritableMap = insets[screenId]?.let(::toMap) ?: Arguments.createMap()
57
-
58
- fun remove(screenId: String) {
59
- insets.remove(screenId)
60
- padding.remove(screenId)
61
- }
62
-
63
- private fun toMap(value: Insets): WritableMap = Arguments.createMap().apply {
64
- putDouble("top", value.top)
65
- putDouble("right", value.right)
66
- putDouble("bottom", value.bottom)
67
- putDouble("left", value.left)
68
- }
69
- }
@@ -1,62 +0,0 @@
1
- package dev.apexnative.navigation.react.events
2
-
3
- import android.os.Handler
4
- import android.os.Looper
5
- import dev.apexnative.navigation.viewcontrollers.bottomtabs.BottomTabsController
6
- import dev.apexnative.navigation.viewcontrollers.navigator.Navigators
7
- import dev.apexnative.navigation.viewcontrollers.parent.ParentController
8
- import dev.apexnative.navigation.viewcontrollers.viewcontroller.ViewController
9
-
10
- /**
11
- * Tells JavaScript the screen the user sees and the selected tab when they change. Every change of the screen the
12
- * user sees comes with a screen appearing: a push, a pop, a modal, a tab, a menu. One update after the events of a
13
- * pass of the main loop, and one at once before a command resolves its promise; each sent only when the state changed.
14
- */
15
- object NavigationStateReporter {
16
- internal data class State(val screenId: String?, val screenName: String?, val tab: Int?)
17
-
18
- private val handler = Handler(Looper.getMainLooper())
19
- private var state: State? = null
20
- private var scheduled = false
21
-
22
- /** The new JavaScript has no state yet: the next one goes to it whatever it is. */
23
- fun reset() {
24
- state = null
25
- }
26
-
27
- fun setNeedsUpdate(emitter: EventEmitter) {
28
- if (scheduled) return
29
- scheduled = true
30
- handler.post {
31
- scheduled = false
32
- updateNow(emitter)
33
- }
34
- }
35
-
36
- /**
37
- * Sends the state at once when it differs from the last one sent. A command calls it right before it resolves its
38
- * promise: the event and the resolution reach JavaScript in that order, so the state is new when the `await` of
39
- * the command goes on. The update already scheduled then finds nothing new. Main thread only.
40
- */
41
- fun updateNow(emitter: EventEmitter) {
42
- // The navigation of the activity the commands run in (`Navigators.current`).
43
- val navigator = Navigators.current()?.navigator ?: return
44
- val next = stateOf(navigator.visibleLayout)
45
- if (next == state) return
46
- state = next
47
- emitter.emitNavigationStateChanged(next.screenId, next.screenName, next.tab)
48
- }
49
-
50
- // The top modal, or the root ([layout]), down to the screen the user sees; overlays don't count. The tab is the
51
- // selected one of the nearest tabs the screen is in, the last met on the way down, in a modal too: the tabs
52
- // `selectTab` acts on from it. None for a screen out of tabs.
53
- internal fun stateOf(layout: ViewController<*>?): State {
54
- var tab: Int? = null
55
- var current = layout ?: return State(null, null, null)
56
- while (current is ParentController<*>) {
57
- if (current is BottomTabsController) tab = current.selectedIndex
58
- current = current.currentChild ?: return State(null, null, null)
59
- }
60
- return State(current.id, current.currentComponentName, tab)
61
- }
62
- }
@@ -1,62 +0,0 @@
1
- package dev.apexnative.navigation.react.events
2
-
3
- /**
4
- * The navigation state's posted update and its hold. [setNeedsUpdate] posts one update ([post]), coalesced: the asks of
5
- * one pass of the main loop make one, which runs [update] in a later pass. While a `setRoot` shows the modals and the
6
- * overlays of its layout the updates are held: an ask, or a posted update that runs while held (asked before the hold
7
- * was taken), only marks one as wanted, and the last release posts it. Released right before the answer, that update
8
- * finds nothing new: the state before the answer is sent at once, never held, and an identical state is never sent
9
- * twice. Every [hold] has one [release]; a release without a hold does nothing, so the count never goes below zero. An
10
- * update keeps the JavaScript it was asked for ([generation]): one asked by a JavaScript that went before it runs is
11
- * dropped; a newer ask of the new JavaScript still goes. Main thread only.
12
- */
13
- internal class StateHold(
14
- private val post: (() -> Unit) -> Unit,
15
- private val generation: () -> Int = { 0 },
16
- private val update: () -> Unit,
17
- ) {
18
- /** The holds not released yet. */
19
- var count = 0
20
- private set
21
-
22
- // An update was asked while held.
23
- private var wanted = false
24
- // An update is posted and hasn't run yet.
25
- private var scheduled = false
26
- // The JavaScript the last ask was for.
27
- private var askedIn = 0
28
-
29
- /** Asks for one update in a later pass of the main loop; while held, once the last hold is released. */
30
- fun setNeedsUpdate() {
31
- askedIn = generation()
32
- if (count > 0) wanted = true else schedule()
33
- }
34
-
35
- /** The updates asked from now on, and those posted that run from now on, wait for as many [release]s. */
36
- fun hold() {
37
- count++
38
- }
39
-
40
- /** One hold ends; with the last, the update asked while held is posted now. */
41
- fun release() {
42
- if (count == 0) return
43
- count--
44
- if (count > 0 || !wanted) return
45
- wanted = false
46
- schedule()
47
- }
48
-
49
- private fun schedule() {
50
- if (scheduled) return
51
- scheduled = true
52
- post {
53
- scheduled = false
54
- // A hold taken since it was posted: the update waits for the release. The JavaScript it was asked for
55
- // went: nothing goes to the new one, which hears its first state after its own changes.
56
- when {
57
- count > 0 -> wanted = true
58
- askedIn == generation() -> update()
59
- }
60
- }
61
- }
62
- }