react-native-navigation 8.8.6 → 8.8.7

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 (126) hide show
  1. package/android/src/main/java/com/reactnativenavigation/NavigationApplication.java +3 -0
  2. package/android/src/main/java/com/reactnativenavigation/NavigationPackage.kt +27 -8
  3. package/android/src/main/java/com/reactnativenavigation/customrow/BottomTabsCustomRow.kt +262 -0
  4. package/android/src/main/java/com/reactnativenavigation/customrow/BottomTabsCustomRowAttacher.kt +205 -0
  5. package/android/src/main/java/com/reactnativenavigation/customrow/BottomTabsCustomRowConfigStore.kt +32 -0
  6. package/android/src/main/java/com/reactnativenavigation/customrow/BottomTabsCustomRowLayout.kt +139 -0
  7. package/android/src/main/java/com/reactnativenavigation/customrow/BottomTabsCustomRowModule.kt +37 -0
  8. package/android/src/main/java/com/reactnativenavigation/customrow/BottomTabsCustomRowOptions.kt +68 -0
  9. package/android/src/main/java/com/reactnativenavigation/options/BottomTabOptions.java +4 -1
  10. package/android/src/main/java/com/reactnativenavigation/react/ReactView.java +13 -0
  11. package/android/src/main/java/com/reactnativenavigation/react/events/ComponentType.java +2 -1
  12. package/android/src/main/java/com/reactnativenavigation/viewcontrollers/bottomtabs/BottomTabPresenter.java +28 -0
  13. package/android/src/main/java/com/reactnativenavigation/viewcontrollers/bottomtabs/BottomTabsController.java +59 -0
  14. package/android/src/main/java/com/reactnativenavigation/views/bottomtabs/BottomTabs.java +76 -0
  15. package/android/src/main/java/com/reactnativenavigation/views/bottomtabs/CustomBottomTabItemView.kt +73 -0
  16. package/android/src/main/java/com/reactnativenavigation/views/stack/topbar/titlebar/TitleBarReactButtonView.java +27 -11
  17. package/android/src/test/java/com/reactnativenavigation/views/TitleAndButtonsContainerTest.kt +15 -1
  18. package/android/src/test/java/com/reactnativenavigation/views/TitleBarReactButtonViewTest.java +135 -0
  19. package/ios/ARCHITECTURE.md +5 -0
  20. package/ios/BottomTabPresenter.h +7 -0
  21. package/ios/BottomTabPresenter.mm +27 -0
  22. package/ios/RNNAppDelegate.h +16 -0
  23. package/ios/RNNAppDelegate.mm +73 -0
  24. package/ios/RNNBottomTabOptions.h +2 -0
  25. package/ios/RNNBottomTabOptions.mm +5 -1
  26. package/ios/RNNBottomTabsController.h +2 -0
  27. package/ios/RNNBottomTabsController.mm +209 -1
  28. package/ios/RNNBottomTabsCustomRow.h +57 -0
  29. package/ios/RNNBottomTabsCustomRow.mm +252 -0
  30. package/ios/RNNBottomTabsCustomRowOptions.h +42 -0
  31. package/ios/RNNBottomTabsCustomRowOptions.mm +37 -0
  32. package/ios/RNNBottomTabsOptions.h +2 -0
  33. package/ios/RNNBottomTabsOptions.mm +2 -0
  34. package/ios/RNNComponentViewCreator.h +2 -1
  35. package/ios/RNNCustomTabBarItemView.h +26 -0
  36. package/ios/RNNCustomTabBarItemView.mm +83 -0
  37. package/ios/RNNReactRootViewCreator.mm +1 -0
  38. package/ios/RNNViewControllerFactory.mm +1 -0
  39. package/ios/ReactNativeNavigation.xcodeproj/project.pbxproj +24 -0
  40. package/lib/module/ARCHITECTURE.md +30 -0
  41. package/lib/module/Navigation.js +34 -1
  42. package/lib/module/Navigation.js.map +1 -1
  43. package/lib/module/NavigationDelegate.js +21 -0
  44. package/lib/module/NavigationDelegate.js.map +1 -1
  45. package/lib/module/adapters/AndroidCustomRowForwarder.js +75 -0
  46. package/lib/module/adapters/AndroidCustomRowForwarder.js.map +1 -0
  47. package/lib/module/commands/Commands.js +8 -0
  48. package/lib/module/commands/Commands.js.map +1 -1
  49. package/lib/module/index.js +1 -0
  50. package/lib/module/index.js.map +1 -1
  51. package/lib/module/interfaces/Options.js.map +1 -1
  52. package/lib/module/linking/DeferredLinkQueue.js +52 -0
  53. package/lib/module/linking/DeferredLinkQueue.js.map +1 -0
  54. package/lib/module/linking/DeferredLinkQueue.test.js +54 -0
  55. package/lib/module/linking/DeferredLinkQueue.test.js.map +1 -0
  56. package/lib/module/linking/LinkingHandler.js +139 -0
  57. package/lib/module/linking/LinkingHandler.js.map +1 -0
  58. package/lib/module/linking/LinkingHandler.test.js +384 -0
  59. package/lib/module/linking/LinkingHandler.test.js.map +1 -0
  60. package/lib/module/linking/ModalLayoutBuilder.js +56 -0
  61. package/lib/module/linking/ModalLayoutBuilder.js.map +1 -0
  62. package/lib/module/linking/ModalLayoutBuilder.test.js +154 -0
  63. package/lib/module/linking/ModalLayoutBuilder.test.js.map +1 -0
  64. package/lib/module/linking/RouteMatcher.js +104 -0
  65. package/lib/module/linking/RouteMatcher.js.map +1 -0
  66. package/lib/module/linking/RouteMatcher.test.js +164 -0
  67. package/lib/module/linking/RouteMatcher.test.js.map +1 -0
  68. package/lib/module/linking/URLParser.js +56 -0
  69. package/lib/module/linking/URLParser.js.map +1 -0
  70. package/lib/module/linking/URLParser.test.js +100 -0
  71. package/lib/module/linking/URLParser.test.js.map +1 -0
  72. package/lib/module/linking/types.js +4 -0
  73. package/lib/module/linking/types.js.map +1 -0
  74. package/lib/typescript/Navigation.d.ts +22 -0
  75. package/lib/typescript/Navigation.d.ts.map +1 -1
  76. package/lib/typescript/NavigationDelegate.d.ts +13 -0
  77. package/lib/typescript/NavigationDelegate.d.ts.map +1 -1
  78. package/lib/typescript/adapters/AndroidCustomRowForwarder.d.ts +23 -0
  79. package/lib/typescript/adapters/AndroidCustomRowForwarder.d.ts.map +1 -0
  80. package/lib/typescript/commands/Commands.d.ts +1 -0
  81. package/lib/typescript/commands/Commands.d.ts.map +1 -1
  82. package/lib/typescript/index.d.ts +1 -0
  83. package/lib/typescript/index.d.ts.map +1 -1
  84. package/lib/typescript/interfaces/Options.d.ts +85 -0
  85. package/lib/typescript/interfaces/Options.d.ts.map +1 -1
  86. package/lib/typescript/linking/DeferredLinkQueue.d.ts +26 -0
  87. package/lib/typescript/linking/DeferredLinkQueue.d.ts.map +1 -0
  88. package/lib/typescript/linking/DeferredLinkQueue.test.d.ts +2 -0
  89. package/lib/typescript/linking/DeferredLinkQueue.test.d.ts.map +1 -0
  90. package/lib/typescript/linking/LinkingHandler.d.ts +71 -0
  91. package/lib/typescript/linking/LinkingHandler.d.ts.map +1 -0
  92. package/lib/typescript/linking/LinkingHandler.test.d.ts +2 -0
  93. package/lib/typescript/linking/LinkingHandler.test.d.ts.map +1 -0
  94. package/lib/typescript/linking/ModalLayoutBuilder.d.ts +21 -0
  95. package/lib/typescript/linking/ModalLayoutBuilder.d.ts.map +1 -0
  96. package/lib/typescript/linking/ModalLayoutBuilder.test.d.ts +2 -0
  97. package/lib/typescript/linking/ModalLayoutBuilder.test.d.ts.map +1 -0
  98. package/lib/typescript/linking/RouteMatcher.d.ts +23 -0
  99. package/lib/typescript/linking/RouteMatcher.d.ts.map +1 -0
  100. package/lib/typescript/linking/RouteMatcher.test.d.ts +2 -0
  101. package/lib/typescript/linking/RouteMatcher.test.d.ts.map +1 -0
  102. package/lib/typescript/linking/URLParser.d.ts +16 -0
  103. package/lib/typescript/linking/URLParser.d.ts.map +1 -0
  104. package/lib/typescript/linking/URLParser.test.d.ts +2 -0
  105. package/lib/typescript/linking/URLParser.test.d.ts.map +1 -0
  106. package/lib/typescript/linking/types.d.ts +107 -0
  107. package/lib/typescript/linking/types.d.ts.map +1 -0
  108. package/package.json +1 -1
  109. package/src/ARCHITECTURE.md +30 -0
  110. package/src/Navigation.ts +36 -1
  111. package/src/NavigationDelegate.ts +22 -0
  112. package/src/adapters/AndroidCustomRowForwarder.ts +83 -0
  113. package/src/commands/Commands.ts +15 -0
  114. package/src/index.ts +1 -0
  115. package/src/interfaces/Options.ts +87 -0
  116. package/src/linking/DeferredLinkQueue.test.ts +60 -0
  117. package/src/linking/DeferredLinkQueue.ts +55 -0
  118. package/src/linking/LinkingHandler.test.ts +332 -0
  119. package/src/linking/LinkingHandler.ts +169 -0
  120. package/src/linking/ModalLayoutBuilder.test.ts +105 -0
  121. package/src/linking/ModalLayoutBuilder.ts +60 -0
  122. package/src/linking/RouteMatcher.test.ts +128 -0
  123. package/src/linking/RouteMatcher.ts +126 -0
  124. package/src/linking/URLParser.test.ts +105 -0
  125. package/src/linking/URLParser.ts +62 -0
  126. package/src/linking/types.ts +115 -0
@@ -5,11 +5,11 @@ import android.content.Context;
5
5
  import android.util.TypedValue;
6
6
  import android.view.View;
7
7
 
8
- import com.facebook.react.ReactInstanceManager;
9
8
  import com.reactnativenavigation.options.ComponentOptions;
10
9
  import com.reactnativenavigation.options.params.Number;
11
10
  import com.reactnativenavigation.react.ReactView;
12
11
 
12
+ import static android.view.View.MeasureSpec.AT_MOST;
13
13
  import static android.view.View.MeasureSpec.EXACTLY;
14
14
  import static android.view.View.MeasureSpec.makeMeasureSpec;
15
15
  import static com.reactnativenavigation.utils.UiUtils.dpToPx;
@@ -25,28 +25,44 @@ public class TitleBarReactButtonView extends ReactView {
25
25
 
26
26
  @Override
27
27
  protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
28
-
29
- //This is a workaround, ReactNative throws exception when views have ids, On android MenuItems
28
+ // This is a workaround, ReactNative throws exception when views have ids, On android MenuItems
30
29
  // With ActionViews like this got an id, see #7253
31
30
  if (!this.isAttachedToWindow()) {
32
31
  this.setId(View.NO_ID);
33
32
  }
34
33
 
35
- super.onMeasure(createSpec(widthMeasureSpec, component.width), createSpec(heightMeasureSpec, component.height));
34
+ super.onMeasure(
35
+ createWidthSpec(widthMeasureSpec, component.width),
36
+ createHeightSpec(heightMeasureSpec, component.height)
37
+ );
36
38
  }
37
39
 
38
- private int createSpec(int measureSpec, Number dimension) {
40
+ private int createWidthSpec(int measureSpec, Number dimension) {
41
+ return createSpec(measureSpec, dimension, Math.max(getResources().getDisplayMetrics().widthPixels, 1));
42
+ }
43
+
44
+ private int createHeightSpec(int measureSpec, Number dimension) {
45
+ if (dimension.hasValue()) {
46
+ return createExactSpec(dimension);
47
+ }
48
+ return makeMeasureSpec(Math.max(resolveActionBarSize(), 1), EXACTLY);
49
+ }
50
+
51
+ private int createSpec(int measureSpec, Number dimension, int fallbackSize) {
39
52
  if (dimension.hasValue()) {
40
- return makeMeasureSpec(MeasureSpec.getSize(dpToPx(getContext(), dimension.get())), EXACTLY);
53
+ return createExactSpec(dimension);
41
54
  } else {
42
- // When JS doesn't pass width/height, default to the theme's actionBarSize (48dp on Material).
43
- // Yoga's intrinsic measurement of the React view collapses `paddingHorizontal` on the
44
- // trailing edge in RTL (RN/Fabric measurement quirk), so we cannot trust UNSPECIFIED here -
45
- // it produces a 0dp visible inset against the screen edge in RTL.
46
- return makeMeasureSpec(resolveActionBarSize(), EXACTLY);
55
+ // Use bounded wrap-content width to avoid RN/Yoga RTL padding issues caused by
56
+ // UNSPECIFIED, without forcing every custom button to actionBarSize width.
57
+ int availableSize = MeasureSpec.getSize(measureSpec);
58
+ return makeMeasureSpec(availableSize > 0 ? availableSize : fallbackSize, AT_MOST);
47
59
  }
48
60
  }
49
61
 
62
+ private int createExactSpec(Number dimension) {
63
+ return makeMeasureSpec(MeasureSpec.getSize(dpToPx(getContext(), dimension.get())), EXACTLY);
64
+ }
65
+
50
66
  private int resolveActionBarSize() {
51
67
  TypedValue tv = new TypedValue();
52
68
  if (getContext().getTheme().resolveAttribute(android.R.attr.actionBarSize, tv, true)) {
@@ -294,6 +294,20 @@ class TitleAndButtonsContainerTest : BaseTest() {
294
294
  assertThat(uut.getTitleComponent().right).isEqualTo(UUT_WIDTH - rightBarWidth - DEFAULT_LEFT_MARGIN_PX)
295
295
  }
296
296
 
297
+ @Test
298
+ fun `Component - title width shrinks by measured right buttons only`() {
299
+ val rightButtonsWidth = 48
300
+ setup(
301
+ rightBarWidth = rightButtonsWidth,
302
+ componentWidth = UUT_WIDTH,
303
+ alignment = Alignment.Default
304
+ )
305
+
306
+ idleMainLooper()
307
+ assertThat(uut.getTitleComponent().left).isEqualTo(DEFAULT_LEFT_MARGIN_PX)
308
+ assertThat(uut.getTitleComponent().right).isEqualTo(UUT_WIDTH - rightButtonsWidth - DEFAULT_LEFT_MARGIN_PX)
309
+ }
310
+
297
311
  @Test
298
312
  fun `Component - should place title between the toolbars`() {
299
313
  val leftBarWidth = 50
@@ -475,4 +489,4 @@ class TitleAndButtonsContainerTest : BaseTest() {
475
489
  }
476
490
 
477
491
  private fun getTitleSubtitleView() = (uut.getTitleComponent() as TitleSubTitleLayout)
478
- }
492
+ }
@@ -0,0 +1,135 @@
1
+ package com.reactnativenavigation.views;
2
+
3
+ import static android.view.View.MeasureSpec.AT_MOST;
4
+ import static android.view.View.MeasureSpec.EXACTLY;
5
+ import static android.view.View.MeasureSpec.getMode;
6
+ import static android.view.View.MeasureSpec.getSize;
7
+ import static android.view.View.MeasureSpec.makeMeasureSpec;
8
+ import static org.assertj.core.api.Java6Assertions.assertThat;
9
+
10
+ import android.app.Activity;
11
+ import android.util.TypedValue;
12
+ import android.view.View;
13
+ import android.view.ViewGroup;
14
+
15
+ import com.reactnativenavigation.BaseTest;
16
+ import com.reactnativenavigation.options.ComponentOptions;
17
+ import com.reactnativenavigation.options.params.Number;
18
+ import com.reactnativenavigation.options.params.Text;
19
+ import com.reactnativenavigation.utils.UiUtils;
20
+ import com.reactnativenavigation.views.stack.topbar.titlebar.TitleBarReactButtonView;
21
+
22
+ import org.junit.Test;
23
+
24
+ public class TitleBarReactButtonViewTest extends BaseTest {
25
+ private static final int PARENT_WIDTH = 200;
26
+ private static final int PARENT_HEIGHT = 100;
27
+ private static final int CHILD_WIDTH = 24;
28
+ private static final int CHILD_HEIGHT = 16;
29
+
30
+ @Test
31
+ public void missingDimensionsMeasureToContentWithinParentBounds() {
32
+ Activity activity = newActivity();
33
+ TitleBarReactButtonView uut = createView(activity, new ComponentOptions());
34
+ uut.addView(new FixedSizeView(activity), new ViewGroup.LayoutParams(CHILD_WIDTH, CHILD_HEIGHT));
35
+
36
+ uut.measure(makeMeasureSpec(PARENT_WIDTH, AT_MOST), makeMeasureSpec(PARENT_HEIGHT, AT_MOST));
37
+
38
+ assertThat(uut.getMeasuredWidth()).isEqualTo(CHILD_WIDTH);
39
+ assertThat(uut.getMeasuredHeight()).isEqualTo(resolveActionBarSize(activity));
40
+ }
41
+
42
+ @Test
43
+ public void explicitDimensionsMeasureExactly() {
44
+ Activity activity = newActivity();
45
+ ComponentOptions component = new ComponentOptions();
46
+ component.width = new Number(72);
47
+ component.height = new Number(32);
48
+ TitleBarReactButtonView uut = createView(activity, component);
49
+ uut.addView(new FixedSizeView(activity), new ViewGroup.LayoutParams(CHILD_WIDTH, CHILD_HEIGHT));
50
+
51
+ uut.measure(makeMeasureSpec(PARENT_WIDTH, AT_MOST), makeMeasureSpec(PARENT_HEIGHT, AT_MOST));
52
+
53
+ assertThat(uut.getMeasuredWidth()).isEqualTo(UiUtils.dpToPx(activity, 72));
54
+ assertThat(uut.getMeasuredHeight()).isEqualTo(UiUtils.dpToPx(activity, 32));
55
+ }
56
+
57
+ @Test
58
+ public void zeroParentWidthFallbacksToBoundedAtMostSpecAndHeightUsesActionBarSize() {
59
+ Activity activity = newActivity();
60
+ TitleBarReactButtonView uut = createView(activity, new ComponentOptions());
61
+ RecordingView child = new RecordingView(activity);
62
+ uut.addView(child, new ViewGroup.LayoutParams(
63
+ ViewGroup.LayoutParams.MATCH_PARENT,
64
+ ViewGroup.LayoutParams.MATCH_PARENT
65
+ ));
66
+
67
+ uut.measure(makeMeasureSpec(0, AT_MOST), makeMeasureSpec(0, AT_MOST));
68
+
69
+ assertThat(getMode(child.lastWidthMeasureSpec)).isEqualTo(AT_MOST);
70
+ assertThat(getSize(child.lastWidthMeasureSpec))
71
+ .isEqualTo(Math.max(activity.getResources().getDisplayMetrics().widthPixels, 1));
72
+ assertThat(getMode(child.lastHeightMeasureSpec)).isEqualTo(EXACTLY);
73
+ assertThat(getSize(child.lastHeightMeasureSpec)).isEqualTo(Math.max(resolveActionBarSize(activity), 1));
74
+ }
75
+
76
+ @Test
77
+ public void rtlMissingDimensionsUseBoundedSpecs() {
78
+ Activity activity = newActivity();
79
+ TitleBarReactButtonView uut = createView(activity, new ComponentOptions());
80
+ RecordingView child = new RecordingView(activity);
81
+ uut.setLayoutDirection(View.LAYOUT_DIRECTION_RTL);
82
+ uut.addView(child, new ViewGroup.LayoutParams(
83
+ ViewGroup.LayoutParams.MATCH_PARENT,
84
+ ViewGroup.LayoutParams.MATCH_PARENT
85
+ ));
86
+
87
+ uut.measure(makeMeasureSpec(PARENT_WIDTH, AT_MOST), makeMeasureSpec(PARENT_HEIGHT, AT_MOST));
88
+
89
+ assertThat(getMode(child.lastWidthMeasureSpec)).isEqualTo(AT_MOST);
90
+ assertThat(getSize(child.lastWidthMeasureSpec)).isEqualTo(PARENT_WIDTH);
91
+ assertThat(getMode(child.lastHeightMeasureSpec)).isEqualTo(EXACTLY);
92
+ assertThat(getSize(child.lastHeightMeasureSpec)).isEqualTo(resolveActionBarSize(activity));
93
+ }
94
+
95
+ private TitleBarReactButtonView createView(Activity activity, ComponentOptions component) {
96
+ component.name = new Text("ButtonComponent");
97
+ component.componentId = new Text("ButtonComponentId");
98
+ return new TitleBarReactButtonView(activity, component);
99
+ }
100
+
101
+ private int resolveActionBarSize(Activity activity) {
102
+ TypedValue tv = new TypedValue();
103
+ if (activity.getTheme().resolveAttribute(android.R.attr.actionBarSize, tv, true)) {
104
+ return TypedValue.complexToDimensionPixelSize(tv.data, activity.getResources().getDisplayMetrics());
105
+ }
106
+ return UiUtils.dpToPx(activity, 48);
107
+ }
108
+
109
+ private static class FixedSizeView extends View {
110
+ FixedSizeView(Activity activity) {
111
+ super(activity);
112
+ }
113
+
114
+ @Override
115
+ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
116
+ setMeasuredDimension(CHILD_WIDTH, CHILD_HEIGHT);
117
+ }
118
+ }
119
+
120
+ private static class RecordingView extends View {
121
+ int lastWidthMeasureSpec;
122
+ int lastHeightMeasureSpec;
123
+
124
+ RecordingView(Activity activity) {
125
+ super(activity);
126
+ }
127
+
128
+ @Override
129
+ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
130
+ lastWidthMeasureSpec = widthMeasureSpec;
131
+ lastHeightMeasureSpec = heightMeasureSpec;
132
+ setMeasuredDimension(getSize(widthMeasureSpec), getSize(heightMeasureSpec));
133
+ }
134
+ }
135
+ }
@@ -28,6 +28,11 @@ Base class that user's AppDelegate must extend. Handles React Native and navigat
28
28
  - Creates `RCTRootViewFactory` and `ReactHost`
29
29
  - Calls `[ReactNativeNavigation bootstrapWithHost:]` to initialize navigation
30
30
  - Handles RN version differences (0.77, 0.78, 0.79+) via compile-time macros
31
+ - **Deep linking plumbing**:
32
+ - Implements `application:openURL:options:` and `application:continueUserActivity:restorationHandler:`; both call `-dispatchDeepLinkURL:`.
33
+ - `-dispatchDeepLinkURL:` posts `RCTOpenURLNotification` directly if the React runtime is ready, otherwise enqueues the URL.
34
+ - Observes `RCTContentDidAppearNotification` (the Fabric/bridgeless signal) to flush the queue. This solves the cold-start race where URLs (push notifications, OS link launches) arrive before `RCTLinkingManager` is listening.
35
+ - Subclasses can call `-dispatchDeepLinkURL:` manually from notification delegates or any other URL source; the queueing behavior is reused automatically.
31
36
 
32
37
  ### ReactNativeNavigation Bootstrap
33
38
  **File**: `ReactNativeNavigation.h/mm`
@@ -4,6 +4,13 @@
4
4
 
5
5
  @property(nonatomic, strong, readonly) RNNTabBarItemCreator *tabCreator;
6
6
 
7
+ /**
8
+ * When YES, tabs whose options declare `bottomTab.component` skip native
9
+ * icon/text/sfSymbol/role application. The accompanying
10
+ * `RNNCustomTabBarItemView` is responsible for visual rendering of the tab.
11
+ */
12
+ @property(nonatomic, assign) BOOL useCustomItemViews;
13
+
7
14
  - (instancetype)initWithDefaultOptions:(RNNNavigationOptions *)defaultOptions
8
15
  tabCreator:(RNNTabBarItemCreator *)tabCreator;
9
16
 
@@ -36,10 +36,37 @@
36
36
 
37
37
  - (void)createTabBarItem:(UIViewController *)child
38
38
  bottomTabOptions:(RNNBottomTabOptions *)bottomTabOptions {
39
+ if (_useCustomItemViews && bottomTabOptions.component.name.hasValue) {
40
+ UITabBarItem *blankItem = [self createBlankTabBarItem:child
41
+ bottomTabOptions:bottomTabOptions];
42
+ if (blankItem != child.tabBarItem) {
43
+ child.tabBarItem = blankItem;
44
+ }
45
+ return;
46
+ }
47
+
39
48
  UITabBarItem *updatedItem = [_tabCreator createTabBarItem:bottomTabOptions mergeItem:child.tabBarItem];
40
49
  if (updatedItem != child.tabBarItem) {
41
50
  child.tabBarItem = updatedItem;
42
51
  }
43
52
  }
44
53
 
54
+ // Builds a truly blank `UITabBarItem` (nil image, nil title). When custom
55
+ // item views are active, `RNNBottomTabsController` hides the native tab bar
56
+ // visuals and renders the custom row on top. The bar item still needs to
57
+ // exist so that `UITabBarController` reserves the right number of slots and
58
+ // the bottom safe-area inset.
59
+ - (UITabBarItem *)createBlankTabBarItem:(UIViewController *)child
60
+ bottomTabOptions:(RNNBottomTabOptions *)bottomTabOptions {
61
+ UITabBarItem *item = child.tabBarItem ?: [UITabBarItem new];
62
+ item.image = nil;
63
+ item.selectedImage = nil;
64
+ item.title = nil;
65
+ item.tag = bottomTabOptions.tag;
66
+ item.accessibilityIdentifier = [bottomTabOptions.testID withDefault:nil];
67
+ item.accessibilityLabel = [bottomTabOptions.accessibilityLabel withDefault:nil];
68
+ item.imageInsets = UIEdgeInsetsZero;
69
+ return item;
70
+ }
71
+
45
72
  @end
@@ -56,4 +56,20 @@
56
56
  @property(nonatomic) BOOL bridgelessEnabled;
57
57
  #endif
58
58
 
59
+ /**
60
+ * Dispatch a deep link URL through React Native's Linking module so JS
61
+ * subscribers (including RNN's built-in deep linking framework) receive it.
62
+ *
63
+ * Safe to call before the JS bridge is ready: URLs that arrive early
64
+ * (e.g. cold-start notification taps) are queued natively and flushed
65
+ * automatically once Fabric/React content first appears.
66
+ *
67
+ * Custom-scheme and universal-link openings dispatched by the OS are
68
+ * forwarded through this method automatically; call it manually only
69
+ * when your app receives a deep link from a source RNN can't intercept
70
+ * (e.g. a custom `UNUserNotificationCenterDelegate`, a third-party push
71
+ * SDK callback, etc.).
72
+ */
73
+ - (void)dispatchDeepLinkURL:(NSURL *)url;
74
+
59
75
  @end
@@ -8,6 +8,8 @@
8
8
  #import <React/RCTCxxBridgeDelegate.h>
9
9
  #endif
10
10
  #import <React/RCTLegacyViewManagerInteropComponentView.h>
11
+ #import <React/RCTLinkingManager.h>
12
+ #import <React/RCTRootView.h>
11
13
  #import <React/RCTSurfacePresenter.h>
12
14
  #if __has_include(<React/RCTSurfacePresenterStub.h>)
13
15
  #import <React/RCTSurfacePresenterStub.h>
@@ -36,6 +38,13 @@
36
38
 
37
39
  #import <React/RCTComponentViewFactory.h>
38
40
 
41
+ // Deep-link URLs that arrive (openURL, universal link, or external dispatch)
42
+ // before the React runtime is ready are queued here and flushed when Fabric
43
+ // posts `RCTContentDidAppearNotification` — by which point
44
+ // `RCTLinkingManager` is instantiated and JS subscribers are listening.
45
+ static NSMutableArray<NSURL *> *gRNNPendingDeepLinkURLs = nil;
46
+ static BOOL gRNNReactRuntimeReady = NO;
47
+
39
48
 
40
49
  static NSString *const kRNConcurrentRoot = @"concurrentRoot";
41
50
 
@@ -92,9 +101,73 @@ didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
92
101
  [ReactNativeNavigation bootstrapWithHost:self.reactNativeFactory.rootViewFactory.reactHost];
93
102
  #endif
94
103
 
104
+ [self rnn_installDeepLinkObservers];
105
+
95
106
  return YES;
96
107
  }
97
108
 
109
+ #pragma mark - Deep linking
110
+
111
+ // Forward OS-delivered custom-scheme URLs to React Native's Linking module.
112
+ - (BOOL)application:(UIApplication *)application
113
+ openURL:(NSURL *)url
114
+ options:(NSDictionary<UIApplicationOpenURLOptionsKey, id> *)options {
115
+ [self dispatchDeepLinkURL:url];
116
+ return YES;
117
+ }
118
+
119
+ // Forward universal links (associated domains) to React Native's Linking
120
+ // module by extracting the underlying https URL and routing it through the
121
+ // same pre-bridge queue as everything else.
122
+ - (BOOL)application:(UIApplication *)application
123
+ continueUserActivity:(NSUserActivity *)userActivity
124
+ restorationHandler:
125
+ (void (^)(NSArray<id<UIUserActivityRestoring>> *_Nullable))restorationHandler {
126
+ if ([userActivity.activityType isEqualToString:NSUserActivityTypeBrowsingWeb]) {
127
+ [self dispatchDeepLinkURL:userActivity.webpageURL];
128
+ return YES;
129
+ }
130
+ return NO;
131
+ }
132
+
133
+ - (void)dispatchDeepLinkURL:(NSURL *)url {
134
+ if (url == nil) {
135
+ return;
136
+ }
137
+ if (gRNNReactRuntimeReady) {
138
+ [RCTLinkingManager application:[UIApplication sharedApplication]
139
+ openURL:url
140
+ options:@{}];
141
+ return;
142
+ }
143
+ if (gRNNPendingDeepLinkURLs == nil) {
144
+ gRNNPendingDeepLinkURLs = [NSMutableArray array];
145
+ }
146
+ [gRNNPendingDeepLinkURLs addObject:url];
147
+ }
148
+
149
+ - (void)rnn_installDeepLinkObservers {
150
+ // `RCTContentDidAppearNotification` is posted by Fabric's root view
151
+ // once content has rendered. RNN forces bridgeless/new-arch, so the
152
+ // legacy `RCTJavaScriptDidLoadNotification` never fires; we rely on
153
+ // this Fabric signal exclusively.
154
+ [[NSNotificationCenter defaultCenter] addObserver:self
155
+ selector:@selector(rnn_handleReactRuntimeReady:)
156
+ name:RCTContentDidAppearNotification
157
+ object:nil];
158
+ }
159
+
160
+ - (void)rnn_handleReactRuntimeReady:(NSNotification *)notification {
161
+ gRNNReactRuntimeReady = YES;
162
+ NSArray<NSURL *> *pending = [gRNNPendingDeepLinkURLs copy];
163
+ [gRNNPendingDeepLinkURLs removeAllObjects];
164
+ for (NSURL *url in pending) {
165
+ [RCTLinkingManager application:[UIApplication sharedApplication]
166
+ openURL:url
167
+ options:@{}];
168
+ }
169
+ }
170
+
98
171
 
99
172
  #if !RNN_RN_VERSION_79_OR_NEWER
100
173
  - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge {
@@ -1,3 +1,4 @@
1
+ #import "RNNComponentOptions.h"
1
2
  #import "RNNOptions.h"
2
3
 
3
4
  @class DotIndicatorOptions;
@@ -5,6 +6,7 @@
5
6
  @interface RNNBottomTabOptions : RNNOptions
6
7
 
7
8
  @property(nonatomic) NSUInteger tag;
9
+ @property(nonatomic, strong) RNNComponentOptions *component;
8
10
  @property(nonatomic, strong) Text *text;
9
11
  @property(nonatomic, strong) Text *badge;
10
12
  @property(nonatomic, strong) Color *badgeColor;
@@ -8,6 +8,9 @@
8
8
  self = [super initWithDict:dict];
9
9
  self.tag = arc4random();
10
10
 
11
+ self.component =
12
+ [[RNNComponentOptions alloc] initWithDict:[dict objectForKey:@"component"]];
13
+
11
14
  self.text = [TextParser parse:dict key:@"text"];
12
15
  self.badge = [TextParser parse:dict key:@"badge"];
13
16
  self.fontFamily = [TextParser parse:dict key:@"fontFamily"];
@@ -38,6 +41,7 @@
38
41
 
39
42
  - (void)mergeOptions:(RNNBottomTabOptions *)options {
40
43
  [self.dotIndicator mergeOptions:options.dotIndicator];
44
+ [self.component mergeOptions:options.component];
41
45
 
42
46
  if (options.text.hasValue)
43
47
  self.text = options.text;
@@ -88,7 +92,7 @@
88
92
  self.iconColor.hasValue || self.selectedIconColor.hasValue ||
89
93
  self.selectedTextColor.hasValue || self.iconInsets.hasValue || self.textColor.hasValue ||
90
94
  self.visible.hasValue || self.selectTabOnPress.hasValue || self.sfSymbol.hasValue ||
91
- self.sfSelectedSymbol.hasValue || self.role.hasValue;
95
+ self.sfSelectedSymbol.hasValue || self.role.hasValue || self.component.hasValue;
92
96
  }
93
97
 
94
98
  @end
@@ -3,6 +3,7 @@
3
3
  #import "RNNBottomTabsPresenter.h"
4
4
  #import "RNNDotIndicatorPresenter.h"
5
5
  #import "RNNEventEmitter.h"
6
+ #import "RNNReactComponentRegistry.h"
6
7
  #import "UIViewController+LayoutProtocol.h"
7
8
  #import <UIKit/UIKit.h>
8
9
 
@@ -16,6 +17,7 @@
16
17
  presenter:(RNNBasePresenter *)presenter
17
18
  bottomTabPresenter:(BottomTabPresenter *)bottomTabPresenter
18
19
  dotIndicatorPresenter:(RNNDotIndicatorPresenter *)dotIndicatorPresenter
20
+ componentRegistry:(RNNReactComponentRegistry *)componentRegistry
19
21
  eventEmitter:(RNNEventEmitter *)eventEmitter
20
22
  childViewControllers:(NSArray *)childViewControllers
21
23
  bottomTabsAttacher:(BottomTabsBaseAttacher *)bottomTabsAttacher;