@onekeyfe/react-native-bottom-tabs 6.7.0-37 → 6.7.0-38
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.
|
@@ -162,12 +162,13 @@ class BottomTabsView(context: Context) : LinearLayout(context) {
|
|
|
162
162
|
private val floatingRoot = object : FrameLayout(context) {
|
|
163
163
|
override fun drawChild(canvas: Canvas, child: View, drawingTime: Long): Boolean {
|
|
164
164
|
if (child === floatingBar && usesBottomBlur) {
|
|
165
|
+
val translationY = floatingBar.translationY.roundToInt()
|
|
165
166
|
drawBlurBackdrop(
|
|
166
167
|
canvas,
|
|
167
168
|
floatingBar.left,
|
|
168
|
-
floatingBar.top,
|
|
169
|
+
floatingBar.top + translationY,
|
|
169
170
|
floatingBar.right,
|
|
170
|
-
floatingBar.bottom,
|
|
171
|
+
floatingBar.bottom + translationY,
|
|
171
172
|
floatingBar.height / 2f,
|
|
172
173
|
) { recording ->
|
|
173
174
|
super.drawChild(recording, layoutHolder, drawingTime)
|
|
@@ -232,6 +233,7 @@ class BottomTabsView(context: Context) : LinearLayout(context) {
|
|
|
232
233
|
private var floatingStretch = 0f
|
|
233
234
|
private var floatingLiftAnimator: ValueAnimator? = null
|
|
234
235
|
private var floatingSlideAnimator: ValueAnimator? = null
|
|
236
|
+
private var floatingVisibilityCallback: Choreographer.FrameCallback? = null
|
|
235
237
|
private var floatingTouchView: View? = null
|
|
236
238
|
private var floatingTouchItemId = View.NO_ID
|
|
237
239
|
private var floatingCandidateItemId = View.NO_ID
|
|
@@ -288,7 +290,7 @@ class BottomTabsView(context: Context) : LinearLayout(context) {
|
|
|
288
290
|
|
|
289
291
|
private val usesBottomBlur: Boolean
|
|
290
292
|
get() = androidBottomBlurEnabled && Build.VERSION.SDK_INT >= 31 &&
|
|
291
|
-
isHardwareAccelerated && !isTabBarHidden
|
|
293
|
+
isHardwareAccelerated && (!isTabBarHidden || floatingVisibilityCallback != null)
|
|
292
294
|
|
|
293
295
|
init {
|
|
294
296
|
orientation = VERTICAL
|
|
@@ -342,7 +344,70 @@ class BottomTabsView(context: Context) : LinearLayout(context) {
|
|
|
342
344
|
(view.parent as? ViewGroup)?.removeView(view)
|
|
343
345
|
}
|
|
344
346
|
|
|
347
|
+
private fun cancelFloatingVisibilityAnimation() {
|
|
348
|
+
val callback = floatingVisibilityCallback ?: return
|
|
349
|
+
floatingVisibilityCallback = null
|
|
350
|
+
Choreographer.getInstance().removeFrameCallback(callback)
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
private fun getFloatingBarSlideOffset(): Float {
|
|
354
|
+
val params = floatingBar.layoutParams as? FrameLayout.LayoutParams
|
|
355
|
+
val barHeightPx = floatingBar.height.takeIf { it > 0 } ?: dp(FloatingTabBarMetrics.BAR_HEIGHT)
|
|
356
|
+
val bottomMarginPx = params?.bottomMargin
|
|
357
|
+
?: (maxOf(floatingBottomInset, dp(FloatingTabBarMetrics.BAR_MIN_BOTTOM_GAP)) +
|
|
358
|
+
dp(FloatingTabBarMetrics.BAR_BOTTOM_EXTRA))
|
|
359
|
+
return (barHeightPx + bottomMarginPx + dp(4f)).toFloat()
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
private fun animateFloatingVisibility(fromY: Float, toY: Float, hiding: Boolean) {
|
|
363
|
+
cancelFloatingVisibilityAnimation()
|
|
364
|
+
if (Build.VERSION.SDK_INT >= 26 && !ValueAnimator.areAnimatorsEnabled()) {
|
|
365
|
+
floatingBar.translationY = 0f
|
|
366
|
+
floatingBar.visibility = if (hiding) GONE else VISIBLE
|
|
367
|
+
updateBlurAppearance()
|
|
368
|
+
floatingRoot.invalidate()
|
|
369
|
+
return
|
|
370
|
+
}
|
|
371
|
+
val durationMs = 140f
|
|
372
|
+
val maxFrameStepMs = 24f
|
|
373
|
+
val interpolator = DecelerateInterpolator(if (hiding) 1.2f else 1.4f)
|
|
374
|
+
var elapsedMs = 0f
|
|
375
|
+
var lastFrameTimeNanos = -1L
|
|
376
|
+
val callback = object : Choreographer.FrameCallback {
|
|
377
|
+
override fun doFrame(frameTimeNanos: Long) {
|
|
378
|
+
if (floatingVisibilityCallback !== this) return
|
|
379
|
+
val deltaMs = if (lastFrameTimeNanos < 0L) {
|
|
380
|
+
16f
|
|
381
|
+
} else {
|
|
382
|
+
((frameTimeNanos - lastFrameTimeNanos) / 1_000_000f).coerceIn(1f, maxFrameStepMs)
|
|
383
|
+
}
|
|
384
|
+
lastFrameTimeNanos = frameTimeNanos
|
|
385
|
+
elapsedMs = (elapsedMs + deltaMs).coerceAtMost(durationMs)
|
|
386
|
+
val fraction = interpolator.getInterpolation((elapsedMs / durationMs).coerceIn(0f, 1f))
|
|
387
|
+
floatingBar.translationY = fromY + (toY - fromY) * fraction
|
|
388
|
+
floatingRoot.invalidate()
|
|
389
|
+
if (elapsedMs < durationMs) {
|
|
390
|
+
Choreographer.getInstance().postFrameCallback(this)
|
|
391
|
+
} else {
|
|
392
|
+
floatingVisibilityCallback = null
|
|
393
|
+
if (hiding && isTabBarHidden) {
|
|
394
|
+
floatingBar.translationY = 0f
|
|
395
|
+
floatingBar.visibility = GONE
|
|
396
|
+
updateBlurAppearance()
|
|
397
|
+
} else if (!hiding && !isTabBarHidden) {
|
|
398
|
+
floatingBar.translationY = 0f
|
|
399
|
+
}
|
|
400
|
+
floatingRoot.invalidate()
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
floatingVisibilityCallback = callback
|
|
405
|
+
Choreographer.getInstance().postFrameCallback(callback)
|
|
406
|
+
}
|
|
407
|
+
|
|
345
408
|
private fun detachTabBarViews() {
|
|
409
|
+
cancelFloatingVisibilityAnimation()
|
|
410
|
+
floatingBar.translationY = 0f
|
|
346
411
|
releaseBottomBlur()
|
|
347
412
|
removeFromParent(layoutHolder)
|
|
348
413
|
removeFromParent(bottomNavigation)
|
|
@@ -1051,6 +1116,11 @@ class BottomTabsView(context: Context) : LinearLayout(context) {
|
|
|
1051
1116
|
}
|
|
1052
1117
|
|
|
1053
1118
|
override fun onDetachedFromWindow() {
|
|
1119
|
+
cancelFloatingVisibilityAnimation()
|
|
1120
|
+
floatingBar.translationY = 0f
|
|
1121
|
+
if (androidTabBarStyle == AndroidTabBarStyle.FLOATING) {
|
|
1122
|
+
floatingBar.visibility = if (isTabBarHidden) GONE else VISIBLE
|
|
1123
|
+
}
|
|
1054
1124
|
releaseBottomBlur()
|
|
1055
1125
|
super.onDetachedFromWindow()
|
|
1056
1126
|
}
|
|
@@ -1310,23 +1380,61 @@ class BottomTabsView(context: Context) : LinearLayout(context) {
|
|
|
1310
1380
|
}
|
|
1311
1381
|
|
|
1312
1382
|
fun setTabBarHidden(isHidden: Boolean) {
|
|
1383
|
+
if (isTabBarHidden == isHidden) {
|
|
1384
|
+
return
|
|
1385
|
+
}
|
|
1313
1386
|
isTabBarHidden = isHidden
|
|
1314
1387
|
if (isHidden) {
|
|
1315
1388
|
resetFloatingGesture()
|
|
1316
1389
|
}
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1390
|
+
val shouldAnimateFloating =
|
|
1391
|
+
androidTabBarStyle == AndroidTabBarStyle.FLOATING &&
|
|
1392
|
+
isAttachedToWindow &&
|
|
1393
|
+
width > 0 &&
|
|
1394
|
+
height > 0
|
|
1395
|
+
|
|
1396
|
+
cancelFloatingVisibilityAnimation()
|
|
1397
|
+
|
|
1398
|
+
if (!shouldAnimateFloating) {
|
|
1399
|
+
floatingBar.translationY = 0f
|
|
1400
|
+
if (androidTabBarStyle == AndroidTabBarStyle.FLOATING) {
|
|
1401
|
+
floatingBar.visibility = if (isHidden) GONE else VISIBLE
|
|
1402
|
+
bottomNavigation.visibility = VISIBLE
|
|
1403
|
+
} else {
|
|
1404
|
+
bottomNavigation.visibility = if (isHidden) GONE else VISIBLE
|
|
1405
|
+
}
|
|
1406
|
+
updateBlurAppearance()
|
|
1407
|
+
requestLayout()
|
|
1408
|
+
floatingRoot.invalidate()
|
|
1409
|
+
invalidate()
|
|
1410
|
+
if (!isHidden) post { updateFloatingIndicator(animate = false) }
|
|
1411
|
+
return
|
|
1322
1412
|
}
|
|
1323
1413
|
|
|
1414
|
+
val slideOffset = getFloatingBarSlideOffset()
|
|
1415
|
+
bottomNavigation.visibility = VISIBLE
|
|
1416
|
+
if (isHidden) {
|
|
1417
|
+
val startY = if (floatingBar.visibility == VISIBLE) floatingBar.translationY else slideOffset
|
|
1418
|
+
floatingBar.visibility = VISIBLE
|
|
1419
|
+
floatingBar.translationY = startY
|
|
1420
|
+
animateFloatingVisibility(startY, slideOffset, hiding = true)
|
|
1421
|
+
updateBlurAppearance()
|
|
1422
|
+
requestLayout()
|
|
1423
|
+
floatingRoot.invalidate()
|
|
1424
|
+
invalidate()
|
|
1425
|
+
return
|
|
1426
|
+
}
|
|
1427
|
+
|
|
1428
|
+
val wasGone = floatingBar.visibility != VISIBLE
|
|
1429
|
+
val startY = if (wasGone) slideOffset else floatingBar.translationY
|
|
1430
|
+
floatingBar.visibility = VISIBLE
|
|
1431
|
+
floatingBar.translationY = startY
|
|
1432
|
+
animateFloatingVisibility(startY, 0f, hiding = false)
|
|
1324
1433
|
updateBlurAppearance()
|
|
1325
1434
|
requestLayout()
|
|
1326
1435
|
floatingRoot.invalidate()
|
|
1327
1436
|
invalidate()
|
|
1328
|
-
|
|
1329
|
-
|
|
1437
|
+
post { updateFloatingIndicator(animate = false) }
|
|
1330
1438
|
}
|
|
1331
1439
|
|
|
1332
1440
|
fun updateItems(items: MutableList<TabInfo>) {
|
|
@@ -1366,7 +1474,9 @@ class BottomTabsView(context: Context) : LinearLayout(context) {
|
|
|
1366
1474
|
val itemView = bottomNavigation.findViewById<View>(menuItem.itemId)
|
|
1367
1475
|
itemView?.let { view ->
|
|
1368
1476
|
view.setOnClickListener {
|
|
1369
|
-
|
|
1477
|
+
if (!isTabBarHidden) {
|
|
1478
|
+
onTabSelected(menuItem)
|
|
1479
|
+
}
|
|
1370
1480
|
}
|
|
1371
1481
|
view.setOnTouchListener { touchedView, event ->
|
|
1372
1482
|
handleFloatingTabTouch(touchedView, menuItem, event)
|
package/docs/SPEC.md
CHANGED
|
@@ -239,6 +239,36 @@ that delay, cancel, or require failure of the system tab bar gestures.
|
|
|
239
239
|
The previous drag-cancellation guard (which refused selection for any touch that
|
|
240
240
|
moved more than 10 points) was removed because it disabled drag-to-switch.
|
|
241
241
|
|
|
242
|
+
## iOS bottom tab bar hide and show transition
|
|
243
|
+
|
|
244
|
+
Status: implemented in module source and verified on iOS 27.0 Simulator XCTest.
|
|
245
|
+
|
|
246
|
+
When `tabBarHidden` changes dynamically while the container view is attached to a
|
|
247
|
+
window, laid out with nonzero bounds, and in `bottom` placement, `RCTBottomTabsContainerView`
|
|
248
|
+
animates `UITabBar.transform` vertically with a critically damped 0.28 s spring
|
|
249
|
+
(`usingSpringWithDamping: 1.0`, `.beginFromCurrentState`, `.curveEaseOut`,
|
|
250
|
+
`.allowUserInteraction`) by `max(tabBar.bounds.height, 62) + 12` points so the
|
|
251
|
+
floating Liquid Glass capsule slides smoothly off and back onto the bottom edge.
|
|
252
|
+
|
|
253
|
+
- **Immediate state & measurement:** `tabBar.isUserInteractionEnabled` and
|
|
254
|
+
`onTabBarMeasured` (`0` when hiding, `tabBar.bounds.height` when showing)
|
|
255
|
+
update immediately when `tabBarHidden` changes, without waiting for animation
|
|
256
|
+
completion.
|
|
257
|
+
- **Hide transition:** UIKit's system visibility (`setTabBarHidden(false, animated: false)`)
|
|
258
|
+
stays active while the bar slides down so layout passes triggered by concurrent
|
|
259
|
+
child navigation pushes do not snap `tabBar.alpha` to zero. When the slide-out
|
|
260
|
+
completes (and no newer `tabBarHidden` transition has superseded it), the view
|
|
261
|
+
resets `tabBar.transform = .identity` and applies `setTabBarHidden(true, animated: false)`
|
|
262
|
+
inside `UIView.performWithoutAnimation`.
|
|
263
|
+
- **Show transition & reversal:** showing unhides the system bar without animation,
|
|
264
|
+
seeds `tabBar.transform` at the downward offset when transitioning from a
|
|
265
|
+
settled hidden state (or preserves the in-flight transform on mid-transition
|
|
266
|
+
reversal), and animates back to `.identity`.
|
|
267
|
+
- **Non-animated cases:** initial setup, detached views (`window == nil`), zero-sized
|
|
268
|
+
containers, and `leading`/`trailing` vertical placements apply visibility
|
|
269
|
+
immediately without animation, strip active layer animations, and reset
|
|
270
|
+
`tabBar.transform` to `.identity`.
|
|
271
|
+
|
|
242
272
|
## Android tab bar style
|
|
243
273
|
|
|
244
274
|
`androidTabBarStyle` selects the Android presentation; iOS ignores it.
|
|
@@ -284,6 +314,12 @@ Floating interaction (single finger; motion splitting is disabled):
|
|
|
284
314
|
the old tab for cancelled or `preventsDefault` presses.
|
|
285
315
|
|
|
286
316
|
JS-driven selection changes slide the pill with a spring and velocity stretch.
|
|
317
|
+
When `tabBarHidden` changes dynamically while attached and laid out in `floating`
|
|
318
|
+
style, `BottomTabsView` animates `floatingBar.translationY` across its visible
|
|
319
|
+
bottom clearance (`DecelerateInterpolator`), preserving in-flight translation on
|
|
320
|
+
rapid reversals, keeping the live blur backdrop active while the bar slides off
|
|
321
|
+
screen, immediately reporting the updated measured height (`0` when hidden), and
|
|
322
|
+
setting `floatingBar.visibility = GONE` upon hide completion.
|
|
287
323
|
Switching style at runtime rebuilds the bar and restores Material's label sizes,
|
|
288
324
|
icon size, ripple, padding, and gravity when returning to `default`.
|
|
289
325
|
|
|
@@ -151,8 +151,11 @@ class RCTBottomTabsContainerView: UIView {
|
|
|
151
151
|
private var selectedIconRequestTokens: [Int: NSObject] = [:]
|
|
152
152
|
private var sideAccessoryRequestToken = NSObject()
|
|
153
153
|
private var isSideAccessoryLayoutScheduled = false
|
|
154
|
+
private var tabBarVisibilityAnimationGeneration = 0
|
|
154
155
|
private static let sideAccessorySize: CGFloat = 48
|
|
155
156
|
private static let sideAccessorySpacing: CGFloat = 12
|
|
157
|
+
private static let tabBarSlideAnimationDuration: TimeInterval = 0.28
|
|
158
|
+
private static let tabBarSlideClearance: CGFloat = 12
|
|
156
159
|
|
|
157
160
|
// MARK: - Props (set by Fabric ComponentView via KVC)
|
|
158
161
|
|
|
@@ -193,7 +196,10 @@ class RCTBottomTabsContainerView: UIView {
|
|
|
193
196
|
}
|
|
194
197
|
|
|
195
198
|
@objc var tabBarHidden: Bool = false {
|
|
196
|
-
didSet {
|
|
199
|
+
didSet {
|
|
200
|
+
guard tabBarHidden != oldValue else { return }
|
|
201
|
+
updateTabBarHidden(animated: window != nil)
|
|
202
|
+
}
|
|
197
203
|
}
|
|
198
204
|
|
|
199
205
|
@objc var translucent: NSNumber? {
|
|
@@ -284,6 +290,13 @@ class RCTBottomTabsContainerView: UIView {
|
|
|
284
290
|
}
|
|
285
291
|
}
|
|
286
292
|
|
|
293
|
+
override func didMoveToWindow() {
|
|
294
|
+
super.didMoveToWindow()
|
|
295
|
+
if window == nil, tabBarController != nil {
|
|
296
|
+
updateTabBarHidden(animated: false)
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
|
|
287
300
|
// MARK: - Layout
|
|
288
301
|
|
|
289
302
|
override func layoutSubviews() {
|
|
@@ -347,10 +360,13 @@ class RCTBottomTabsContainerView: UIView {
|
|
|
347
360
|
let placement = currentTabBarPlacement()
|
|
348
361
|
if placement != reportedTabBarPlacement {
|
|
349
362
|
reportedTabBarPlacement = placement
|
|
363
|
+
if placement != "bottom" && tbc.tabBar.transform != .identity {
|
|
364
|
+
updateTabBarHidden(animated: false)
|
|
365
|
+
}
|
|
350
366
|
onTabBarPlacementChange?(["placement": placement])
|
|
351
367
|
// The bar's frame follows its placement, so the height reported for the
|
|
352
368
|
// previous placement is stale.
|
|
353
|
-
onTabBarMeasured?(["height": tabBarHidden ? 0 : Double(tbc.tabBar.
|
|
369
|
+
onTabBarMeasured?(["height": tabBarHidden ? 0 : Double(tbc.tabBar.bounds.size.height)])
|
|
354
370
|
}
|
|
355
371
|
|
|
356
372
|
guard placement != "bottom",
|
|
@@ -527,13 +543,13 @@ class RCTBottomTabsContainerView: UIView {
|
|
|
527
543
|
rebuildViewControllers()
|
|
528
544
|
updateTabBarAppearance()
|
|
529
545
|
updateTintColors()
|
|
530
|
-
updateTabBarHidden()
|
|
546
|
+
updateTabBarHidden(animated: false)
|
|
531
547
|
updateSidebarAdaptable()
|
|
532
548
|
updateMinimizeBehavior()
|
|
533
549
|
|
|
534
550
|
DispatchQueue.main.async { [weak self] in
|
|
535
551
|
guard let self, let tbc = self.tabBarController else { return }
|
|
536
|
-
self.onTabBarMeasured?(["height": self.tabBarHidden ? 0 : Double(tbc.tabBar.
|
|
552
|
+
self.onTabBarMeasured?(["height": self.tabBarHidden ? 0 : Double(tbc.tabBar.bounds.size.height)])
|
|
537
553
|
}
|
|
538
554
|
}
|
|
539
555
|
|
|
@@ -793,22 +809,110 @@ class RCTBottomTabsContainerView: UIView {
|
|
|
793
809
|
}
|
|
794
810
|
}
|
|
795
811
|
|
|
796
|
-
private func
|
|
797
|
-
|
|
812
|
+
private func isSystemTabBarHidden(on tbc: UITabBarController) -> Bool {
|
|
813
|
+
#if compiler(>=6.0)
|
|
814
|
+
if #available(iOS 18.0, *) {
|
|
815
|
+
return tbc.isTabBarHidden || tbc.tabBar.isHidden || tbc.tabBar.alpha == 0
|
|
816
|
+
}
|
|
817
|
+
#endif
|
|
818
|
+
return tbc.tabBar.isHidden || tbc.tabBar.alpha == 0
|
|
819
|
+
}
|
|
820
|
+
|
|
821
|
+
private func applySystemTabBarHidden(_ hidden: Bool, on tbc: UITabBarController) {
|
|
798
822
|
// Keep UIKit's tab bar visibility state in sync on iOS 18+.
|
|
799
823
|
#if compiler(>=6.0)
|
|
800
824
|
if #available(iOS 18.0, *) {
|
|
801
|
-
tbc.setTabBarHidden(
|
|
825
|
+
tbc.setTabBarHidden(hidden, animated: false)
|
|
802
826
|
} else {
|
|
803
|
-
tbc.tabBar.isHidden =
|
|
827
|
+
tbc.tabBar.isHidden = hidden
|
|
804
828
|
}
|
|
805
829
|
#else
|
|
806
|
-
tbc.tabBar.isHidden =
|
|
830
|
+
tbc.tabBar.isHidden = hidden
|
|
807
831
|
#endif
|
|
832
|
+
if !hidden {
|
|
833
|
+
tbc.tabBar.isHidden = false
|
|
834
|
+
tbc.tabBar.alpha = 1.0
|
|
835
|
+
}
|
|
836
|
+
}
|
|
837
|
+
|
|
838
|
+
private func tabBarSlideOffset(for tbc: UITabBarController) -> CGFloat {
|
|
839
|
+
max(tbc.tabBar.bounds.size.height, 62) + Self.tabBarSlideClearance
|
|
840
|
+
}
|
|
841
|
+
|
|
842
|
+
private func updateTabBarHidden(animated: Bool = false) {
|
|
843
|
+
guard let tbc = tabBarController else { return }
|
|
844
|
+
tabBarVisibilityAnimationGeneration += 1
|
|
845
|
+
let generation = tabBarVisibilityAnimationGeneration
|
|
808
846
|
tbc.tabBar.isUserInteractionEnabled = !tabBarHidden
|
|
809
847
|
|
|
810
|
-
|
|
848
|
+
let shouldAnimate =
|
|
849
|
+
animated &&
|
|
850
|
+
currentTabBarPlacement() == "bottom" &&
|
|
851
|
+
bounds.width > 0 &&
|
|
852
|
+
bounds.height > 0
|
|
853
|
+
|
|
854
|
+
if !shouldAnimate {
|
|
855
|
+
UIView.performWithoutAnimation {
|
|
856
|
+
tbc.tabBar.layer.removeAllAnimations()
|
|
857
|
+
tbc.tabBar.transform = .identity
|
|
858
|
+
applySystemTabBarHidden(tabBarHidden, on: tbc)
|
|
859
|
+
tbc.view.layoutIfNeeded()
|
|
860
|
+
}
|
|
861
|
+
onTabBarMeasured?(["height": tabBarHidden ? 0 : Double(tbc.tabBar.bounds.size.height)])
|
|
862
|
+
scheduleSideAccessoryLayout()
|
|
863
|
+
return
|
|
864
|
+
}
|
|
865
|
+
|
|
866
|
+
if tabBarHidden {
|
|
867
|
+
// Keep UIKit's system visibility active while sliding down so layout passes
|
|
868
|
+
// triggered by concurrent navigation pushes do not snap tabBar.alpha to 0.
|
|
869
|
+
let slideOffset = tabBarSlideOffset(for: tbc)
|
|
870
|
+
onTabBarMeasured?(["height": 0.0])
|
|
871
|
+
scheduleSideAccessoryLayout()
|
|
872
|
+
UIView.animate(
|
|
873
|
+
withDuration: Self.tabBarSlideAnimationDuration,
|
|
874
|
+
delay: 0,
|
|
875
|
+
usingSpringWithDamping: 1.0,
|
|
876
|
+
initialSpringVelocity: 0,
|
|
877
|
+
options: [.beginFromCurrentState, .curveEaseOut, .allowUserInteraction],
|
|
878
|
+
animations: {
|
|
879
|
+
tbc.tabBar.transform = CGAffineTransform(translationX: 0, y: slideOffset)
|
|
880
|
+
},
|
|
881
|
+
completion: { [weak self, weak tbc] _ in
|
|
882
|
+
guard let self,
|
|
883
|
+
let tbc,
|
|
884
|
+
self.tabBarVisibilityAnimationGeneration == generation,
|
|
885
|
+
self.tabBarHidden else { return }
|
|
886
|
+
UIView.performWithoutAnimation {
|
|
887
|
+
tbc.tabBar.transform = .identity
|
|
888
|
+
self.applySystemTabBarHidden(true, on: tbc)
|
|
889
|
+
}
|
|
890
|
+
}
|
|
891
|
+
)
|
|
892
|
+
return
|
|
893
|
+
}
|
|
894
|
+
|
|
895
|
+
let wasSystemHidden = isSystemTabBarHidden(on: tbc)
|
|
896
|
+
UIView.performWithoutAnimation {
|
|
897
|
+
applySystemTabBarHidden(false, on: tbc)
|
|
898
|
+
tbc.view.layoutIfNeeded()
|
|
899
|
+
if wasSystemHidden {
|
|
900
|
+
let slideOffset = tabBarSlideOffset(for: tbc)
|
|
901
|
+
tbc.tabBar.transform = CGAffineTransform(translationX: 0, y: slideOffset)
|
|
902
|
+
}
|
|
903
|
+
}
|
|
904
|
+
onTabBarMeasured?(["height": Double(tbc.tabBar.bounds.size.height)])
|
|
811
905
|
scheduleSideAccessoryLayout()
|
|
906
|
+
UIView.animate(
|
|
907
|
+
withDuration: Self.tabBarSlideAnimationDuration,
|
|
908
|
+
delay: 0,
|
|
909
|
+
usingSpringWithDamping: 1.0,
|
|
910
|
+
initialSpringVelocity: 0,
|
|
911
|
+
options: [.beginFromCurrentState, .curveEaseOut, .allowUserInteraction],
|
|
912
|
+
animations: {
|
|
913
|
+
tbc.tabBar.transform = .identity
|
|
914
|
+
}
|
|
915
|
+
)
|
|
812
916
|
}
|
|
813
917
|
|
|
814
918
|
private func updateSidebarAdaptable() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onekeyfe/react-native-bottom-tabs",
|
|
3
|
-
"version": "6.7.0-
|
|
3
|
+
"version": "6.7.0-38",
|
|
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",
|