@onekeyfe/react-native-bottom-tabs 6.7.0-alpha.435 → 6.7.0-alpha.444

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.
package/docs/SPEC.md CHANGED
@@ -104,6 +104,11 @@ height: a rendered custom bar's own measured height takes precedence; otherwise
104
104
  `tabBarHidden` forces zero. Native hide measurements MUST NOT overwrite a custom
105
105
  bar's height, including across native/custom presentation switches.
106
106
 
107
+ The iOS drawer MUST NOT receive touches inside the native tab bar at any
108
+ placement, because a vertical bar reports no bottom height. That covers
109
+ everything under the tab controller's view outside tab content, including the
110
+ floating item platter and side accessory.
111
+
107
112
  With opening swipes enabled, a one-finger rightward gesture may start anywhere
108
113
  in the foreground content. At the first confirmed direction, the actual native
109
114
  touch target and its ancestor chain determine ownership. A horizontal scroll
@@ -326,6 +331,12 @@ placement and can draw one round accessory button above the vertical bar.
326
331
  tab bar controller. It fires once after the bar is created and again on every
327
332
  change (rotation, folding, window resizing). Builds without the iOS 27.1 SDK
328
333
  and earlier systems always report `bottom`. Android never fires it.
334
+ - **Height on placement change:** every placement event is followed by
335
+ `onTabBarMeasured` with the bar's current height, because the height reported
336
+ for the previous placement no longer applies. A vertical bar reports its full
337
+ column height, so `BottomTabs` MUST expose 0 through
338
+ `BottomTabBarHeightContext` and the drawer's `bottomBarHeight` for `leading`
339
+ and `trailing` placement, and the measured height only for `bottom`.
329
340
  - **Side accessory:** `sideAccessoryIcon` (an image source, loaded with the
330
341
  React image loader and drawn as a template tinted with `inactiveTintColor`),
331
342
  `sideAccessoryLabel` (accessibility label), and `onSideAccessoryPress`. The
@@ -344,6 +344,9 @@ class RCTBottomTabsContainerView: UIView {
344
344
  if placement != reportedTabBarPlacement {
345
345
  reportedTabBarPlacement = placement
346
346
  onTabBarPlacementChange?(["placement": placement])
347
+ // The bar's frame follows its placement, so the height reported for the
348
+ // previous placement is stale.
349
+ onTabBarMeasured?(["height": tabBarHidden ? 0 : Double(tbc.tabBar.frame.size.height)])
347
350
  }
348
351
 
349
352
  guard placement != "bottom",
@@ -135,6 +135,7 @@ final class RCTBottomTabsDrawerContainerView: UIView, UIGestureRecognizerDelegat
135
135
  guard enabled else { return false }
136
136
  let start = touch.location(in: self)
137
137
  guard start.y < bounds.height - CGFloat(max(0, bottomBarHeight)) else { return false }
138
+ guard !isInsideNativeTabBar(touch.view) else { return false }
138
139
  touchTarget = touch.view
139
140
  if progress > 0 { return start.x >= bounds.width * 0.78 * progress }
140
141
  return swipeEnabled && !touchPathContainsExclusiveControl()
@@ -171,6 +172,24 @@ final class RCTBottomTabsDrawerContainerView: UIView, UIGestureRecognizerDelegat
171
172
  return other is UIScreenEdgePanGestureRecognizer
172
173
  }
173
174
 
175
+ // A vertical bar reports no bottom height, and UIKit draws its items in a
176
+ // floating platter outside UITabBar, so match anything under the tab
177
+ // controller's view that is not tab content.
178
+ private func isInsideNativeTabBar(_ target: UIView?) -> Bool {
179
+ var path: [UIView] = []
180
+ var view = target
181
+ while let current = view, current !== self {
182
+ if current is UITabBar { return true }
183
+ if let tabs = current.next as? UITabBarController {
184
+ let content = (tabs.viewControllers ?? []).compactMap { $0.viewIfLoaded }
185
+ return !path.contains { step in content.contains { $0 === step } }
186
+ }
187
+ path.append(current)
188
+ view = current.superview
189
+ }
190
+ return false
191
+ }
192
+
174
193
  private func touchPathContainsExclusiveControl() -> Bool {
175
194
  var view = touchTarget
176
195
  while let current = view, current !== self {
@@ -152,7 +152,9 @@ const BottomTabs = ({
152
152
  const nativeBottomTabsRef = useRef(null);
153
153
  const [nativeTabBarHeight, setNativeTabBarHeight] = React.useState(0);
154
154
  const [customTabBarHeight, setCustomTabBarHeight] = React.useState(0);
155
- const tabBarHeight = renderCustomTabBar ? customTabBarHeight : props.tabBarHidden ? 0 : nativeTabBarHeight;
155
+ const [tabBarPlacement, setTabBarPlacement] = React.useState("bottom");
156
+ // A vertical bar measures its full column height but takes no bottom space.
157
+ const tabBarHeight = renderCustomTabBar ? customTabBarHeight : props.tabBarHidden || tabBarPlacement !== "bottom" ? 0 : nativeTabBarHeight;
156
158
  const [measuredDimensions, setMeasuredDimensions] = React.useState({
157
159
  width: "100%",
158
160
  height: "100%"
@@ -279,7 +281,9 @@ const BottomTabs = ({
279
281
  });
280
282
  }, [setMeasuredDimensions]);
281
283
  const handleTabBarPlacementChange = React.useCallback(event => {
282
- onTabBarPlacementChange?.(event.nativeEvent.placement);
284
+ const placement = event.nativeEvent.placement;
285
+ setTabBarPlacement(placement);
286
+ onTabBarPlacementChange?.(placement);
283
287
  }, [onTabBarPlacementChange]);
284
288
  const handleSideAccessoryPress = React.useCallback(() => {
285
289
  onSideAccessoryPress?.();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onekeyfe/react-native-bottom-tabs",
3
- "version": "6.7.0-alpha.435",
3
+ "version": "6.7.0-alpha.444",
4
4
  "description": "Native bottom tabs (tab bar + scene container) for React Native on iOS and Android",
5
5
  "source": "./src/index.tsx",
6
6
  "main": "./lib/module/index.js",
@@ -71,7 +71,7 @@
71
71
  "typescript": "^5.9.2"
72
72
  },
73
73
  "peerDependencies": {
74
- "@onekeyfe/react-native-image": "6.7.0-alpha.435",
74
+ "@onekeyfe/react-native-image": "6.7.0-alpha.444",
75
75
  "react": "*",
76
76
  "react-native": "*"
77
77
  },
@@ -399,9 +399,12 @@ const BottomTabs = <Route extends BaseRoute>({
399
399
  useRef<React.ElementRef<typeof NativeBottomTabs>>(null);
400
400
  const [nativeTabBarHeight, setNativeTabBarHeight] = React.useState(0);
401
401
  const [customTabBarHeight, setCustomTabBarHeight] = React.useState(0);
402
+ const [tabBarPlacement, setTabBarPlacement] =
403
+ React.useState<TabBarPlacement>("bottom");
404
+ // A vertical bar measures its full column height but takes no bottom space.
402
405
  const tabBarHeight = renderCustomTabBar
403
406
  ? customTabBarHeight
404
- : props.tabBarHidden
407
+ : props.tabBarHidden || tabBarPlacement !== "bottom"
405
408
  ? 0
406
409
  : nativeTabBarHeight;
407
410
  const [measuredDimensions, setMeasuredDimensions] = React.useState<
@@ -566,7 +569,9 @@ const BottomTabs = <Route extends BaseRoute>({
566
569
 
567
570
  const handleTabBarPlacementChange = React.useCallback(
568
571
  (event: NativeSyntheticEvent<{ placement: string }>) => {
569
- onTabBarPlacementChange?.(event.nativeEvent.placement as TabBarPlacement);
572
+ const placement = event.nativeEvent.placement as TabBarPlacement;
573
+ setTabBarPlacement(placement);
574
+ onTabBarPlacementChange?.(placement);
570
575
  },
571
576
  [onTabBarPlacementChange]
572
577
  );