@apexnative/navigation 1.0.0-alpha.4 → 1.0.0-alpha.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 (235) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/README.md +1 -1
  3. package/android/CLAUDE.md +23 -14
  4. package/android/CORE.md +32 -19
  5. package/android/src/main/java/dev/apexnative/navigation/NavigationActivity.kt +60 -13
  6. package/android/src/main/java/dev/apexnative/navigation/options/AnimationsOptions.kt +2 -2
  7. package/android/src/main/java/dev/apexnative/navigation/options/BottomTabsOptions.kt +13 -8
  8. package/android/src/main/java/dev/apexnative/navigation/options/HardwareBackButtonOptions.kt +9 -1
  9. package/android/src/main/java/dev/apexnative/navigation/options/StackAnimationOptions.kt +40 -2
  10. package/android/src/main/java/dev/apexnative/navigation/react/CommandAnswer.kt +28 -13
  11. package/android/src/main/java/dev/apexnative/navigation/react/Hinge.kt +7 -4
  12. package/android/src/main/java/dev/apexnative/navigation/react/NavigationTurboModule.kt +3 -3
  13. package/android/src/main/java/dev/apexnative/navigation/react/ReactView.kt +39 -20
  14. package/android/src/main/java/dev/apexnative/navigation/react/ReloadCoordinator.kt +7 -6
  15. package/android/src/main/java/dev/apexnative/navigation/react/ScreenEnvironment.kt +177 -0
  16. package/android/src/main/java/dev/apexnative/navigation/react/ScreenRegions.kt +19 -51
  17. package/android/src/main/java/dev/apexnative/navigation/react/ScrollEvents.kt +49 -128
  18. package/android/src/main/java/dev/apexnative/navigation/react/events/AppearanceDispatcher.kt +30 -39
  19. package/android/src/main/java/dev/apexnative/navigation/react/events/EventEmitter.kt +34 -7
  20. package/android/src/main/java/dev/apexnative/navigation/react/events/NavigationState.kt +154 -0
  21. package/android/src/main/java/dev/apexnative/navigation/safearea/SafeAreaView.kt +12 -10
  22. package/android/src/main/java/dev/apexnative/navigation/slots/SlotScreenView.kt +12 -12
  23. package/android/src/main/java/dev/apexnative/navigation/utils/ViewExtensions.kt +0 -13
  24. package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/arrangement/ArrangementController.kt +10 -7
  25. package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/bottomtabs/BottomTabsCollapseBehavior.kt +5 -3
  26. package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/bottomtabs/BottomTabsController.kt +22 -21
  27. package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/bottomtabs/CustomTabRowGeometry.kt +22 -0
  28. package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/bottomtabs/TabsRoom.kt +0 -5
  29. package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/component/ComponentViewController.kt +12 -9
  30. package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/component/ContentReadiness.kt +1 -1
  31. package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/component/ScreenReadiness.kt +103 -56
  32. package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/component/ScreenSafeArea.kt +29 -11
  33. package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/externalcomponent/ExternalComponentViewController.kt +2 -6
  34. package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/modal/ModalCoordinator.kt +20 -2
  35. package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/modal/ModalSheet.kt +119 -8
  36. package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/modal/ModalViews.kt +7 -0
  37. package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/modal/SheetBack.kt +42 -0
  38. package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/navigator/BackCallbackCheck.kt +50 -0
  39. package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/navigator/BackCallbackState.kt +45 -14
  40. package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/navigator/Navigator.kt +25 -5
  41. package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/navigator/RootCoordinator.kt +2 -2
  42. package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/parent/ParentController.kt +3 -6
  43. package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/splitview/SplitViewController.kt +3 -0
  44. package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/stack/PreparedFrame.kt +3 -3
  45. package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/stack/StackCommands.kt +2 -2
  46. package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/stack/StackController.kt +13 -5
  47. package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/stack/StackViews.kt +3 -0
  48. package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/stack/search/ScreenSearch.kt +3 -5
  49. package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/stack/search/StackSearchPresenter.kt +2 -5
  50. package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/stack/topbar/BarComponents.kt +5 -51
  51. package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/stack/topbar/TopBarPresenter.kt +4 -9
  52. package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/viewcontroller/ScrollEventListener.kt +6 -9
  53. package/android/src/main/java/dev/apexnative/navigation/views/animations/AnimationLayer.kt +73 -0
  54. package/android/src/main/java/dev/apexnative/navigation/views/animations/ValueInterpolation.kt +14 -0
  55. package/android/src/main/java/dev/apexnative/navigation/views/bottomtabs/BottomTabsLayout.kt +61 -2
  56. package/android/src/main/java/dev/apexnative/navigation/views/bottomtabs/CustomBottomTabItemView.kt +0 -5
  57. package/android/src/main/java/dev/apexnative/navigation/views/bottomtabs/CustomTabRow.kt +72 -10
  58. package/android/src/main/java/dev/apexnative/navigation/views/element/ElementTransitions.kt +9 -2
  59. package/android/src/main/java/dev/apexnative/navigation/views/element/animators/ElementPictures.kt +11 -0
  60. package/android/src/main/java/dev/apexnative/navigation/views/element/animators/FlightGeometry.kt +318 -25
  61. package/android/src/main/java/dev/apexnative/navigation/views/element/animators/ImageMatrixAnimator.kt +18 -20
  62. package/android/src/main/java/dev/apexnative/navigation/views/element/animators/PlainViewAnimator.kt +17 -25
  63. package/android/src/main/java/dev/apexnative/navigation/views/element/animators/ReactImageAnimator.kt +15 -22
  64. package/android/src/main/java/dev/apexnative/navigation/views/element/animators/SharedAnimatorFactory.kt +12 -9
  65. package/android/src/main/java/dev/apexnative/navigation/views/element/animators/TextChangeAnimator.kt +84 -35
  66. package/android/src/main/java/dev/apexnative/navigation/views/element/animators/ViewChangeAnimator.kt +49 -40
  67. package/cli/doctor/checks/splash.js +4 -22
  68. package/cli/splash/index.js +3 -1
  69. package/docs-md/architecture/transitions.md +4 -2
  70. package/docs-md/containers/modals.md +4 -2
  71. package/docs-md/containers/overlays.md +1 -1
  72. package/docs-md/containers/side-menu.md +1 -1
  73. package/docs-md/containers/tabs.md +2 -0
  74. package/docs-md/flows/bottom-sheets.md +1 -1
  75. package/docs-md/fundamentals/starting-the-app.md +1 -1
  76. package/docs-md/guides/cli.md +1 -2
  77. package/docs-md/help/glossary.md +2 -2
  78. package/docs-md/help/troubleshooting.md +23 -2
  79. package/docs-md/index.json +12 -0
  80. package/docs-md/migration/from-expo-router.md +1 -1
  81. package/docs-md/migration/from-react-native-navigation.md +1 -1
  82. package/docs-md/migration/from-react-navigation.md +2 -2
  83. package/docs-md/screen-ui/back-and-gestures.md +36 -0
  84. package/docs-md/screen-ui/bar-buttons.md +4 -4
  85. package/docs-md/screen-ui/search.md +1 -1
  86. package/docs-md/screen-ui/system-ui.md +16 -11
  87. package/docs-md/screen-ui/toolbar-and-fab.md +2 -2
  88. package/docs-md/screen-ui/top-bar.md +8 -4
  89. package/docs-md/start/installation.md +1 -1
  90. package/ios/Animations/ANNFrameDriver.mm +2 -0
  91. package/ios/Animations/Elements/ANNSharedElementFlight.mm +70 -4
  92. package/ios/Animations/Interpolators/ANNInterpolate.h +2 -30
  93. package/ios/Animations/Interpolators/ANNTransformParts.h +48 -0
  94. package/ios/Animations/Interpolators/ANNTransformParts.mm +507 -0
  95. package/ios/Animations/Interpolators/ANNViewTracks.h +6 -4
  96. package/ios/Animations/Interpolators/ANNViewTracks.mm +49 -9
  97. package/ios/CLAUDE.md +17 -15
  98. package/ios/CORE.md +30 -26
  99. package/ios/Contract/ANNCommandAnswer.h +9 -2
  100. package/ios/Contract/ANNCommandAnswer.mm +25 -12
  101. package/ios/Contract/ANNCommandRunner.h +8 -7
  102. package/ios/Contract/ANNCommandRunner.mm +21 -27
  103. package/ios/Contract/ANNLayoutNode.h +3 -3
  104. package/ios/Contract/ANNLayoutReader.h +3 -3
  105. package/ios/Core/ANNAppearanceDispatcher.h +5 -4
  106. package/ios/Core/ANNAppearanceDispatcher.mm +12 -1
  107. package/ios/Core/ANNJavaScriptCalls.h +11 -12
  108. package/ios/Core/ANNJavaScriptCalls.mm +7 -16
  109. package/ios/Core/ANNNavigationState.h +4 -6
  110. package/ios/Core/ANNNavigationState.mm +0 -4
  111. package/ios/Core/ANNReloadCoordinator.mm +4 -8
  112. package/ios/Core/ApexNavigation+Internal.h +1 -1
  113. package/ios/Layouts/Arrangement/ANNArrangementState.h +2 -17
  114. package/ios/Layouts/Arrangement/ANNArrangementState.mm +0 -38
  115. package/ios/Layouts/Arrangement/ANNArrangementViewController.mm +4 -4
  116. package/ios/Layouts/Root/ANNSplashViewController.h +5 -3
  117. package/ios/Layouts/Root/ANNSplashViewController.mm +147 -0
  118. package/ios/Layouts/Screen/ANNComponentViewController.h +2 -2
  119. package/ios/Layouts/Screen/ANNComponentViewController.mm +9 -22
  120. package/ios/Layouts/Screen/ANNPreviewInteraction.h +7 -4
  121. package/ios/Layouts/Screen/ANNPreviewInteraction.mm +72 -10
  122. package/ios/Layouts/Screen/ANNScreenEnvironment.h +63 -0
  123. package/ios/Layouts/Screen/ANNScreenEnvironment.mm +181 -0
  124. package/ios/Layouts/Screen/ANNScreenRegions.h +3 -18
  125. package/ios/Layouts/Screen/ANNScreenRegions.mm +0 -38
  126. package/ios/Layouts/Screen/ANNScreenSafeArea.h +4 -9
  127. package/ios/Layouts/Screen/ANNScreenSafeArea.mm +14 -16
  128. package/ios/Layouts/Stack/ANNPreviewPush.h +7 -6
  129. package/ios/Layouts/Stack/ANNPreviewPush.mm +142 -27
  130. package/ios/Layouts/Tabs/ANNBottomTabsAccessoryView.h +12 -1
  131. package/ios/Layouts/Tabs/ANNBottomTabsAccessoryView.mm +23 -0
  132. package/ios/Layouts/Tabs/ANNBottomTabsController.mm +2 -1
  133. package/ios/Layouts/Tabs/ANNBottomTabsCustomRow.mm +8 -3
  134. package/ios/Layouts/Tabs/ANNBottomTabsPresenter.h +4 -0
  135. package/ios/Layouts/Tabs/ANNBottomTabsPresenter.mm +123 -36
  136. package/ios/Layouts/Tabs/ANNTabsDesign.h +6 -5
  137. package/ios/Layouts/Tabs/ANNTabsDesign.mm +9 -1
  138. package/ios/Layouts/Tabs/UITabBar+utils.h +5 -5
  139. package/ios/Layouts/Tabs/UITabBar+utils.mm +32 -13
  140. package/ios/Options/ANNBottomTabsOptions.h +2 -0
  141. package/ios/Options/ANNBottomTabsOptions.mm +1 -0
  142. package/ios/Options/ANNOptions.h +18 -0
  143. package/ios/Options/ANNOptions.mm +112 -1
  144. package/ios/Options/ANNOptionsReader.mm +110 -0
  145. package/ios/Options/Params/ANNParam.h +15 -0
  146. package/ios/Options/Params/ANNParam.mm +61 -0
  147. package/ios/Options/Params/Color.h +3 -0
  148. package/ios/Options/Params/Color.mm +21 -0
  149. package/ios/Options/Params/Image.h +4 -0
  150. package/ios/Options/Params/Image.mm +20 -0
  151. package/ios/React/ANNReactView.mm +6 -25
  152. package/ios/React/ANNSafeAreaViewComponentView.mm +26 -15
  153. package/ios/React/ANNSurfaceHostingView.h +6 -0
  154. package/ios/React/ANNSurfaceHostingView.mm +116 -0
  155. package/ios/TopBar/ANNBackButtonPresenter.mm +6 -5
  156. package/ios/TopBar/ANNBarAppearance.h +2 -1
  157. package/ios/TopBar/ANNBarAppearance.mm +111 -30
  158. package/ios/TopBar/ANNBarBackgroundComponent.mm +16 -0
  159. package/ios/TopBar/ANNBarButtonComponentView.h +4 -4
  160. package/ios/TopBar/ANNBarButtonComponentView.mm +1 -1
  161. package/ios/TopBar/ANNBarButtons.h +5 -3
  162. package/ios/TopBar/ANNBarButtons.mm +186 -17
  163. package/ios/TopBar/ANNLargeTitlePresenter.mm +24 -4
  164. package/ios/TopBar/ANNMainList.h +3 -0
  165. package/ios/TopBar/ANNMainList.mm +4 -0
  166. package/ios/TopBar/ANNScrollEdgeEffects.h +22 -6
  167. package/ios/TopBar/ANNScrollEdgeEffects.mm +123 -16
  168. package/ios/TopBar/ANNSearchPresenter.mm +2 -2
  169. package/ios/TopBar/ANNSearchResultsViewController.mm +5 -5
  170. package/ios/TopBar/ANNTopBarPresenter.h +3 -2
  171. package/ios/TopBar/ANNTopBarPresenter.mm +95 -22
  172. package/ios/TurboModules/ANNTurboModule.mm +20 -16
  173. package/lib/module/ARCHITECTURE.md +8 -4
  174. package/lib/module/api/commands/commands.js +54 -6
  175. package/lib/module/api/commands/commands.js.map +1 -1
  176. package/lib/module/api/hooks/useSafeAreaInsets.js +4 -3
  177. package/lib/module/api/hooks/useSafeAreaInsets.js.map +1 -1
  178. package/lib/module/api/options/OptionsChain.js +2 -2
  179. package/lib/module/engine/commands.js +21 -1
  180. package/lib/module/engine/commands.js.map +1 -1
  181. package/lib/module/engine/places.js +8 -0
  182. package/lib/module/engine/places.js.map +1 -1
  183. package/lib/module/engine/screens.js +29 -4
  184. package/lib/module/engine/screens.js.map +1 -1
  185. package/lib/typescript/api/app/createNavigation.d.ts +3 -3
  186. package/lib/typescript/api/commands/commands.d.ts.map +1 -1
  187. package/lib/typescript/api/commands/presentation.d.ts +4 -3
  188. package/lib/typescript/api/commands/presentation.d.ts.map +1 -1
  189. package/lib/typescript/api/hooks/useSafeAreaInsets.d.ts +4 -3
  190. package/lib/typescript/api/hooks/useSafeAreaInsets.d.ts.map +1 -1
  191. package/lib/typescript/api/options/OptionsChain.d.ts +2 -2
  192. package/lib/typescript/engine/commands.d.ts.map +1 -1
  193. package/lib/typescript/engine/places.d.ts +2 -0
  194. package/lib/typescript/engine/places.d.ts.map +1 -1
  195. package/lib/typescript/engine/screens.d.ts +20 -6
  196. package/lib/typescript/engine/screens.d.ts.map +1 -1
  197. package/lib/typescript/interfaces/Options.d.ts +1 -1
  198. package/lib/typescript/interfaces/Options.d.ts.map +1 -1
  199. package/lib/typescript/interfaces/options/animations.d.ts +30 -9
  200. package/lib/typescript/interfaces/options/animations.d.ts.map +1 -1
  201. package/lib/typescript/interfaces/options/bottomTabs.d.ts +18 -5
  202. package/lib/typescript/interfaces/options/bottomTabs.d.ts.map +1 -1
  203. package/lib/typescript/interfaces/options/buttons.d.ts +8 -8
  204. package/lib/typescript/interfaces/options/stack.d.ts +9 -0
  205. package/lib/typescript/interfaces/options/stack.d.ts.map +1 -1
  206. package/lib/typescript/interfaces/options/system.d.ts +8 -5
  207. package/lib/typescript/interfaces/options/system.d.ts.map +1 -1
  208. package/lib/typescript/interfaces/options/toolbar.d.ts +2 -2
  209. package/lib/typescript/interfaces/options/topBar.d.ts +32 -29
  210. package/lib/typescript/interfaces/options/topBar.d.ts.map +1 -1
  211. package/package.json +1 -1
  212. package/src/ARCHITECTURE.md +8 -4
  213. package/src/api/app/createNavigation.ts +3 -3
  214. package/src/api/commands/commands.ts +48 -7
  215. package/src/api/commands/presentation.ts +4 -3
  216. package/src/api/hooks/useSafeAreaInsets.ts +4 -3
  217. package/src/api/options/OptionsChain.ts +2 -2
  218. package/src/engine/commands.ts +30 -6
  219. package/src/engine/places.ts +9 -0
  220. package/src/engine/screens.tsx +29 -8
  221. package/src/interfaces/Options.ts +1 -0
  222. package/src/interfaces/options/animations.ts +31 -9
  223. package/src/interfaces/options/bottomTabs.ts +18 -5
  224. package/src/interfaces/options/buttons.ts +8 -8
  225. package/src/interfaces/options/stack.ts +9 -0
  226. package/src/interfaces/options/system.ts +8 -5
  227. package/src/interfaces/options/toolbar.ts +2 -2
  228. package/src/interfaces/options/topBar.ts +32 -29
  229. package/android/src/main/java/dev/apexnative/navigation/react/ArrangementStates.kt +0 -42
  230. package/android/src/main/java/dev/apexnative/navigation/react/ScreenInsets.kt +0 -70
  231. package/android/src/main/java/dev/apexnative/navigation/react/events/NavigationStateReporter.kt +0 -62
  232. package/android/src/main/java/dev/apexnative/navigation/react/events/StateHold.kt +0 -62
  233. package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/bottomtabs/CustomTabRowPlacer.kt +0 -223
  234. package/ios/Layouts/Screen/ANNScreenInsets.h +0 -30
  235. package/ios/Layouts/Screen/ANNScreenInsets.mm +0 -70
@@ -12,9 +12,6 @@
12
12
 
13
13
  // The dot of a tab before iOS 26: its default size and color.
14
14
  static const CGFloat ANNDotDefaultSize = 6;
15
- // A button not there yet gets its `testID` again this often, at most this many times (`bottomTab.testID`).
16
- static const NSTimeInterval ANNTestIDRetryInterval = 0.15;
17
- static const NSUInteger ANNTestIDRetries = 5;
18
15
 
19
16
  // A picture of `color` (both of its styles when it is dynamic): the bar's 1×1 background and the border's line.
20
17
  static UIImage *ANNImageOfColor(UIColor *color, CGSize size) {
@@ -63,13 +60,23 @@ static id ANNValue(NSArray *list, NSUInteger index) {
63
60
  NSMutableArray<NSNumber *> *_roleItems;
64
61
  // The identifiers the buttons had before the core gave them a `testID`, to give back.
65
62
  NSMapTable<UIView *, NSString *> *_buttonIds;
63
+ // What the `testID`s and the dots were last applied to: the bar's items, the button of each tab and of More, the
64
+ // bar's size and its traits. UIKit makes the buttons anew (rotation, text size, items moving between the bar and
65
+ // More), and a layout that finds other buttons applies them again.
66
+ NSPointerArray *_appliedButtons;
67
+ CGSize _appliedBarSize;
68
+ UITraitCollection *_appliedBarTraits;
66
69
  BOOL _tabsAreSet;
67
70
  BOOL _titlesHidden;
71
+ // A dot that shows was placed while its button had no window (the tabs under a full-screen modal): it hides then,
72
+ // and the next layout in the window places it, whatever the check of the buttons says.
73
+ BOOL _dotsWaitForWindow;
68
74
  // The bar's look: its options, and the background and border every item's look starts from.
69
75
  ANNBottomTabsOptions *_barOptions;
70
76
  UITabBarAppearance *_base;
71
77
  ANNBottomTabsCustomRow *_row;
72
- // The accessory shown (its id), and the content view of each accessory made, kept until the tabs go.
78
+ // The accessory shown (its id), and the content view of each accessory made: kept while hidden, until another
79
+ // accessory shows or the tabs go.
73
80
  NSString *_accessoryId;
74
81
  NSMutableDictionary<NSString *, ANNBottomTabsAccessoryView *> *_accessoryViews;
75
82
  // The pictures of the bar's colors by color and size.
@@ -123,6 +130,7 @@ static id ANNValue(NSArray *list, NSUInteger index) {
123
130
  _dotViews = [NSMutableArray new];
124
131
  _roleItems = [NSMutableArray new];
125
132
  _buttonIds = [NSMapTable weakToStrongObjectsMapTable];
133
+ _appliedButtons = [NSPointerArray weakObjectsPointerArray];
126
134
  _accessoryViews = [NSMutableDictionary new];
127
135
  _colorImages = [NSMutableDictionary new];
128
136
  _iconLoads = [NSMutableDictionary new];
@@ -251,7 +259,7 @@ static id ANNValue(NSArray *list, NSUInteger index) {
251
259
  [_row applyOptions:resolvedOptions.bottomTabs.customRow];
252
260
  }
253
261
  [self applyAccessoryOf:resolvedOptions animated:NO];
254
- [self applyButtonTestIDsWithRetries:ANNTestIDRetries];
262
+ [self applyButtonTestIDs];
255
263
  }
256
264
 
257
265
  #pragma mark - ANNNodePresenter
@@ -315,7 +323,7 @@ static id ANNValue(NSArray *list, NSUInteger index) {
315
323
  }
316
324
  [self buildItemAtIndex:index bottomTab:bottomTab updatesBadgeAndDot:badgeAndDot];
317
325
  [self updateCells];
318
- [self applyButtonTestIDsWithRetries:mergeOptions.testID.hasValue ? ANNTestIDRetries : 0];
326
+ [self applyButtonTestIDs];
319
327
  }
320
328
 
321
329
  // The whole item from `bottomTab`; the badge and the dot from it only with `updatesBadgeAndDot`.
@@ -589,6 +597,7 @@ static ANNBottomTabOptions *ANNWithIcons(ANNBottomTabOptions *bottomTab, NSArray
589
597
  if (anyDot) {
590
598
  [bar layoutIfNeeded];
591
599
  }
600
+ BOOL waitsForWindow = NO;
592
601
  for (NSUInteger index = 0; index < tabs.layoutTabs.count; index++) {
593
602
  ANNTabDotView *view = ANNValue(_dotViews, index);
594
603
  if (!view) {
@@ -602,49 +611,36 @@ static ANNBottomTabOptions *ANNWithIcons(ANNBottomTabOptions *bottomTab, NSArray
602
611
  }
603
612
  UITabBarItem *item = tabs.layoutTabs[index].tabBarItem;
604
613
  BOOL inBar = [bar.items indexOfObjectIdenticalTo:item] != NSNotFound;
605
- [view placeOverButton:inBar ? [bar viewOfItem:item] : nil inBar:bar];
614
+ UIView *button = inBar ? [bar viewOfItem:item] : nil;
615
+ waitsForWindow = waitsForWindow || (inBar && !button.window);
616
+ [view placeOverButton:button inBar:bar];
606
617
  }
618
+ _dotsWaitForWindow = waitsForWindow;
607
619
  }
608
620
 
609
621
  #pragma mark - testID (`bottomTab.testID`, `bottomTabs.moreTestID`)
610
622
 
611
- // Each tab's button carries its `testID`; a button not there yet gets it again after 0.15 s, at most 5 times; a
612
- // removed `testID` gives the button its identifier back.
613
- - (void)applyButtonTestIDsWithRetries:(NSUInteger)retries {
623
+ // Each tab's button carries its `testID`; a removed `testID` gives the button its identifier back. A button not
624
+ // there yet gets it at the layout that finds it (`tabsDidLayOut`).
625
+ - (void)applyButtonTestIDs {
614
626
  ANNBottomTabsController *tabs = self.tabs;
615
627
  UITabBar *bar = tabs.tabBar;
616
628
  if (!tabs || !bar) {
617
629
  return;
618
630
  }
619
- BOOL missing = NO;
620
631
  for (NSUInteger index = 0; index < tabs.layoutTabs.count; index++) {
621
632
  UITabBarItem *item = tabs.layoutTabs[index].tabBarItem;
622
- NSString *testID = item.accessibilityIdentifier;
623
633
  UIView *button = [bar viewOfItem:item];
624
- if (!button) {
625
- missing = missing || testID.length > 0;
626
- continue;
634
+ if (button) {
635
+ [self setTestID:item.accessibilityIdentifier ofButton:button];
627
636
  }
628
- [self setTestID:testID ofButton:button];
629
637
  }
630
638
  if (tabs.layoutTabs.count > 5) {
631
- NSString *moreTestID = [_barOptions.moreTestID withDefault:nil];
632
639
  UIView *button = [bar viewOfItem:tabs.moreNavigationController.tabBarItem];
633
640
  if (button) {
634
- [self setTestID:moreTestID ofButton:button];
635
- } else {
636
- missing = missing || moreTestID.length > 0;
641
+ [self setTestID:[_barOptions.moreTestID withDefault:nil] ofButton:button];
637
642
  }
638
643
  }
639
- if (!missing || retries == 0) {
640
- return;
641
- }
642
- __weak ANNBottomTabsPresenter *weakSelf = self;
643
- dispatch_after(
644
- dispatch_time(DISPATCH_TIME_NOW, (int64_t)(ANNTestIDRetryInterval * NSEC_PER_SEC)),
645
- dispatch_get_main_queue(), ^{
646
- [weakSelf applyButtonTestIDsWithRetries:retries - 1];
647
- });
648
644
  }
649
645
 
650
646
  - (void)setTestID:(NSString *)testID ofButton:(UIView *)button {
@@ -728,8 +724,9 @@ static ANNBottomTabOptions *ANNWithIcons(ANNBottomTabOptions *bottomTab, NSArray
728
724
  warned = YES;
729
725
  RCTLogWarn(
730
726
  @"[ApexNavigation] bottomTabs.backgroundColor is ignored with Liquid "
731
- @"Glass (iOS 26). It applies with UIDesignRequiresCompatibility and on "
732
- @"earlier iOS versions.");
727
+ @"Glass (iOS 26). It applies before iOS 26 and where UIKit keeps the "
728
+ @"earlier design for UIDesignRequiresCompatibility (iOS 26; iOS 27 only "
729
+ @"for an app built with an SDK before iOS 27).");
733
730
  }
734
731
  }
735
732
  }
@@ -969,14 +966,15 @@ static ANNBottomTabOptions *ANNWithIcons(ANNBottomTabOptions *bottomTab, NSArray
969
966
  [tabs updateRootLayoutOfShownScreens];
970
967
  }
971
968
  if (mergeOptions.testID.hasValue || mergeOptions.moreTestID.hasValue) {
972
- [self applyButtonTestIDsWithRetries:ANNTestIDRetries];
969
+ [self applyButtonTestIDs];
973
970
  }
974
971
  }
975
972
 
976
973
  #pragma mark - The accessory (iOS 26)
977
974
 
978
- // No name or `visible: false`: no accessory. The same id shown: nothing; another: a new one. A root of an id stays
979
- // with the tabs once made, so one hidden and shown again keeps its state.
975
+ // No name or `visible: false`: no accessory. The same id shown: nothing; another: a new one. A hidden accessory keeps
976
+ // its root, so one hidden and shown again keeps its state; the roots of the other ids stop once another accessory
977
+ // shows and theirs is out of the window.
980
978
  - (void)applyAccessoryOf:(ANNNavigationOptions *)options animated:(BOOL)animated {
981
979
  if (@available(iOS 26.0, *)) {
982
980
  ANNBottomTabsController *tabs = self.tabs;
@@ -1012,8 +1010,37 @@ static ANNBottomTabOptions *ANNWithIcons(ANNBottomTabOptions *bottomTab, NSArray
1012
1010
  return;
1013
1011
  }
1014
1012
  _accessoryId = componentId;
1013
+ [view whenOutOfWindow:nil];
1015
1014
  UITabAccessory *tabAccessory = [[UITabAccessory alloc] initWithContentView:view];
1016
1015
  [tabs setBottomAccessory:tabAccessory animated:animated && inWindow];
1016
+ [self stopAccessoriesOtherThan:componentId];
1017
+ }
1018
+ }
1019
+
1020
+ // The roots of the accessories not shown stop, each once its view is out of the window, unless it shows again first.
1021
+ - (void)stopAccessoriesOtherThan:(NSString *)shownId {
1022
+ ANNBottomTabsController *tabs = self.tabs;
1023
+ __weak ANNBottomTabsPresenter *weakSelf = self;
1024
+ __weak ANNReactComponentRegistry *weakComponents = tabs.components;
1025
+ for (NSString *componentId in _accessoryViews.allKeys) {
1026
+ if ([componentId isEqualToString:shownId]) {
1027
+ continue;
1028
+ }
1029
+ ANNBottomTabsAccessoryView *view = _accessoryViews[componentId];
1030
+ __weak ANNBottomTabsAccessoryView *weakView = view;
1031
+ [view whenOutOfWindow:^{
1032
+ ANNBottomTabsPresenter *presenter = weakSelf;
1033
+ ANNBottomTabsAccessoryView *gone = weakView;
1034
+ if (!presenter || !gone || presenter->_accessoryViews[componentId] != gone ||
1035
+ [presenter->_accessoryId isEqualToString:componentId]) {
1036
+ return;
1037
+ }
1038
+ [presenter->_accessoryViews removeObjectForKey:componentId];
1039
+ ANNReactComponentRegistry *components = weakComponents;
1040
+ if ([components existingComponent:componentId] == gone.reactView) {
1041
+ [components removeChildComponent:componentId];
1042
+ }
1043
+ }];
1017
1044
  }
1018
1045
  }
1019
1046
 
@@ -1062,18 +1089,78 @@ static ANNBottomTabOptions *ANNWithIcons(ANNBottomTabOptions *bottomTab, NSArray
1062
1089
  [self updateCells];
1063
1090
  }
1064
1091
 
1092
+ // The `testID`s and the dots go on the buttons again only when the bar has other buttons than they were applied to,
1093
+ // another size or other traits; a merge and a rebuilt item apply them at once. A dot placed out of the window waits
1094
+ // for the next layout.
1065
1095
  - (void)tabsDidLayOut {
1066
1096
  if (!_tabsAreSet) {
1067
1097
  return;
1068
1098
  }
1069
1099
  [self updateHiddenTitles];
1070
- if (!ANNTabsDesign.isGlass) {
1100
+ BOOL changed = [self barChangedSinceApplied];
1101
+ if ((changed || _dotsWaitForWindow) && !ANNTabsDesign.isGlass) {
1071
1102
  [self placeDots];
1072
1103
  }
1073
- [self applyButtonTestIDsWithRetries:0];
1104
+ if (changed) {
1105
+ [self applyButtonTestIDs];
1106
+ }
1074
1107
  [_row layOutInTabs];
1075
1108
  }
1076
1109
 
1110
+ - (void)tabsDidAppear {
1111
+ if (_tabsAreSet && _dotsWaitForWindow && !ANNTabsDesign.isGlass) {
1112
+ [self placeDots];
1113
+ }
1114
+ }
1115
+
1116
+ // The bar's items and the button of each tab and of More, by pointer, against those last seen; no walk through the
1117
+ // buttons. An item moving between the bar and More changes the items. The tabs lay out before the bar does: a tab in
1118
+ // the bar without its button yet makes the bar lay out first.
1119
+ - (BOOL)barChangedSinceApplied {
1120
+ ANNBottomTabsController *tabs = self.tabs;
1121
+ UITabBar *bar = tabs.tabBar;
1122
+ if (!tabs || !bar) {
1123
+ return NO;
1124
+ }
1125
+ NSArray<UIViewController *> *layoutTabs = tabs.layoutTabs;
1126
+ NSArray<UITabBarItem *> *barItems = bar.items;
1127
+ NSUInteger tabCount = layoutTabs.count + (layoutTabs.count > 5 ? 1 : 0);
1128
+ NSMutableArray *seen = [NSMutableArray arrayWithArray:barItems];
1129
+ BOOL laidOut = NO;
1130
+ for (NSUInteger index = 0; index < tabCount; index++) {
1131
+ UITabBarItem *item = index < layoutTabs.count ? layoutTabs[index].tabBarItem
1132
+ : tabs.moreNavigationController.tabBarItem;
1133
+ UIView *button = [bar viewOfItem:item];
1134
+ if (!button && !laidOut && bar.window &&
1135
+ [barItems indexOfObjectIdenticalTo:item] != NSNotFound) {
1136
+ laidOut = YES;
1137
+ [bar layoutIfNeeded];
1138
+ button = [bar viewOfItem:item];
1139
+ }
1140
+ [seen addObject:button ?: NSNull.null];
1141
+ }
1142
+ NSUInteger count = seen.count;
1143
+ BOOL changed = _appliedButtons.count != count;
1144
+ for (NSUInteger index = 0; index < count && !changed; index++) {
1145
+ id object = seen[index] == NSNull.null ? nil : seen[index];
1146
+ changed = (__bridge void *)object != [_appliedButtons pointerAtIndex:index];
1147
+ }
1148
+ CGSize size = bar.bounds.size;
1149
+ UITraitCollection *traits = bar.traitCollection;
1150
+ changed = changed || !CGSizeEqualToSize(size, _appliedBarSize) ||
1151
+ ![traits isEqual:_appliedBarTraits];
1152
+ if (!changed) {
1153
+ return NO;
1154
+ }
1155
+ _appliedButtons.count = 0;
1156
+ for (id object in seen) {
1157
+ [_appliedButtons addPointer:object == NSNull.null ? NULL : (__bridge void *)object];
1158
+ }
1159
+ _appliedBarSize = size;
1160
+ _appliedBarTraits = traits;
1161
+ return YES;
1162
+ }
1163
+
1077
1164
  // The glass bar measures a title when it is set and keeps that size: a title set before the bar was ever in a window
1078
1165
  // was measured in a button of its first layout there, when the bar's floating platter had no size yet, and stays cut
1079
1166
  // short ("Sec…") and lower than a title measured later. Neither a layout of the bar nor of its buttons measures it
@@ -2,16 +2,17 @@
2
2
 
3
3
  NS_ASSUME_NONNULL_BEGIN
4
4
 
5
- /// Which design UIKit draws the bars in: the Liquid Glass of iOS 26, or the design before it, which iOS 26 keeps when
6
- /// the app's Info.plist has `UIDesignRequiresCompatibility = YES` (the compatibility mode). The key is read once per
7
- /// process. Every place of the core that depends on the design asks here (the module `UITabBar+utils` keeps its own
8
- /// copy).
5
+ /// Which design UIKit draws the bars in: the Liquid Glass of iOS 26, or the design before it, which UIKit keeps when
6
+ /// the app's Info.plist has `UIDesignRequiresCompatibility = YES` (the compatibility mode): on iOS 26, and on iOS 27
7
+ /// only for an app built with an SDK before iOS 27. The key is read once per process. Every place of the core that
8
+ /// depends on the design asks here.
9
9
  @interface ANNTabsDesign : NSObject
10
10
 
11
11
  /// iOS 26 or later, and not the compatibility mode.
12
12
  @property(class, nonatomic, readonly) BOOL isGlass;
13
13
 
14
- /// iOS 26 or later with `UIDesignRequiresCompatibility = YES`: the bars look as before iOS 26.
14
+ /// iOS 26 or later with `UIDesignRequiresCompatibility = YES`, where UIKit honors it (not on iOS 27 and later for an
15
+ /// app built with the iOS 27 SDK): the bars look as before iOS 26.
15
16
  @property(class, nonatomic, readonly) BOOL isCompatibilityMode;
16
17
 
17
18
  /// iOS 18 and later on an iPad or a Mac in a regular width: the system's tab bar is on top (or in the sidebar), and
@@ -2,7 +2,10 @@
2
2
 
3
3
  @implementation ANNTabsDesign
4
4
 
5
- // Read once: the Info.plist of a running app doesn't change.
5
+ // Read once: the Info.plist of a running app doesn't change. iOS 26 keeps the earlier design for the key; iOS 27 keeps
6
+ // it only for an app built with an SDK before iOS 27 and ignores it for one built with the iOS 27 SDK (an app linked
7
+ // against the iOS 26 SDK keeps the earlier design on iOS 27, one linked against the iOS 27 SDK gets the glass). The
8
+ // core is compiled with the app, so the SDK it is compiled with is the app's.
6
9
  + (BOOL)isCompatibilityMode {
7
10
  static BOOL compatibility;
8
11
  static dispatch_once_t once;
@@ -11,6 +14,11 @@
11
14
  id value = NSBundle.mainBundle.infoDictionary[@"UIDesignRequiresCompatibility"];
12
15
  compatibility = [value respondsToSelector:@selector(boolValue)] && [value boolValue];
13
16
  }
17
+ #if __IPHONE_OS_VERSION_MAX_ALLOWED >= 270000
18
+ if (@available(iOS 27.0, *)) {
19
+ compatibility = NO;
20
+ }
21
+ #endif
14
22
  });
15
23
  return compatibility;
16
24
  }
@@ -4,18 +4,18 @@
4
4
 
5
5
  /**
6
6
  * The button of an item in the tab bar. UIKit has no public API for it: this reads the private
7
- * `view` of the item, and is nil when UIKit has no such view (or the item none).
7
+ * `view` of the item, the core's one private read of the bar, and is nil when the item has no
8
+ * button (out of the bar, or before its layout). When UIKit has no such key any more, DEBUG logs it
9
+ * once.
8
10
  */
9
11
  - (UIView *)viewOfItem:(UITabBarItem *)item;
10
12
 
11
- - (UIView *)tabBarItemViewAtIndex:(NSUInteger)index;
12
-
13
13
  - (void)removeTabBarItemTitles;
14
14
 
15
15
  /**
16
16
  * Icons in the middle of the buttons of this tab bar, for items without titles: before iOS 26 (and
17
- * in its compatibility mode) a button keeps the room of its title; the iOS 26 design centers the
18
- * icons itself, and this does nothing there. UIKit has no public API for it: the layout of the
17
+ * in its compatibility mode, `ANNTabsDesign`) a button keeps the room of its title; the iOS 26
18
+ * design centers the icons itself, and this does nothing there. UIKit has no public API for it: the layout of the
19
19
  * private button class changes once for the app, and only tab bars with centered images move their
20
20
  * icons (and badges). `NO` gives the buttons the layout of UIKit back.
21
21
  */
@@ -1,5 +1,7 @@
1
1
  #import "UITabBar+utils.h"
2
+ #import "ANNTabsDesign.h"
2
3
  #import "UIView+Utils.h"
4
+ #import <React/RCTLog.h>
3
5
  #import <objc/runtime.h>
4
6
 
5
7
  static const void *ANNItemImagesCenteredKey = &ANNItemImagesCenteredKey;
@@ -37,17 +39,16 @@ static void ANNTabBarButtonLayoutSubviews(UIView *button, SEL _cmd) {
37
39
  badge.center = CGPointMake(badge.center.x, badge.center.y + offset);
38
40
  }
39
41
 
40
- // The design of iOS 26 centers the icon of an item without a title itself; in its compatibility
41
- // mode (UIDesignRequiresCompatibility) the tab bar is drawn as before.
42
+ // The design of iOS 26 centers the icon of an item without a title itself; the design before it
43
+ // (before iOS 26, and the compatibility mode where UIKit keeps it) keeps the title's room.
42
44
  static BOOL ANNTabBarButtonsKeepTitleRoom(void) {
43
- if (@available(iOS 26.0, *)) {
44
- return [[NSBundle.mainBundle objectForInfoDictionaryKey:@"UIDesignRequiresCompatibility"]
45
- boolValue];
46
- }
47
- return YES;
45
+ return !ANNTabsDesign.isGlass;
48
46
  }
49
47
 
50
- // Once for the app; the buttons of other tab bars keep the layout of UIKit.
48
+ // Once for the app; the buttons of other tab bars keep the layout of UIKit. No public API does this: in the
49
+ // compatibility mode of iOS 26 UIKit ignores `imageInsets` and a symbol's baseline offset, and a symbol drawn into a
50
+ // taller bitmap is scaled down and stops being a symbol. `badgePositionAdjustment` would move the badge alone, so the
51
+ // button's layout moves both.
51
52
  static void ANNInstallTabBarButtonLayout(void) {
52
53
  static dispatch_once_t once;
53
54
  dispatch_once(&once, ^{
@@ -65,18 +66,36 @@ static void ANNInstallTabBarButtonLayout(void) {
65
66
  });
66
67
  }
67
68
 
69
+ // Once per app run, in DEBUG: the tab items' buttons can't be found any more.
70
+ static void ANNWarnNoButtonOfItem(void) {
71
+ #if DEBUG
72
+ static dispatch_once_t once;
73
+ dispatch_once(&once, ^{
74
+ RCTLogWarn(@"[ApexNavigation] This iOS version gives no button for a tab item: "
75
+ @"bottomTab.testID on the tab buttons, the dot before iOS 26 and the long "
76
+ @"press on a tab don't apply.");
77
+ });
78
+ #endif
79
+ }
80
+
68
81
  @implementation UITabBar (utils)
69
82
 
70
83
  - (UIView *)viewOfItem:(UITabBarItem *)item {
84
+ if (!item) {
85
+ return nil;
86
+ }
87
+ // An item out of the bar (in More, or before the bar's first layout) has no button: that is no failure. Only an
88
+ // item without the `view` key, or with something else under it, says that UIKit changed.
71
89
  if (![item respondsToSelector:NSSelectorFromString(@"view")]) {
90
+ ANNWarnNoButtonOfItem();
72
91
  return nil;
73
92
  }
74
93
  id view = [item valueForKey:@"view"];
75
- return [view isKindOfClass:UIView.class] ? view : nil;
76
- }
77
-
78
- - (UIView *)tabBarItemViewAtIndex:(NSUInteger)index {
79
- return index < self.items.count ? [self viewOfItem:self.items[index]] : nil;
94
+ if (view && ![view isKindOfClass:UIView.class]) {
95
+ ANNWarnNoButtonOfItem();
96
+ return nil;
97
+ }
98
+ return view;
80
99
  }
81
100
 
82
101
  - (void)removeTabBarItemTitles {
@@ -11,6 +11,8 @@ NS_ASSUME_NONNULL_BEGIN
11
11
 
12
12
  @property(nonatomic, strong) Bool *visible;
13
13
  @property(nonatomic, strong) Bool *animate;
14
+ /// `'platform'` or `'none'`; read on Android only: the system switches tabs at once.
15
+ @property(nonatomic, strong) Text *switchAnimation;
14
16
  /// The index of the tab to select; a whole number (the fraction is dropped).
15
17
  @property(nonatomic, strong) Double *currentTabIndex;
16
18
  @property(nonatomic, strong) Text *currentTabId;
@@ -6,6 +6,7 @@
6
6
  return @[
7
7
  [ANNOptionField boolField:@"visible"],
8
8
  [ANNOptionField boolField:@"animate"],
9
+ [ANNOptionField enumField:@"switchAnimation" values:@[ @"platform", @"none" ]],
9
10
  [ANNOptionField doubleField:@"currentTabIndex"],
10
11
  [ANNOptionField textField:@"currentTabId"],
11
12
  [ANNOptionField textField:@"testID"],
@@ -20,6 +20,13 @@ NS_ASSUME_NONNULL_BEGIN
20
20
  /// The group of options under `key`: nil when it is not an object (`null` included), which reads as an empty group.
21
21
  NSDictionary *_Nullable ANNOptionsDictionary(NSDictionary *_Nullable dict, NSString *key);
22
22
 
23
+ /// Two values a group of options holds are the same: params and groups by `isSameValueAs:`, arrays item by item,
24
+ /// anything else as `ANNJSONValuesSame` says. nil is the same only as nil (an unset array is not an empty one).
25
+ BOOL ANNOptionValuesSame(id _Nullable a, id _Nullable b);
26
+
27
+ /// A hash of a value `ANNOptionValuesSame` compares: values that are the same have the same hash.
28
+ NSUInteger ANNOptionValueHash(id _Nullable value);
29
+
23
30
  #if DEBUG
24
31
  /// Development only: checks the field table of `root` and of every group class reached through its group and
25
32
  /// group-array fields.
@@ -57,6 +64,17 @@ void ANNCheckOptionClassesFrom(Class root);
57
64
  /// These over a copy of `defaults`; neither changes.
58
65
  - (instancetype)withDefault:(nullable ANNOptions *)defaults;
59
66
 
67
+ /// A group of the same class with the same options, field by field at any depth: two reads of the same JSON, a copy,
68
+ /// two resolutions of the same layers. The fields are the field table's; a module's group (an empty table) compares
69
+ /// every property of an options kind it declares. A value that is nil is the same only as nil.
70
+ ///
71
+ /// Not `isEqual:`: a group changes in place (a merge, the pick of a menu's item), so a hash by value would move under
72
+ /// a set or a dictionary that holds it. `==` and `isEqual:` stay identity.
73
+ - (BOOL)isSameValueAs:(nullable ANNOptions *)other;
74
+
75
+ /// A hash consistent with `isSameValueAs:`; it changes when the group does.
76
+ - (NSUInteger)valueHash;
77
+
60
78
  @end
61
79
 
62
80
  NS_ASSUME_NONNULL_END
@@ -11,7 +11,6 @@ NSDictionary *ANNOptionsDictionary(NSDictionary *dict, NSString *key) {
11
11
  return [value isKindOfClass:NSDictionary.class] ? value : nil;
12
12
  }
13
13
 
14
- #if DEBUG
15
14
  // The kinds of property a group holds options in.
16
15
  static BOOL ANNIsOptionClass(Class cls) {
17
16
  return [cls isSubclassOfClass:ANNParam.class] || [cls isSubclassOfClass:ANNOptions.class] ||
@@ -33,6 +32,7 @@ static Class ANNPropertyClass(objc_property_t property) {
33
32
  return name ? NSClassFromString(name) : nil;
34
33
  }
35
34
 
35
+ #if DEBUG
36
36
  // There is no iOS test target: in development each group of the core checks once that its table names every property
37
37
  // that holds options, and that every field of the table has its property (the stand-in for the whole-tree test of
38
38
  // Android). A missing field would be neither read, merged, copied nor given defaults.
@@ -86,6 +86,94 @@ static NSArray<ANNOptionField *> *ANNFieldsOf(Class cls) {
86
86
  }
87
87
  }
88
88
 
89
+ // The properties that hold the options of a group, asked once per class: its field table's, or for a module's group
90
+ // (its own read and merge, an empty table) every property of an options kind its classes declare up to `ANNOptions`.
91
+ static NSArray<NSString *> *ANNValuePropertiesOf(Class cls) {
92
+ static NSMutableDictionary<NSString *, NSArray<NSString *> *> *propertiesByClass;
93
+ NSString *name = NSStringFromClass(cls);
94
+ @synchronized(ANNOptions.class) {
95
+ if (!propertiesByClass) {
96
+ propertiesByClass = [NSMutableDictionary new];
97
+ }
98
+ NSArray<NSString *> *names = propertiesByClass[name];
99
+ if (names) {
100
+ return names;
101
+ }
102
+ }
103
+ NSArray<ANNOptionField *> *fields = ANNFieldsOf(cls);
104
+ NSMutableArray<NSString *> *found = [NSMutableArray new];
105
+ if (fields.count) {
106
+ for (ANNOptionField *field in fields) {
107
+ [found addObject:field.property];
108
+ }
109
+ } else {
110
+ NSSet<NSString *> *inherited =
111
+ [NSSet setWithArray:@[ @"description", @"debugDescription" ]];
112
+ for (Class current = cls; current && current != ANNOptions.class;
113
+ current = class_getSuperclass(current)) {
114
+ unsigned int count = 0;
115
+ objc_property_t *properties = class_copyPropertyList(current, &count);
116
+ for (unsigned int i = 0; i < count; i++) {
117
+ NSString *property = @(property_getName(properties[i]));
118
+ Class propertyClass = ANNPropertyClass(properties[i]);
119
+ if (propertyClass && ANNIsOptionClass(propertyClass) &&
120
+ ![inherited containsObject:property] && ![found containsObject:property]) {
121
+ [found addObject:property];
122
+ }
123
+ }
124
+ free(properties);
125
+ }
126
+ }
127
+ NSArray<NSString *> *names = [found copy];
128
+ @synchronized(ANNOptions.class) {
129
+ propertiesByClass[name] = names;
130
+ }
131
+ return names;
132
+ }
133
+
134
+ BOOL ANNOptionValuesSame(id a, id b) {
135
+ if (a == b) {
136
+ return YES;
137
+ }
138
+ if ([a isKindOfClass:ANNParam.class]) {
139
+ return [b isKindOfClass:ANNParam.class] && [(ANNParam *)a isSameValueAs:b];
140
+ }
141
+ if ([a isKindOfClass:ANNOptions.class]) {
142
+ return [b isKindOfClass:ANNOptions.class] && [(ANNOptions *)a isSameValueAs:b];
143
+ }
144
+ if ([a isKindOfClass:NSArray.class]) {
145
+ if (![b isKindOfClass:NSArray.class] || [a count] != [b count]) {
146
+ return NO;
147
+ }
148
+ NSArray *items = b;
149
+ NSUInteger index = 0;
150
+ for (id item in (NSArray *)a) {
151
+ if (!ANNOptionValuesSame(item, items[index++])) {
152
+ return NO;
153
+ }
154
+ }
155
+ return YES;
156
+ }
157
+ return ANNJSONValuesSame(a, b);
158
+ }
159
+
160
+ NSUInteger ANNOptionValueHash(id value) {
161
+ if ([value isKindOfClass:ANNParam.class]) {
162
+ return [(ANNParam *)value valueHash];
163
+ }
164
+ if ([value isKindOfClass:ANNOptions.class]) {
165
+ return [(ANNOptions *)value valueHash];
166
+ }
167
+ if ([value isKindOfClass:NSArray.class]) {
168
+ NSUInteger hash = [value count];
169
+ for (id item in value) {
170
+ hash = hash * 31 + ANNOptionValueHash(item);
171
+ }
172
+ return hash;
173
+ }
174
+ return ANNJSONValueHash(value);
175
+ }
176
+
89
177
  #if DEBUG
90
178
  // Runs the check on `root` and on every class reached through its group and group-array fields, so a class that only
91
179
  // an array holds (a button, an action of a fab, a token of the search bar) is checked although no object of it is made.
@@ -326,4 +414,27 @@ static NSArray *ANNCopyItems(NSArray *items) {
326
414
  return result;
327
415
  }
328
416
 
417
+ - (BOOL)isSameValueAs:(ANNOptions *)other {
418
+ if (other == self) {
419
+ return YES;
420
+ }
421
+ if (other.class != self.class) {
422
+ return NO;
423
+ }
424
+ for (NSString *property in ANNValuePropertiesOf(self.class)) {
425
+ if (!ANNOptionValuesSame([self valueForKey:property], [other valueForKey:property])) {
426
+ return NO;
427
+ }
428
+ }
429
+ return YES;
430
+ }
431
+
432
+ - (NSUInteger)valueHash {
433
+ NSUInteger hash = (NSUInteger)(__bridge void *)self.class;
434
+ for (NSString *property in ANNValuePropertiesOf(self.class)) {
435
+ hash = hash * 31 + ANNOptionValueHash([self valueForKey:property]);
436
+ }
437
+ return hash;
438
+ }
439
+
329
440
  @end