react-native-screens 4.12.0 → 4.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (235) hide show
  1. package/RNScreens.podspec +29 -2
  2. package/android/src/main/java/com/swmansion/rnscreens/RNScreensPackage.kt +4 -0
  3. package/android/src/main/java/com/swmansion/rnscreens/ScreenContainer.kt +9 -1
  4. package/android/src/main/java/com/swmansion/rnscreens/ScreenFragmentWrapper.kt +0 -1
  5. package/android/src/main/java/com/swmansion/rnscreens/ScreenStackHeaderConfig.kt +4 -4
  6. package/android/src/main/java/com/swmansion/rnscreens/ScreensModule.kt +1 -1
  7. package/android/src/main/java/com/swmansion/rnscreens/bottomsheet/DimmingView.kt +4 -4
  8. package/android/src/main/java/com/swmansion/rnscreens/bottomsheet/DimmingViewManager.kt +8 -2
  9. package/android/src/main/java/com/swmansion/rnscreens/events/ScreenAnimationDelegate.kt +1 -2
  10. package/android/src/main/java/com/swmansion/rnscreens/events/ScreenEventEmitter.kt +16 -13
  11. package/android/src/main/java/com/swmansion/rnscreens/gamma/common/BaseEventEmitter.kt +22 -0
  12. package/android/src/main/java/com/swmansion/rnscreens/gamma/common/FragmentProviding.kt +11 -0
  13. package/android/src/main/java/com/swmansion/rnscreens/gamma/common/NamingAwareEventType.kt +13 -0
  14. package/android/src/main/java/com/swmansion/rnscreens/gamma/helpers/EventHelpers.kt +6 -0
  15. package/android/src/main/java/com/swmansion/rnscreens/gamma/helpers/FragmentManagerHelper.kt +76 -0
  16. package/android/src/main/java/com/swmansion/rnscreens/gamma/helpers/SystemDrawable.kt +33 -0
  17. package/android/src/main/java/com/swmansion/rnscreens/gamma/tabs/TabScreen.kt +101 -0
  18. package/android/src/main/java/com/swmansion/rnscreens/gamma/tabs/TabScreenDelegate.kt +17 -0
  19. package/android/src/main/java/com/swmansion/rnscreens/gamma/tabs/TabScreenEventEmitter.kt +46 -0
  20. package/android/src/main/java/com/swmansion/rnscreens/gamma/tabs/TabScreenFragment.kt +37 -0
  21. package/android/src/main/java/com/swmansion/rnscreens/gamma/tabs/TabScreenViewManager.kt +178 -0
  22. package/android/src/main/java/com/swmansion/rnscreens/gamma/tabs/TabsHost.kt +433 -0
  23. package/android/src/main/java/com/swmansion/rnscreens/gamma/tabs/TabsHostEventEmitter.kt +14 -0
  24. package/android/src/main/java/com/swmansion/rnscreens/gamma/tabs/TabsHostViewManager.kt +177 -0
  25. package/android/src/main/java/com/swmansion/rnscreens/gamma/tabs/event/TabScreenDidAppearEvent.kt +30 -0
  26. package/android/src/main/java/com/swmansion/rnscreens/gamma/tabs/event/TabScreenDidDisappearEvent.kt +30 -0
  27. package/android/src/main/java/com/swmansion/rnscreens/gamma/tabs/event/TabScreenWillAppearEvent.kt +30 -0
  28. package/android/src/main/java/com/swmansion/rnscreens/gamma/tabs/event/TabScreenWillDisappearEvent.kt +30 -0
  29. package/android/src/main/java/com/swmansion/rnscreens/gamma/tabs/event/TabsHostNativeFocusChangeEvent.kt +36 -0
  30. package/android/src/main/java/com/swmansion/rnscreens/stack/views/ChildDrawingOrderStrategyImpl.kt +0 -1
  31. package/android/src/main/java/com/swmansion/rnscreens/transition/ExternalBoundaryValuesEvaluator.kt +9 -2
  32. package/android/src/main/java/com/swmansion/rnscreens/utils/FragmentTransactionKt.kt +4 -1
  33. package/android/src/main/jni/rnscreens.h +1 -0
  34. package/android/src/paper/java/com/facebook/react/viewmanagers/RNSBottomTabsManagerDelegate.java +76 -0
  35. package/android/src/paper/java/com/facebook/react/viewmanagers/RNSBottomTabsManagerInterface.java +33 -0
  36. package/android/src/paper/java/com/facebook/react/viewmanagers/RNSBottomTabsScreenManagerDelegate.java +97 -0
  37. package/android/src/paper/java/com/facebook/react/viewmanagers/RNSBottomTabsScreenManagerInterface.java +40 -0
  38. package/android/src/paper/java/com/swmansion/rnscreens/FabricEnabledHeaderConfigViewGroup.kt +2 -2
  39. package/android/src/versioned/backgroundcolor/76/ViewBackgroundUtils.kt +0 -1
  40. package/android/src/versioned/backgroundcolor/latest/ViewBackgroundUtils.kt +0 -3
  41. package/android/src/versioned/pointerevents/77/com/swmansion/rnscreens/PointerEventsBoxNoneImpl.kt +1 -1
  42. package/android/src/versioned/pointerevents/latest/com/swmansion/rnscreens/PointerEventsBoxNoneImpl.kt +1 -1
  43. package/common/cpp/react/renderer/components/rnscreens/RNSBottomTabsComponentDescriptor.h +31 -0
  44. package/common/cpp/react/renderer/components/rnscreens/RNSBottomTabsShadowNode.cpp +20 -0
  45. package/common/cpp/react/renderer/components/rnscreens/RNSBottomTabsShadowNode.h +32 -0
  46. package/common/cpp/react/renderer/components/rnscreens/RNSBottomTabsState.cpp +22 -0
  47. package/common/cpp/react/renderer/components/rnscreens/RNSBottomTabsState.h +44 -0
  48. package/common/cpp/react/renderer/components/rnscreens/RNSScreenShadowNode.cpp +8 -0
  49. package/common/cpp/react/renderer/components/rnscreens/RNSSplitViewScreenComponentDescriptor.h +40 -0
  50. package/common/cpp/react/renderer/components/rnscreens/RNSSplitViewScreenShadowNode.cpp +13 -0
  51. package/common/cpp/react/renderer/components/rnscreens/RNSSplitViewScreenShadowNode.h +36 -0
  52. package/common/cpp/react/renderer/components/rnscreens/RNSSplitViewScreenState.h +32 -0
  53. package/cpp/RNScreensTurboModule.h +5 -0
  54. package/ios/RNSEnums.h +6 -0
  55. package/ios/RNSScreen.h +2 -1
  56. package/ios/RNSScreen.mm +48 -1
  57. package/ios/RNSScreenContainer.mm +6 -0
  58. package/ios/RNSScreenStack.h +3 -1
  59. package/ios/RNSScreenStack.mm +39 -2
  60. package/ios/RNSScreenStackHeaderConfig.mm +1 -1
  61. package/ios/RNSScrollViewBehaviorOverriding.h +24 -0
  62. package/ios/RNSScrollViewFinder.h +13 -0
  63. package/ios/RNSScrollViewFinder.mm +22 -0
  64. package/ios/RNSScrollViewHelper.h +10 -0
  65. package/ios/RNSScrollViewHelper.mm +15 -0
  66. package/ios/RNScreens-Bridging-Header.h +4 -0
  67. package/ios/UIScrollView+RNScreens.h +14 -0
  68. package/ios/UIScrollView+RNScreens.mm +15 -0
  69. package/ios/bottom-tabs/RCTConvert+RNSBottomTabs.h +18 -0
  70. package/ios/bottom-tabs/RCTConvert+RNSBottomTabs.mm +25 -0
  71. package/ios/bottom-tabs/RNSBottomTabsHostComponentView.h +80 -0
  72. package/ios/bottom-tabs/RNSBottomTabsHostComponentView.mm +486 -0
  73. package/ios/bottom-tabs/RNSBottomTabsHostComponentViewManager.h +11 -0
  74. package/ios/bottom-tabs/RNSBottomTabsHostComponentViewManager.mm +48 -0
  75. package/ios/bottom-tabs/RNSBottomTabsHostEventEmitter.h +53 -0
  76. package/ios/bottom-tabs/RNSBottomTabsHostEventEmitter.mm +57 -0
  77. package/ios/bottom-tabs/RNSBottomTabsScreenComponentView.h +95 -0
  78. package/ios/bottom-tabs/RNSBottomTabsScreenComponentView.mm +492 -0
  79. package/ios/bottom-tabs/RNSBottomTabsScreenComponentViewManager.h +9 -0
  80. package/ios/bottom-tabs/RNSBottomTabsScreenComponentViewManager.mm +55 -0
  81. package/ios/bottom-tabs/RNSBottomTabsScreenEventEmitter.h +53 -0
  82. package/ios/bottom-tabs/RNSBottomTabsScreenEventEmitter.mm +106 -0
  83. package/ios/bottom-tabs/RNSBottomTabsSpecialEffectsSupporting.h +17 -0
  84. package/ios/bottom-tabs/RNSTabBarAppearanceCoordinator.h +34 -0
  85. package/ios/bottom-tabs/RNSTabBarAppearanceCoordinator.mm +243 -0
  86. package/ios/bottom-tabs/RNSTabBarAppearanceProvider.h +23 -0
  87. package/ios/bottom-tabs/RNSTabBarController.h +132 -0
  88. package/ios/bottom-tabs/RNSTabBarController.mm +206 -0
  89. package/ios/bottom-tabs/RNSTabBarControllerDelegate.h +9 -0
  90. package/ios/bottom-tabs/RNSTabBarControllerDelegate.mm +63 -0
  91. package/ios/bottom-tabs/RNSTabsScreenViewController.h +42 -0
  92. package/ios/bottom-tabs/RNSTabsScreenViewController.mm +105 -0
  93. package/ios/bottom-tabs/extensions/RNSBottomTabsHostComponentView+RNSImageLoader.h +21 -0
  94. package/ios/bottom-tabs/extensions/RNSBottomTabsHostComponentView+RNSImageLoader.mm +22 -0
  95. package/ios/bridging/RNSReactBaseView.h +31 -0
  96. package/ios/bridging/RNSReactBaseView.mm +5 -0
  97. package/ios/bridging/Swift-Bridging.h +7 -0
  98. package/ios/conversion/RNSConversions-BottomTabs.mm +216 -0
  99. package/ios/conversion/RNSConversions-SplitView.mm +63 -0
  100. package/ios/conversion/RNSConversions.h +53 -0
  101. package/ios/gamma/ReactMountingTransactionObserving.swift +7 -0
  102. package/ios/gamma/split-view/RNSSplitViewHostComponentView.h +29 -0
  103. package/ios/gamma/split-view/RNSSplitViewHostComponentView.mm +209 -0
  104. package/ios/gamma/split-view/RNSSplitViewHostComponentViewManager.h +11 -0
  105. package/ios/gamma/split-view/RNSSplitViewHostComponentViewManager.mm +7 -0
  106. package/ios/gamma/split-view/RNSSplitViewHostController.swift +98 -0
  107. package/ios/gamma/split-view/RNSSplitViewNavigationController.swift +31 -0
  108. package/ios/gamma/split-view/RNSSplitViewScreenComponentView.h +24 -0
  109. package/ios/gamma/split-view/RNSSplitViewScreenComponentView.mm +106 -0
  110. package/ios/gamma/split-view/RNSSplitViewScreenComponentViewManager.h +11 -0
  111. package/ios/gamma/split-view/RNSSplitViewScreenComponentViewManager.mm +7 -0
  112. package/ios/gamma/split-view/RNSSplitViewScreenController.swift +86 -0
  113. package/ios/gamma/split-view/RNSSplitViewScreenShadowStateProxy.h +35 -0
  114. package/ios/gamma/split-view/RNSSplitViewScreenShadowStateProxy.mm +56 -0
  115. package/ios/gamma/stack/RNSScreenStackHostComponentView.h +16 -0
  116. package/ios/gamma/stack/RNSScreenStackHostComponentView.mm +143 -0
  117. package/ios/gamma/stack/RNSScreenStackHostComponentViewManager.h +11 -0
  118. package/ios/gamma/stack/RNSScreenStackHostComponentViewManager.mm +7 -0
  119. package/ios/gamma/stack/RNSStackController.swift +65 -0
  120. package/ios/gamma/stack/RNSStackScreenComponentEventEmitter.h +37 -0
  121. package/ios/gamma/stack/RNSStackScreenComponentEventEmitter.mm +60 -0
  122. package/ios/gamma/stack/RNSStackScreenComponentView.h +36 -0
  123. package/ios/gamma/stack/RNSStackScreenComponentView.mm +124 -0
  124. package/ios/gamma/stack/RNSStackScreenComponentViewManager.h +11 -0
  125. package/ios/gamma/stack/RNSStackScreenComponentViewManager.mm +7 -0
  126. package/ios/gamma/stack/RNSStackScreenController.swift +56 -0
  127. package/ios/utils/NSString+RNSUtility.h +17 -0
  128. package/ios/utils/NSString+RNSUtility.mm +37 -0
  129. package/lib/commonjs/components/BottomTabs.js +54 -0
  130. package/lib/commonjs/components/BottomTabs.js.map +1 -0
  131. package/lib/commonjs/components/BottomTabsScreen.js +149 -0
  132. package/lib/commonjs/components/BottomTabsScreen.js.map +1 -0
  133. package/lib/commonjs/components/gamma/ScreenStackHost.js +27 -0
  134. package/lib/commonjs/components/gamma/ScreenStackHost.js.map +1 -0
  135. package/lib/commonjs/components/gamma/SplitViewHost.js +57 -0
  136. package/lib/commonjs/components/gamma/SplitViewHost.js.map +1 -0
  137. package/lib/commonjs/components/gamma/SplitViewScreen.js +22 -0
  138. package/lib/commonjs/components/gamma/SplitViewScreen.js.map +1 -0
  139. package/lib/commonjs/components/gamma/StackScreen.js +51 -0
  140. package/lib/commonjs/components/gamma/StackScreen.js.map +1 -0
  141. package/lib/commonjs/fabric/BottomTabsNativeComponent.js +19 -0
  142. package/lib/commonjs/fabric/BottomTabsNativeComponent.js.map +1 -0
  143. package/lib/commonjs/fabric/BottomTabsScreenNativeComponent.js +14 -0
  144. package/lib/commonjs/fabric/BottomTabsScreenNativeComponent.js.map +1 -0
  145. package/lib/commonjs/fabric/gamma/ScreenStackHostNativeComponent.js +11 -0
  146. package/lib/commonjs/fabric/gamma/ScreenStackHostNativeComponent.js.map +1 -0
  147. package/lib/commonjs/fabric/gamma/SplitViewHostNativeComponent.js +11 -0
  148. package/lib/commonjs/fabric/gamma/SplitViewHostNativeComponent.js.map +1 -0
  149. package/lib/commonjs/fabric/gamma/SplitViewScreenNativeComponent.js +13 -0
  150. package/lib/commonjs/fabric/gamma/SplitViewScreenNativeComponent.js.map +1 -0
  151. package/lib/commonjs/fabric/gamma/StackScreenNativeComponent.js +12 -0
  152. package/lib/commonjs/fabric/gamma/StackScreenNativeComponent.js.map +1 -0
  153. package/lib/commonjs/flags.js +70 -0
  154. package/lib/commonjs/flags.js.map +1 -0
  155. package/lib/commonjs/index.js +66 -3
  156. package/lib/commonjs/index.js.map +1 -1
  157. package/lib/commonjs/utils.js +0 -28
  158. package/lib/commonjs/utils.js.map +1 -1
  159. package/lib/module/components/BottomTabs.js +48 -0
  160. package/lib/module/components/BottomTabs.js.map +1 -0
  161. package/lib/module/components/BottomTabsScreen.js +144 -0
  162. package/lib/module/components/BottomTabsScreen.js.map +1 -0
  163. package/lib/module/components/gamma/ScreenStackHost.js +20 -0
  164. package/lib/module/components/gamma/ScreenStackHost.js.map +1 -0
  165. package/lib/module/components/gamma/SplitViewHost.js +50 -0
  166. package/lib/module/components/gamma/SplitViewHost.js.map +1 -0
  167. package/lib/module/components/gamma/SplitViewScreen.js +15 -0
  168. package/lib/module/components/gamma/SplitViewScreen.js.map +1 -0
  169. package/lib/module/components/gamma/StackScreen.js +44 -0
  170. package/lib/module/components/gamma/StackScreen.js.map +1 -0
  171. package/lib/module/fabric/BottomTabsNativeComponent.js +15 -0
  172. package/lib/module/fabric/BottomTabsNativeComponent.js.map +1 -0
  173. package/lib/module/fabric/BottomTabsScreenNativeComponent.js +12 -0
  174. package/lib/module/fabric/BottomTabsScreenNativeComponent.js.map +1 -0
  175. package/lib/module/fabric/gamma/ScreenStackHostNativeComponent.js +5 -0
  176. package/lib/module/fabric/gamma/ScreenStackHostNativeComponent.js.map +1 -0
  177. package/lib/module/fabric/gamma/SplitViewHostNativeComponent.js +5 -0
  178. package/lib/module/fabric/gamma/SplitViewHostNativeComponent.js.map +1 -0
  179. package/lib/module/fabric/gamma/SplitViewScreenNativeComponent.js +7 -0
  180. package/lib/module/fabric/gamma/SplitViewScreenNativeComponent.js.map +1 -0
  181. package/lib/module/fabric/gamma/StackScreenNativeComponent.js +8 -0
  182. package/lib/module/fabric/gamma/StackScreenNativeComponent.js.map +1 -0
  183. package/lib/module/flags.js +64 -0
  184. package/lib/module/flags.js.map +1 -0
  185. package/lib/module/index.js +16 -1
  186. package/lib/module/index.js.map +1 -1
  187. package/lib/module/utils.js +0 -27
  188. package/lib/module/utils.js.map +1 -1
  189. package/lib/typescript/components/BottomTabs.d.ts +30 -0
  190. package/lib/typescript/components/BottomTabs.d.ts.map +1 -0
  191. package/lib/typescript/components/BottomTabsScreen.d.ts +56 -0
  192. package/lib/typescript/components/BottomTabsScreen.d.ts.map +1 -0
  193. package/lib/typescript/components/gamma/ScreenStackHost.d.ts +13 -0
  194. package/lib/typescript/components/gamma/ScreenStackHost.d.ts.map +1 -0
  195. package/lib/typescript/components/gamma/SplitViewHost.d.ts +13 -0
  196. package/lib/typescript/components/gamma/SplitViewHost.d.ts.map +1 -0
  197. package/lib/typescript/components/gamma/SplitViewScreen.d.ts +13 -0
  198. package/lib/typescript/components/gamma/SplitViewScreen.d.ts.map +1 -0
  199. package/lib/typescript/components/gamma/StackScreen.d.ts +21 -0
  200. package/lib/typescript/components/gamma/StackScreen.d.ts.map +1 -0
  201. package/lib/typescript/fabric/BottomTabsNativeComponent.d.ts +31 -0
  202. package/lib/typescript/fabric/BottomTabsNativeComponent.d.ts.map +1 -0
  203. package/lib/typescript/fabric/BottomTabsScreenNativeComponent.d.ts +51 -0
  204. package/lib/typescript/fabric/BottomTabsScreenNativeComponent.d.ts.map +1 -0
  205. package/lib/typescript/fabric/gamma/ScreenStackHostNativeComponent.d.ts +7 -0
  206. package/lib/typescript/fabric/gamma/ScreenStackHostNativeComponent.d.ts.map +1 -0
  207. package/lib/typescript/fabric/gamma/SplitViewHostNativeComponent.d.ts +16 -0
  208. package/lib/typescript/fabric/gamma/SplitViewHostNativeComponent.d.ts.map +1 -0
  209. package/lib/typescript/fabric/gamma/SplitViewScreenNativeComponent.d.ts +7 -0
  210. package/lib/typescript/fabric/gamma/SplitViewScreenNativeComponent.d.ts.map +1 -0
  211. package/lib/typescript/fabric/gamma/StackScreenNativeComponent.d.ts +15 -0
  212. package/lib/typescript/fabric/gamma/StackScreenNativeComponent.d.ts.map +1 -0
  213. package/lib/typescript/flags.d.ts +45 -0
  214. package/lib/typescript/flags.d.ts.map +1 -0
  215. package/lib/typescript/index.d.ts +14 -1
  216. package/lib/typescript/index.d.ts.map +1 -1
  217. package/lib/typescript/utils.d.ts +0 -26
  218. package/lib/typescript/utils.d.ts.map +1 -1
  219. package/package.json +34 -6
  220. package/react-native.config.js +2 -1
  221. package/src/components/BottomTabs.tsx +115 -0
  222. package/src/components/BottomTabsScreen.tsx +291 -0
  223. package/src/components/gamma/ScreenStackHost.tsx +32 -0
  224. package/src/components/gamma/SplitViewHost.tsx +84 -0
  225. package/src/components/gamma/SplitViewScreen.tsx +26 -0
  226. package/src/components/gamma/StackScreen.tsx +64 -0
  227. package/src/fabric/BottomTabsNativeComponent.ts +82 -0
  228. package/src/fabric/BottomTabsScreenNativeComponent.ts +107 -0
  229. package/src/fabric/gamma/ScreenStackHostNativeComponent.ts +8 -0
  230. package/src/fabric/gamma/SplitViewHostNativeComponent.ts +39 -0
  231. package/src/fabric/gamma/SplitViewScreenNativeComponent.ts +10 -0
  232. package/src/fabric/gamma/StackScreenNativeComponent.ts +25 -0
  233. package/src/flags.ts +72 -0
  234. package/src/index.tsx +18 -1
  235. package/src/utils.ts +0 -28
@@ -0,0 +1,55 @@
1
+ #import "RNSBottomTabsScreenComponentViewManager.h"
2
+
3
+ #if !RCT_NEW_ARCH_ENABLED
4
+ #import "RNSBottomTabsScreenComponentView.h"
5
+ #endif // !RCT_NEW_ARCH_ENABLED
6
+
7
+ @implementation RNSBottomTabsScreenComponentViewManager
8
+
9
+ // TODO: This seems to be legacy arch only - remove when no longer needed
10
+
11
+ RCT_EXPORT_MODULE(RNSBottomTabsScreenManager)
12
+
13
+ #if !RCT_NEW_ARCH_ENABLED
14
+ - (UIView *)view
15
+ {
16
+ // This uses main initializer for Fabric implementation.
17
+ return [[RNSBottomTabsScreenComponentView alloc] initWithFrame:CGRectZero];
18
+ }
19
+
20
+ RCT_EXPORT_VIEW_PROPERTY(tabKey, NSString);
21
+
22
+ RCT_REMAP_VIEW_PROPERTY(isFocused, isSelectedScreen, BOOL);
23
+ RCT_EXPORT_VIEW_PROPERTY(title, NSString);
24
+ RCT_EXPORT_VIEW_PROPERTY(badgeValue, NSString);
25
+ RCT_EXPORT_VIEW_PROPERTY(tabBarBackgroundColor, UIColor);
26
+ RCT_EXPORT_VIEW_PROPERTY(tabBarBlurEffect, UIBlurEffect); // needs custom conversion, cause it has `none`
27
+
28
+ RCT_EXPORT_VIEW_PROPERTY(tabBarItemTitleFontFamily, NSString);
29
+ RCT_EXPORT_VIEW_PROPERTY(tabBarItemTitleFontSize, NSNumber);
30
+ RCT_EXPORT_VIEW_PROPERTY(tabBarItemTitleFontWeight, NSString);
31
+ RCT_EXPORT_VIEW_PROPERTY(tabBarItemTitleFontStyle, NSString);
32
+ RCT_EXPORT_VIEW_PROPERTY(tabBarItemTitleFontColor, UIColor);
33
+
34
+ RCT_EXPORT_VIEW_PROPERTY(tabBarItemIconColor, UIColor);
35
+ RCT_EXPORT_VIEW_PROPERTY(tabBarItemBadgeBackgroundColor, UIColor);
36
+
37
+ RCT_EXPORT_VIEW_PROPERTY(iconType, RNSBottomTabsIconType);
38
+ RCT_EXPORT_VIEW_PROPERTY(iconImageSource, RCTImageSource);
39
+ RCT_EXPORT_VIEW_PROPERTY(iconSfSymbolName, NSString);
40
+ RCT_EXPORT_VIEW_PROPERTY(selectedIconImageSource, RCTImageSource);
41
+ RCT_EXPORT_VIEW_PROPERTY(selectedIconSfSymbolName, NSString);
42
+
43
+ RCT_EXPORT_VIEW_PROPERTY(shouldUseRepeatedTabSelectionPopToRootSpecialEffect, BOOL);
44
+ RCT_EXPORT_VIEW_PROPERTY(shouldUseRepeatedTabSelectionScrollToTopSpecialEffect, BOOL);
45
+
46
+ RCT_EXPORT_VIEW_PROPERTY(tabBarItemTitlePositionAdjustment, UIOffset);
47
+
48
+ RCT_EXPORT_VIEW_PROPERTY(onWillAppear, RCTDirectEventBlock);
49
+ RCT_EXPORT_VIEW_PROPERTY(onWillDisappear, RCTDirectEventBlock);
50
+ RCT_EXPORT_VIEW_PROPERTY(onDidAppear, RCTDirectEventBlock);
51
+ RCT_EXPORT_VIEW_PROPERTY(onDidDisappear, RCTDirectEventBlock);
52
+
53
+ #endif // !RCT_NEW_ARCH_ENABLED
54
+
55
+ @end
@@ -0,0 +1,53 @@
1
+ #import <Foundation/Foundation.h>
2
+
3
+ // Hide C++ symbols from C compiler used when building Swift module
4
+ #if defined(__cplusplus) && RCT_NEW_ARCH_ENABLED
5
+ #import <react/renderer/components/rnscreens/EventEmitters.h>
6
+
7
+ namespace react = facebook::react;
8
+ #endif // __cplusplus
9
+
10
+ #if !RCT_NEW_ARCH_ENABLED
11
+ #import <React/RCTComponent.h>
12
+ #endif // !RCT_NEW_ARCH_ENABLED
13
+
14
+ NS_ASSUME_NONNULL_BEGIN
15
+
16
+ /**
17
+ * These methods can be called to send an appropriate event to ElementTree.
18
+ * Returned value denotes whether the event has been successfully dispatched to React event pipeline.
19
+ * The returned value of `true` does not mean, that the event has been successfully delivered.
20
+ */
21
+ @interface RNSBottomTabsScreenEventEmitter : NSObject
22
+
23
+ - (BOOL)emitOnWillAppear;
24
+ - (BOOL)emitOnDidAppear;
25
+ - (BOOL)emitOnWillDisappear;
26
+ - (BOOL)emitOnDidDisappear;
27
+
28
+ @end
29
+
30
+ #pragma mark - Hidden from Swift
31
+
32
+ #if defined(__cplusplus)
33
+
34
+ @interface RNSBottomTabsScreenEventEmitter ()
35
+
36
+ #if RCT_NEW_ARCH_ENABLED
37
+
38
+ - (void)updateEventEmitter:(const std::shared_ptr<const react::RNSBottomTabsScreenEventEmitter> &)emitter;
39
+
40
+ #else
41
+ #pragma mark - LEGACY Event emitting blocks
42
+
43
+ @property (nonatomic, copy, nullable) RCTDirectEventBlock onWillAppear;
44
+ @property (nonatomic, copy, nullable) RCTDirectEventBlock onDidAppear;
45
+ @property (nonatomic, copy, nullable) RCTDirectEventBlock onWillDisappear;
46
+ @property (nonatomic, copy, nullable) RCTDirectEventBlock onDidDisappear;
47
+
48
+ #endif // RCT_NEW_ARCH_ENABLED
49
+
50
+ @end
51
+
52
+ #endif // __cplusplus
53
+ NS_ASSUME_NONNULL_END
@@ -0,0 +1,106 @@
1
+ #import "RNSBottomTabsScreenEventEmitter.h"
2
+
3
+ #import <React/RCTLog.h>
4
+ #if RCT_NEW_ARCH_ENABLED
5
+ #import <React/RCTConversions.h>
6
+ #import <react/renderer/components/rnscreens/EventEmitters.h>
7
+ #endif // RCT_NEW_ARCH_ENABLED
8
+
9
+ @implementation RNSBottomTabsScreenEventEmitter {
10
+ #if RCT_NEW_ARCH_ENABLED
11
+ std::shared_ptr<const react::RNSBottomTabsScreenEventEmitter> _reactEventEmitter;
12
+ #endif // RCT_NEW_ARCH_ENABLED
13
+ }
14
+
15
+ - (BOOL)emitOnWillAppear
16
+ {
17
+ #if RCT_NEW_ARCH_ENABLED
18
+ if (_reactEventEmitter != nullptr) {
19
+ _reactEventEmitter->onWillAppear({});
20
+ return YES;
21
+ } else {
22
+ RCTLogWarn(@"[RNScreens] Skipped OnWillAppear event emission due to nullish emitter");
23
+ return NO;
24
+ }
25
+ #else
26
+ if (self.onWillAppear) {
27
+ self.onWillAppear(nil);
28
+ return YES;
29
+ } else {
30
+ RCTLogWarn(@"[RNScreens] Skipped OnWillAppear event emission due to nullish emitter");
31
+ return NO;
32
+ }
33
+ #endif
34
+ }
35
+
36
+ - (BOOL)emitOnDidAppear
37
+ {
38
+ #if RCT_NEW_ARCH_ENABLED
39
+ if (_reactEventEmitter != nullptr) {
40
+ _reactEventEmitter->onDidAppear({});
41
+ return YES;
42
+ } else {
43
+ RCTLogWarn(@"[RNScreens] Skipped OnDidAppear event emission due to nullish emitter");
44
+ return NO;
45
+ }
46
+ #else
47
+ if (self.onDidAppear) {
48
+ self.onDidAppear(nil);
49
+ return YES;
50
+ } else {
51
+ RCTLogWarn(@"[RNScreens] Skipped OnDidAppear event emission due to nullish emitter");
52
+ return NO;
53
+ }
54
+ #endif
55
+ }
56
+
57
+ - (BOOL)emitOnWillDisappear
58
+ {
59
+ #if RCT_NEW_ARCH_ENABLED
60
+ if (_reactEventEmitter != nullptr) {
61
+ _reactEventEmitter->onWillDisappear({});
62
+ return YES;
63
+ } else {
64
+ RCTLogWarn(@"[RNScreens] Skipped OnWillDisappear event emission due to nullish emitter");
65
+ return NO;
66
+ }
67
+ #else
68
+ if (self.onWillDisappear) {
69
+ self.onWillDisappear(nil);
70
+ return YES;
71
+ } else {
72
+ RCTLogWarn(@"[RNScreens] Skipped OnWillDisappear event emission due to nullish emitter");
73
+ return NO;
74
+ }
75
+ #endif
76
+ }
77
+
78
+ - (BOOL)emitOnDidDisappear
79
+ {
80
+ #if RCT_NEW_ARCH_ENABLED
81
+ if (_reactEventEmitter != nullptr) {
82
+ _reactEventEmitter->onDidDisappear({});
83
+ return YES;
84
+ } else {
85
+ RCTLogWarn(@"[RNScreens] Skipped OnDidDisappear event emission due to nullish emitter");
86
+ return NO;
87
+ }
88
+ #else
89
+ if (self.onDidDisappear) {
90
+ self.onDidDisappear(nil);
91
+ return YES;
92
+ } else {
93
+ RCTLogWarn(@"[RNScreens] Skipped OnDidDisappear event emission due to nullish emitter");
94
+ return NO;
95
+ }
96
+ #endif
97
+ }
98
+
99
+ #if RCT_NEW_ARCH_ENABLED
100
+ - (void)updateEventEmitter:(const std::shared_ptr<const react::RNSBottomTabsScreenEventEmitter> &)emitter
101
+ {
102
+ _reactEventEmitter = emitter;
103
+ }
104
+ #endif
105
+
106
+ @end
@@ -0,0 +1,17 @@
1
+ #import <UIKit/UIKit.h>
2
+
3
+ NS_ASSUME_NONNULL_BEGIN
4
+
5
+ @class RNSTabsScreenViewController;
6
+
7
+ @protocol RNSBottomTabsSpecialEffectsSupporting
8
+
9
+ /**
10
+ * Handle repeated tab selection (e.g. in order to pop UINavigationController to root).
11
+ * Returns boolean indicating whether the action has been handled.
12
+ */
13
+ - (bool)onRepeatedTabSelectionOfTabScreenController:(nonnull RNSTabsScreenViewController *)tabScreenController;
14
+
15
+ @end
16
+
17
+ NS_ASSUME_NONNULL_END
@@ -0,0 +1,34 @@
1
+ #import <Foundation/Foundation.h>
2
+ #import "RNSBottomTabsHostComponentView.h"
3
+ #import "RNSTabsScreenViewController.h"
4
+
5
+ NS_ASSUME_NONNULL_BEGIN
6
+
7
+ @class RCTImageLoader;
8
+
9
+ /**
10
+ * Responsible for creating & applying appearance to the tab bar.
11
+ *
12
+ * It does take into account all properties from host component view & tab screen controllers related to tab bar
13
+ * appearance and applies them accordingly in correct order.
14
+ */
15
+ @interface RNSTabBarAppearanceCoordinator : NSObject
16
+
17
+ /**
18
+ * Constructs the tab bar appearance from the ground up, basing on information contained in provided params (mostly
19
+ * react props), and then applies it to the tab bar and respective tab bar items.
20
+ *
21
+ * Current implementation configures all tab bar styles & state (stacked, inline, normal, focused, selected, disabled,
22
+ * etc.) with the same appearance.
23
+ *
24
+ * TODO: Do not take references to component view & controllers here. Put the tab bar appearance properites in single
25
+ * type & only take it here.
26
+ */
27
+ - (void)updateAppearanceOfTabBar:(nullable UITabBar *)tabBar
28
+ withHostComponentView:(nullable RNSBottomTabsHostComponentView *)hostComponentView
29
+ tabScreenControllers:(nullable NSArray<RNSTabsScreenViewController *> *)tabScreenCtrls
30
+ imageLoader:(nullable RCTImageLoader *)imageLoader;
31
+
32
+ @end
33
+
34
+ NS_ASSUME_NONNULL_END
@@ -0,0 +1,243 @@
1
+ #import "RNSTabBarAppearanceCoordinator.h"
2
+ #import <React/RCTFont.h>
3
+ #import <React/RCTImageLoader.h>
4
+ #import "RNSConversions.h"
5
+ #import "RNSTabBarAppearanceProvider.h"
6
+ #import "RNSTabsScreenViewController.h"
7
+
8
+ @implementation RNSTabBarAppearanceCoordinator
9
+
10
+ - (void)updateAppearanceOfTabBar:(nullable UITabBar *)tabBar
11
+ withHostComponentView:(nullable RNSBottomTabsHostComponentView *)hostComponentView
12
+ tabScreenControllers:(nullable NSArray<RNSTabsScreenViewController *> *)tabScreenCtrls
13
+ imageLoader:(nullable RCTImageLoader *)imageLoader
14
+ {
15
+ if (tabBar == nil) {
16
+ return;
17
+ }
18
+
19
+ // Step 1 - start with default appearance
20
+ UITabBarAppearance *appearance = [[UITabBarAppearance alloc] init];
21
+
22
+ // Step 2 - general settings
23
+ if (hostComponentView != nil) {
24
+ [self configureTabBarAppearance:appearance fromAppearanceProvider:hostComponentView];
25
+
26
+ [self configureTabBarItemAppearance:appearance.stackedLayoutAppearance withTabsHost:hostComponentView];
27
+ [self configureTabBarItemAppearance:appearance.compactInlineLayoutAppearance withTabsHost:hostComponentView];
28
+ [self configureTabBarItemAppearance:appearance.inlineLayoutAppearance withTabsHost:hostComponentView];
29
+ }
30
+
31
+ // Step 3 - apply general settings to the tab bar
32
+ tabBar.standardAppearance = appearance;
33
+ tabBar.scrollEdgeAppearance = appearance;
34
+
35
+ tabBar.tintColor = hostComponentView.tabBarTintColor;
36
+
37
+ // Step 4 - build the appearance object for each tab & apply it
38
+ if (tabScreenCtrls == nil) {
39
+ return;
40
+ }
41
+
42
+ for (RNSTabsScreenViewController *tabScreenCtrl in tabScreenCtrls) {
43
+ if (tabScreenCtrl == nil) {
44
+ // It should not be null here, something went wrong.
45
+ RCTLogWarn(@"[RNScreens] Nullish controller of TabScreen while tab bar appearance update!");
46
+ continue;
47
+ }
48
+
49
+ // Inherit general properties from host
50
+ UITabBarAppearance *tabAppearance = [[UITabBarAppearance alloc] initWithBarAppearance:appearance];
51
+
52
+ [self configureTabBarAppearance:tabAppearance fromAppearanceProvider:tabScreenCtrl.tabScreenComponentView];
53
+
54
+ [self configureTabBarItemAppearance:tabAppearance.compactInlineLayoutAppearance
55
+ forTabScreenController:tabScreenCtrl
56
+ withHostComponentView:hostComponentView];
57
+ [self configureTabBarItemAppearance:tabAppearance.inlineLayoutAppearance
58
+ forTabScreenController:tabScreenCtrl
59
+ withHostComponentView:hostComponentView];
60
+ [self configureTabBarItemAppearance:tabAppearance.stackedLayoutAppearance
61
+ forTabScreenController:tabScreenCtrl
62
+ withHostComponentView:hostComponentView];
63
+
64
+ [self configureTabBarItemForTabScreenController:tabScreenCtrl withAppearace:tabAppearance imageLoader:imageLoader];
65
+ }
66
+ }
67
+
68
+ - (void)configureTabBarAppearance:(nonnull UITabBarAppearance *)appearance
69
+ fromAppearanceProvider:(id<RNSTabBarAppearanceProvider>)appearanceProvider
70
+ {
71
+ if (appearanceProvider.tabBarBackgroundColor != nil) {
72
+ appearance.backgroundColor = appearanceProvider.tabBarBackgroundColor;
73
+ }
74
+
75
+ if (appearanceProvider.tabBarBlurEffect != nil) {
76
+ appearance.backgroundEffect = appearanceProvider.tabBarBlurEffect;
77
+ }
78
+ }
79
+
80
+ - (void)configureTabBarItemForTabScreenController:(nonnull RNSTabsScreenViewController *)tabScreenCtrl
81
+ withAppearace:(nonnull UITabBarAppearance *)tabAppearance
82
+ imageLoader:(nullable RCTImageLoader *)imageLoader
83
+ {
84
+ UITabBarItem *tabBarItem = tabScreenCtrl.tabBarItem;
85
+
86
+ tabBarItem.standardAppearance = tabAppearance;
87
+ tabBarItem.scrollEdgeAppearance = tabAppearance;
88
+
89
+ [self setIconsForTabBarItem:tabBarItem
90
+ fromScreenView:tabScreenCtrl.tabScreenComponentView
91
+ withImageLoader:imageLoader];
92
+ }
93
+
94
+ - (void)setIconsForTabBarItem:(UITabBarItem *)tabBarItem
95
+ fromScreenView:(RNSBottomTabsScreenComponentView *)screenView
96
+ withImageLoader:(RCTImageLoader *_Nullable)imageLoader
97
+ {
98
+ if (screenView.iconType == RNSBottomTabsIconTypeSfSymbol) {
99
+ tabBarItem.image = [UIImage systemImageNamed:screenView.iconSfSymbolName];
100
+ tabBarItem.selectedImage = [UIImage systemImageNamed:screenView.selectedIconSfSymbolName];
101
+ } else if (imageLoader != nil) {
102
+ bool isTemplate = screenView.iconType == RNSBottomTabsIconTypeTemplate;
103
+
104
+ // Normal icon
105
+ if (screenView.iconImageSource != nil) {
106
+ [self loadImageFrom:screenView.iconImageSource
107
+ withImageLoader:imageLoader
108
+ asTemplate:isTemplate
109
+ completionBlock:^(UIImage *image) {
110
+ tabBarItem.image = image;
111
+ }];
112
+ } else {
113
+ tabBarItem.image = nil;
114
+ }
115
+
116
+ // Selected icon
117
+ if (screenView.selectedIconImageSource != nil) {
118
+ [self loadImageFrom:screenView.selectedIconImageSource
119
+ withImageLoader:imageLoader
120
+ asTemplate:isTemplate
121
+ completionBlock:^(UIImage *image) {
122
+ tabBarItem.selectedImage = image;
123
+ }];
124
+ } else {
125
+ tabBarItem.selectedImage = nil;
126
+ }
127
+ } else {
128
+ RCTLogWarn(@"[RNScreens] unable to load tab bar item icons: imageLoader should not be nil");
129
+ }
130
+ }
131
+
132
+ - (void)loadImageFrom:(nonnull RCTImageSource *)imageSource
133
+ withImageLoader:(nonnull RCTImageLoader *)imageLoader
134
+ asTemplate:(bool)isTemplate
135
+ completionBlock:(void (^)(UIImage *image))imageLoadingCompletionBlock
136
+ {
137
+ RCTAssert(imageSource != nil, @"[RNScreens] imageSource must not be nil");
138
+ RCTAssert(imageLoader != nil, @"[RNScreens] imageLoader must not be nil");
139
+
140
+ [imageLoader loadImageWithURLRequest:imageSource.request
141
+ size:imageSource.size
142
+ scale:imageSource.scale
143
+ clipped:true
144
+ resizeMode:RCTResizeModeContain
145
+ progressBlock:^(int64_t progress, int64_t total) {
146
+ }
147
+ partialLoadBlock:^(UIImage *_Nonnull image) {
148
+ }
149
+ completionBlock:^(NSError *_Nullable error, UIImage *_Nullable image) {
150
+ dispatch_async(dispatch_get_main_queue(), ^{
151
+ if (isTemplate) {
152
+ imageLoadingCompletionBlock([image imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate]);
153
+ } else {
154
+ imageLoadingCompletionBlock([image imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]);
155
+ }
156
+ });
157
+ }];
158
+ }
159
+
160
+ - (void)configureTabBarItemAppearance:(nonnull UITabBarItemAppearance *)tabBarItemAppearance
161
+ withTabsHost:(nonnull RNSBottomTabsHostComponentView *)hostComponent
162
+ {
163
+ NSMutableDictionary *titleTextAttributes = nil;
164
+
165
+ if (hostComponent.tabBarItemTitleFontSize != nil) {
166
+ titleTextAttributes = [[NSMutableDictionary alloc] init];
167
+ titleTextAttributes[NSFontAttributeName] = [RCTFont updateFont:nil
168
+ withFamily:hostComponent.tabBarItemTitleFontFamily
169
+ size:hostComponent.tabBarItemTitleFontSize
170
+ weight:hostComponent.tabBarItemTitleFontWeight
171
+ style:hostComponent.tabBarItemTitleFontStyle
172
+ variant:nil
173
+ scaleMultiplier:1.0];
174
+ titleTextAttributes[NSForegroundColorAttributeName] = hostComponent.tabBarItemTitleFontColor;
175
+ }
176
+
177
+ [self configureTabBarItemStateAppearance:tabBarItemAppearance.normal
178
+ withAppearanceProvider:hostComponent
179
+ withTitleTextAttributes:titleTextAttributes];
180
+ [self configureTabBarItemStateAppearance:tabBarItemAppearance.selected
181
+ withAppearanceProvider:hostComponent
182
+ withTitleTextAttributes:titleTextAttributes];
183
+ [self configureTabBarItemStateAppearance:tabBarItemAppearance.focused
184
+ withAppearanceProvider:hostComponent
185
+ withTitleTextAttributes:titleTextAttributes];
186
+ [self configureTabBarItemStateAppearance:tabBarItemAppearance.disabled
187
+ withAppearanceProvider:hostComponent
188
+ withTitleTextAttributes:titleTextAttributes];
189
+ }
190
+
191
+ - (void)configureTabBarItemAppearance:(nonnull UITabBarItemAppearance *)tabBarItemAppearance
192
+ forTabScreenController:(nonnull RNSTabsScreenViewController *)tabScreenCtrl
193
+ withHostComponentView:(nonnull RNSBottomTabsHostComponentView *)tabsHostComponent
194
+ {
195
+ NSMutableDictionary *titleTextAttributes = nil;
196
+
197
+ if (tabScreenCtrl.tabScreenComponentView.tabBarItemTitleFontSize != nil) {
198
+ titleTextAttributes = [[NSMutableDictionary alloc] init];
199
+ titleTextAttributes[NSFontAttributeName] =
200
+ [RCTFont updateFont:nil
201
+ withFamily:tabScreenCtrl.tabScreenComponentView.tabBarItemTitleFontFamily
202
+ size:tabScreenCtrl.tabScreenComponentView.tabBarItemTitleFontSize
203
+ weight:tabScreenCtrl.tabScreenComponentView.tabBarItemTitleFontWeight
204
+ style:tabScreenCtrl.tabScreenComponentView.tabBarItemTitleFontStyle
205
+ variant:nil
206
+ scaleMultiplier:1.0];
207
+ titleTextAttributes[NSForegroundColorAttributeName] = tabScreenCtrl.tabScreenComponentView.tabBarItemTitleFontColor;
208
+ }
209
+
210
+ [self configureTabBarItemStateAppearance:tabBarItemAppearance.normal
211
+ withAppearanceProvider:tabScreenCtrl.tabScreenComponentView
212
+ withTitleTextAttributes:titleTextAttributes];
213
+ [self configureTabBarItemStateAppearance:tabBarItemAppearance.selected
214
+ withAppearanceProvider:tabScreenCtrl.tabScreenComponentView
215
+ withTitleTextAttributes:titleTextAttributes];
216
+ [self configureTabBarItemStateAppearance:tabBarItemAppearance.focused
217
+ withAppearanceProvider:tabScreenCtrl.tabScreenComponentView
218
+ withTitleTextAttributes:titleTextAttributes];
219
+ [self configureTabBarItemStateAppearance:tabBarItemAppearance.disabled
220
+ withAppearanceProvider:tabScreenCtrl.tabScreenComponentView
221
+ withTitleTextAttributes:titleTextAttributes];
222
+ }
223
+
224
+ - (void)configureTabBarItemStateAppearance:(nonnull UITabBarItemStateAppearance *)tabBarItemStateAppearance
225
+ withAppearanceProvider:(id<RNSTabBarAppearanceProvider>)appearanceProvider
226
+ withTitleTextAttributes:(nullable NSDictionary<NSAttributedStringKey, id> *)titleTextAttributes
227
+ {
228
+ if (appearanceProvider.tabBarItemBadgeBackgroundColor != nil) {
229
+ tabBarItemStateAppearance.badgeBackgroundColor = appearanceProvider.tabBarItemBadgeBackgroundColor;
230
+ }
231
+
232
+ if (titleTextAttributes != nil) {
233
+ tabBarItemStateAppearance.titleTextAttributes = titleTextAttributes;
234
+ }
235
+
236
+ if (appearanceProvider.tabBarItemIconColor != nil) {
237
+ tabBarItemStateAppearance.iconColor = appearanceProvider.tabBarItemIconColor;
238
+ }
239
+
240
+ tabBarItemStateAppearance.titlePositionAdjustment = appearanceProvider.tabBarItemTitlePositionAdjustment;
241
+ }
242
+
243
+ @end
@@ -0,0 +1,23 @@
1
+ #import <UIKit/UIKit.h>
2
+
3
+ NS_ASSUME_NONNULL_BEGIN
4
+
5
+ @protocol RNSTabBarAppearanceProvider
6
+
7
+ - (UIColor *)tabBarBackgroundColor;
8
+ - (UIBlurEffect *)tabBarBlurEffect;
9
+
10
+ - (NSString *)tabBarItemTitleFontFamily;
11
+ - (NSNumber *)tabBarItemTitleFontSize;
12
+ - (NSString *)tabBarItemTitleFontWeight;
13
+ - (NSString *)tabBarItemTitleFontStyle;
14
+ - (UIColor *)tabBarItemTitleFontColor;
15
+ - (UIOffset)tabBarItemTitlePositionAdjustment;
16
+
17
+ - (UIColor *)tabBarItemIconColor;
18
+
19
+ - (UIColor *)tabBarItemBadgeBackgroundColor;
20
+
21
+ @end
22
+
23
+ NS_ASSUME_NONNULL_END
@@ -0,0 +1,132 @@
1
+ #import <UIKit/UIKit.h>
2
+ #import "RNSTabBarAppearanceCoordinator.h"
3
+ #import "RNSTabsScreenViewController.h"
4
+
5
+ NS_ASSUME_NONNULL_BEGIN
6
+
7
+ @protocol RNSReactTransactionObserving
8
+
9
+ - (void)reactMountingTransactionWillMount;
10
+
11
+ - (void)reactMountingTransactionDidMount;
12
+
13
+ @end
14
+
15
+ /**
16
+ * This controller is responsible for tab management & all other responsibilities coming from the fact of inheritance
17
+ * from `UITabBarController`. It is limited only to the child view controllers of type `RNSTabsScreenViewController`,
18
+ * however.
19
+ *
20
+ * Updates made by this controller are synchronized by `RNSReactTransactionObserving` protocol,
21
+ * i.e. if you made changes through one of signals method, unless you flush them immediately (not needed atm), they will
22
+ * be executed only after react finishes the transaction (from within transaction execution block).
23
+ */
24
+ @interface RNSTabBarController : UITabBarController <RNSReactTransactionObserving>
25
+
26
+ - (instancetype)initWithTabsHostComponentView:(nullable RNSBottomTabsHostComponentView *)tabsHostComponentView;
27
+
28
+ /**
29
+ * Get reference to the host component view that owns this tab bar controller.
30
+ *
31
+ * Might return null in cases where the controller view hierararchy is not attached to parent.
32
+ */
33
+ @property (nonatomic, readonly, nullable) RNSBottomTabsHostComponentView *tabsHostComponentView;
34
+
35
+ /**
36
+ * Tab bar appearance coordinator. If you need to update tab bar appearance avoid using this one directly. Send the
37
+ * controller a signal, invalidate the tab bar appearance & either wait for the update flush or flush it manually.
38
+ */
39
+ @property (nonatomic, readonly, strong, nonnull) RNSTabBarAppearanceCoordinator *tabBarAppearanceCoordinator;
40
+
41
+ /**
42
+ * Update tab controller state with previously provided children.
43
+ *
44
+ * This method does nothing if the children have not been changed / update has not been requested before.
45
+ * The requested update is performed immediately. If you do not need this, consider just raising an appropriate
46
+ * invalidation signal & let the controller decide when to flush the updates.
47
+ */
48
+ - (void)updateReactChildrenControllersIfNeeded;
49
+
50
+ /**
51
+ * Force update of the tab controller state with previously provided children.
52
+ *
53
+ * The requested update is performed immediately. If you do not need this, consider just raising an appropriate
54
+ * invalidation signal & let the controller decide when to flush the updates.
55
+ */
56
+ - (void)updateReactChildrenControllers;
57
+
58
+ /**
59
+ * Find out which tab bar controller is currently focused & select it.
60
+ *
61
+ * This method does nothing if the update has not been previoulsy requested.
62
+ * If needed, the requested update is performed immediately. If you do not need this, consider just raising an
63
+ * appropriate invalidation signal & let the controller decide when to flush the updates.
64
+ */
65
+ - (void)updateSelectedViewControllerIfNeeded;
66
+
67
+ /**
68
+ * Find out which tab bar controller is currently focused & select it.
69
+ *
70
+ * The requested update is performed immediately. If you do not need this, consider just raising an appropriate
71
+ * invalidation signal & let the controller decide when to flush the updates.
72
+ */
73
+ - (void)updateSelectedViewController;
74
+
75
+ /**
76
+ * Updates the tab bar appearance basing on configuration sources (host view, tab screens).
77
+ *
78
+ * This method does nothing if the update has not been previoulsy requested.
79
+ * If needed, the requested update is performed immediately. If you do not need this, consider just raising an
80
+ * appropriate invalidation signal & let the controller decide when to flush the updates.
81
+ */
82
+ - (void)updateTabBarAppearanceIfNeeded;
83
+
84
+ /**
85
+ * Updates the tab bar appearance basing on configuration sources (host view, tab screens).
86
+ *
87
+ * The requested update is performed immediately. If you do not need this, consider just raising an appropriate
88
+ * invalidation signal & let the controller decide when to flush the updates.
89
+ */
90
+ - (void)updateTabBarAppearance;
91
+
92
+ @end
93
+
94
+ #pragma mark - Signals
95
+
96
+ /**
97
+ * This extension defines various invalidation signals that you can send to the controller, to notify it that it needs
98
+ * to take some action.
99
+ */
100
+ @interface RNSTabBarController ()
101
+
102
+ /**
103
+ * Tell the controller that react provided tabs have changed (count / instances) & the child view controllers need to be
104
+ * udpated.
105
+ *
106
+ * This also automatically raises `needsReactChildrenUpdate` flag, no need to call it manually.
107
+ */
108
+ - (void)childViewControllersHaveChangedTo:(nonnull NSArray<RNSTabsScreenViewController *> *)childViewControllers;
109
+
110
+ /**
111
+ * Tell the controller that react provided tabs have changed (count / instances) & the child view controllers need to be
112
+ * udpated.
113
+ *
114
+ * Do not raise this signal only when focused state of the tab has changed - use `needsSelectedTabUpdate` instead.
115
+ */
116
+ @property (nonatomic, readwrite) bool needsUpdateOfReactChildrenControllers;
117
+
118
+ /**
119
+ * Tell the controller that react provided tabs have changed (count / instances) & the child view controllers need to be
120
+ * udpated.
121
+ */
122
+ @property (nonatomic, readwrite) bool needsUpdateOfSelectedTab;
123
+
124
+ /**
125
+ * Tell the controller that some configuration regarding the tab bar apperance has changed & the appearance requires
126
+ * update.
127
+ */
128
+ @property (nonatomic, readwrite) bool needsUpdateOfTabBarAppearance;
129
+
130
+ @end
131
+
132
+ NS_ASSUME_NONNULL_END