@onekeyfe/react-native-bottom-tabs 6.7.0-alpha.475 → 6.8.0-10
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/README.md +139 -48
- package/android/src/main/java/com/onekey/bottomtabs/BottomTabsDrawerManager.kt +15 -0
- package/android/src/main/java/com/onekey/bottomtabs/BottomTabsDrawerView.kt +315 -59
- package/android/src/main/java/com/onekey/bottomtabs/BottomTabsView.kt +426 -53
- package/android/src/main/java/com/onekey/bottomtabs/BottomTabsViewManager.kt +6 -5
- package/android/src/main/java/com/onekey/bottomtabs/FloatingTabBarStyle.kt +22 -6
- package/android/src/main/java/com/onekey/bottomtabs/events/TabDoublePressEvent.kt +7 -1
- package/docs/SPEC.md +228 -30
- package/ios/RCTBottomTabsComponentView.mm +4 -1
- package/ios/RCTBottomTabsContainerView.swift +263 -15
- package/ios/RCTBottomTabsDrawerComponentView.mm +24 -0
- package/ios/RCTBottomTabsDrawerContainerView.swift +358 -51
- package/ios/tests/BottomTabsDrawerReduceMotionTests.swift +291 -0
- package/lib/module/BottomTabs.js +85 -58
- package/lib/module/BottomTabsDrawerNativeComponent.ts +3 -0
- package/lib/module/BottomTabsNativeComponent.ts +6 -1
- package/lib/module/index.js +1 -0
- package/lib/typescript/src/BottomTabs.d.ts +23 -2
- package/lib/typescript/src/BottomTabsDrawerNativeComponent.d.ts +5 -0
- package/lib/typescript/src/BottomTabsNativeComponent.d.ts +5 -1
- package/lib/typescript/src/index.d.ts +1 -0
- package/package.json +1 -1
- package/react-native-bottom-tabs.podspec +6 -0
- package/src/BottomTabs.tsx +94 -44
- package/src/BottomTabsDrawerNativeComponent.ts +3 -0
- package/src/BottomTabsNativeComponent.ts +6 -1
- package/src/index.tsx +1 -0
|
@@ -35,8 +35,8 @@ class BottomTabsViewManager(context: ReactApplicationContext) :
|
|
|
35
35
|
eventDispatcher?.dispatchEvent(PageSelectedEvent(surfaceId, view.id, key))
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
view.onTabDoublePressedListener = { key ->
|
|
39
|
-
eventDispatcher?.dispatchEvent(TabDoublePressEvent(surfaceId, view.id, key))
|
|
38
|
+
view.onTabDoublePressedListener = { key, didScrollToTop ->
|
|
39
|
+
eventDispatcher?.dispatchEvent(TabDoublePressEvent(surfaceId, view.id, key, didScrollToTop))
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
view.onNativeLayoutListener = { width, height ->
|
|
@@ -207,9 +207,10 @@ class BottomTabsViewManager(context: ReactApplicationContext) :
|
|
|
207
207
|
}
|
|
208
208
|
|
|
209
209
|
// iOS-only props (no-ops on Android)
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
210
|
+
override fun setSelectedIcons(view: BottomTabsView?, value: ReadableArray?) {
|
|
211
|
+
if (view != null)
|
|
212
|
+
view.setSelectedIcons(value)
|
|
213
|
+
}
|
|
213
214
|
override fun setTranslucent(view: BottomTabsView?, value: Boolean) {}
|
|
214
215
|
override fun setSidebarAdaptable(view: BottomTabsView?, value: Boolean) {}
|
|
215
216
|
override fun setScrollEdgeAppearance(view: BottomTabsView?, value: String?) {}
|
|
@@ -24,6 +24,14 @@ internal object FloatingTabBarMetrics {
|
|
|
24
24
|
const val LENS_MAX_STRETCH = 0.16f
|
|
25
25
|
const val ITEM_PRESSED_SCALE = 1.1f
|
|
26
26
|
const val DRAG_EDGE_RESISTANCE = 0.22f
|
|
27
|
+
|
|
28
|
+
// Motion timings aligned with the iOS 26 Liquid Glass tab bar spring.
|
|
29
|
+
const val SLIDE_DURATION_MS = 520L
|
|
30
|
+
const val SLIDE_SPRING_DAMPING = 0.82f
|
|
31
|
+
const val SLIDE_SPRING_FREQUENCY = 7.5f
|
|
32
|
+
const val LIFT_UP_DURATION_MS = 220L
|
|
33
|
+
const val LIFT_SETTLE_DURATION_MS = 380L
|
|
34
|
+
const val LIFT_HOLD_DURING_SLIDE_MS = 200L
|
|
27
35
|
}
|
|
28
36
|
|
|
29
37
|
/**
|
|
@@ -31,20 +39,28 @@ internal object FloatingTabBarMetrics {
|
|
|
31
39
|
* below 1 overshoots slightly before settling, matching UIKit spring motion.
|
|
32
40
|
*/
|
|
33
41
|
internal class SpringInterpolator(
|
|
34
|
-
private val dampingRatio: Float =
|
|
35
|
-
private val angularFrequency: Float =
|
|
42
|
+
private val dampingRatio: Float = FloatingTabBarMetrics.SLIDE_SPRING_DAMPING,
|
|
43
|
+
private val angularFrequency: Float = FloatingTabBarMetrics.SLIDE_SPRING_FREQUENCY,
|
|
36
44
|
) : Interpolator {
|
|
37
45
|
private val dampedFrequency =
|
|
38
46
|
angularFrequency * sqrt(1f - dampingRatio * dampingRatio)
|
|
47
|
+
private val endValue = rawSpring(1f)
|
|
39
48
|
|
|
40
|
-
|
|
41
|
-
if (input >= 1f) {
|
|
42
|
-
return 1f
|
|
43
|
-
}
|
|
49
|
+
private fun rawSpring(input: Float): Float {
|
|
44
50
|
val decay = exp(-dampingRatio * angularFrequency * input)
|
|
45
51
|
val phase = dampedFrequency * input
|
|
46
52
|
return 1f - decay * (
|
|
47
53
|
cos(phase) + (dampingRatio * angularFrequency / dampedFrequency) * sin(phase)
|
|
48
54
|
)
|
|
49
55
|
}
|
|
56
|
+
|
|
57
|
+
override fun getInterpolation(input: Float): Float {
|
|
58
|
+
if (input <= 0f) {
|
|
59
|
+
return 0f
|
|
60
|
+
}
|
|
61
|
+
if (input >= 1f || endValue == 0f) {
|
|
62
|
+
return 1f
|
|
63
|
+
}
|
|
64
|
+
return rawSpring(input) / endValue
|
|
65
|
+
}
|
|
50
66
|
}
|
|
@@ -4,12 +4,18 @@ import com.facebook.react.bridge.Arguments
|
|
|
4
4
|
import com.facebook.react.bridge.WritableMap
|
|
5
5
|
import com.facebook.react.uimanager.events.Event
|
|
6
6
|
|
|
7
|
-
class TabDoublePressEvent(
|
|
7
|
+
class TabDoublePressEvent(
|
|
8
|
+
surfaceId: Int,
|
|
9
|
+
viewTag: Int,
|
|
10
|
+
private val key: String,
|
|
11
|
+
private val didScrollToTop: Boolean,
|
|
12
|
+
) : Event<TabDoublePressEvent>(surfaceId, viewTag) {
|
|
8
13
|
override fun getEventName(): String = EVENT_NAME
|
|
9
14
|
|
|
10
15
|
override fun getEventData(): WritableMap {
|
|
11
16
|
return Arguments.createMap().apply {
|
|
12
17
|
putString("key", key)
|
|
18
|
+
putBoolean("didScrollToTop", didScrollToTop)
|
|
13
19
|
}
|
|
14
20
|
}
|
|
15
21
|
|
package/docs/SPEC.md
CHANGED
|
@@ -44,9 +44,25 @@ and SF Symbols retain their existing resolution. The shared resolver is used for
|
|
|
44
44
|
focused/unfocused icons and the iOS side-accessory icon.
|
|
45
45
|
|
|
46
46
|
The default `getIcon` resolver has a stable identity. With the same routes array
|
|
47
|
-
and resolver, iOS
|
|
48
|
-
|
|
49
|
-
|
|
47
|
+
and resolver, both iOS and Android retain normal (`icons`) and selected
|
|
48
|
+
(`selectedIcons`) icon-source arrays across tab selection and unrelated renders,
|
|
49
|
+
and `items` does not recompute solely because `selectedPage` changes. Replacing
|
|
50
|
+
the routes array or supplying a new resolver recomputes both arrays. On Android,
|
|
51
|
+
`BottomTabsView` pre-loads both `icons` and `selectedIcons` into `drawableCache`
|
|
52
|
+
and swaps each `MenuItem`'s icon synchronously on the UI thread when selection
|
|
53
|
+
changes.
|
|
54
|
+
|
|
55
|
+
## iOS icon completion updates
|
|
56
|
+
|
|
57
|
+
When normal or selected artwork arrives, update the existing `UITabBarItem`
|
|
58
|
+
images without rebuilding controllers or replacing items. Coalesce completed
|
|
59
|
+
indices into one main-queue update; use the current source/token ownership and
|
|
60
|
+
current tints, including SF Symbol and normal-image fallbacks. Item identity,
|
|
61
|
+
selection, labels, badges and accessibility identifiers remain intact. Structural
|
|
62
|
+
item changes retain the existing rebuild path. Android is unchanged.
|
|
63
|
+
|
|
64
|
+
Consumer simulator evidence covers cold launch, tab switching and light/dark
|
|
65
|
+
icon tint. Physical-device and rapid source/reorder acceptance remain pending.
|
|
50
66
|
|
|
51
67
|
## Native left drawer
|
|
52
68
|
|
|
@@ -58,6 +74,11 @@ The static Home example also passed a focused TypeScript check.
|
|
|
58
74
|
Detailed iOS runtime evidence is recorded separately; physical-device and exact
|
|
59
75
|
reference-video acceptance remain pending.
|
|
60
76
|
|
|
77
|
+
Reference-recording motion revision: implemented on iOS and Android. iOS is
|
|
78
|
+
runtime verified in the consumer app on an iPhone 17 simulator; Android is
|
|
79
|
+
source-complete with updated native tests that still need an emulator run (see
|
|
80
|
+
Conformance below).
|
|
81
|
+
|
|
61
82
|
`renderDrawerContent?: () => React.ReactNode` supplies an optional menu slot.
|
|
62
83
|
`drawerOpen?: boolean` defaults to false and requests its stable open state.
|
|
63
84
|
`onDrawerOpenChange?: (open: boolean) => void` reports a completed user transition;
|
|
@@ -66,12 +87,35 @@ initial layout and cancellation emit no event. A user transition returning to
|
|
|
66
87
|
the previous stable state emits only when it overrides an in-flight external
|
|
67
88
|
target, so the consumer can reconcile that target. `drawerSwipeEnabled?: boolean`
|
|
68
89
|
defaults to false; callers MUST enable it only where drawer navigation is appropriate (normally a root
|
|
69
|
-
screen). Existing `hapticFeedbackEnabled` enables one light native haptic
|
|
70
|
-
|
|
90
|
+
screen). Existing `hapticFeedbackEnabled` enables one light native haptic when a
|
|
91
|
+
user's release, dim tap or Back/escape commits to the other stable state: it
|
|
92
|
+
plays at that decision, not when the drawer lands, and once per transition, so
|
|
93
|
+
a drag that takes over and releases toward the same target does not repeat it.
|
|
94
|
+
Releases that return to the current stable state, programmatic updates and
|
|
71
95
|
cancelled gestures do not vibrate.
|
|
72
96
|
|
|
97
|
+
`onDrawerProgress?: (event) => void` receives `{ progress }`, the displayed
|
|
98
|
+
progress clamped to [0, 1], while the drawer moves. Native emits it only while
|
|
99
|
+
a handler is set (the wrapper derives the internal `progressEventsEnabled` prop
|
|
100
|
+
from the handler's presence), at most once per frame, when progress changed by
|
|
101
|
+
at least .002, and always on reaching 0 or 1. Enabling it emits the current
|
|
102
|
+
value once, so a new subscriber starts in sync. The wrapper enables it one
|
|
103
|
+
commit after mount, once the host's event emitter and an animated host's
|
|
104
|
+
worklet handler are attached; on iOS the host also re-sends the current value
|
|
105
|
+
when Fabric attaches the event emitter after a mount's first props. The handler is passed to the
|
|
106
|
+
host unchanged, so `drawerHostComponent?` (default: the native host) can be an
|
|
107
|
+
animated wrapper such as `Animated.createAnimatedComponent(BottomTabsDrawerNative)`
|
|
108
|
+
whose worklet handler consumes the event on the UI thread. The package does
|
|
109
|
+
not depend on Reanimated; `BottomTabsDrawerNative` is exported for this use.
|
|
110
|
+
`drawerColorScheme?: "light" | "dark"` selects the page palette below; when
|
|
111
|
+
omitted the internal `colorScheme` prop is `"system"` and follows the iOS trait
|
|
112
|
+
collection or the Android configuration's night mode. Pass the app theme when
|
|
113
|
+
it can differ from those (an app-level iOS window style override is followed
|
|
114
|
+
without it).
|
|
115
|
+
|
|
73
116
|
The drawer is physically left on both iOS and Android, including RTL. Its width
|
|
74
|
-
is
|
|
117
|
+
is 80 percent of the host, and the React menu slot is laid out at the same
|
|
118
|
+
80 percent so its descendants reach the menu's edge. The foreground is the full tab container, including
|
|
75
119
|
the native tab bar and an optional custom JS bar. It keeps its full width and
|
|
76
120
|
height while moving right, without scaling, scene reparenting or remounting.
|
|
77
121
|
The native host and two slots remain mounted when the drawer is disabled or its
|
|
@@ -80,12 +124,19 @@ an event, and passes foreground input through. Web omits the drawer host/menu
|
|
|
80
124
|
and passes the existing tab content through; it implements no drawer gestures.
|
|
81
125
|
The existing tab view's other Web support is unchanged.
|
|
82
126
|
|
|
83
|
-
For normalized progress `p` in [0, 1], foreground translation is `.
|
|
84
|
-
its left circular corner radius is `
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
127
|
+
For normalized progress `p` in [0, 1], foreground translation is `.8 * width * p`
|
|
128
|
+
and its left circular corner radius is `62 * min(1, p / .1)` points/dp, so
|
|
129
|
+
screens with other display corners never show a radius jump. The dim surface
|
|
130
|
+
washes the page linearly: white at `.5 * p` in the light palette, RGB 36/36/36
|
|
131
|
+
at `.58 * p` in the dark palette. In the light palette the page also casts a
|
|
132
|
+
black shadow under its left edge and corners, opacity .16, Gaussian sigma 18
|
|
133
|
+
points/dp, no offset, following the current corner radius; in the dark palette it instead draws a one-physical-pixel
|
|
134
|
+
white edge at 17 percent opacity. The menu scales from .97 to 1 about its
|
|
135
|
+
left-center edge (1 throughout when motion is reduced, see below) and its
|
|
136
|
+
opacity is `min(1, p / .6)`. The host itself is transparent, so whatever lies
|
|
137
|
+
behind it shows through the fading menu and its scaled-down margins.
|
|
138
|
+
These values were measured frame by frame from the reference recording.
|
|
139
|
+
Closed menus are hidden from touch/accessibility;
|
|
89
140
|
while visible, the foreground is blocked by a native dim surface. Tapping that
|
|
90
141
|
surface closes the drawer. iOS accessibility escape and Android Back close an
|
|
91
142
|
open drawer; the dim surface exposes an accessible close action.
|
|
@@ -131,33 +182,71 @@ pending direction even when a nested pager initially disallows interception,
|
|
|
131
182
|
but stops overriding that request after the child wins. Sliders and editing controls,
|
|
132
183
|
web/graphics surfaces, system back gestures and starts in the bottom tab-bar
|
|
133
184
|
footprint take priority. When open, closing gestures
|
|
134
|
-
remain enabled even if opening swipes are disabled.
|
|
135
|
-
|
|
136
|
-
|
|
185
|
+
remain enabled even if opening swipes are disabled. The exposed foreground
|
|
186
|
+
accepts a closing pan in either direction; inside the menu a leftward
|
|
187
|
+
horizontal pan closes it too, while sliders and editing controls keep their
|
|
188
|
+
touches and vertical menu scrolling remains the consumer's own. Inside the
|
|
189
|
+
menu the direction is read from the distance moved as well as the current
|
|
190
|
+
speed, and a horizontal swipe in either direction cancels React touches under
|
|
191
|
+
it, so the row under the finger never fires its press. Whenever a drawer pan
|
|
192
|
+
takes ownership it cancels React touches the same way (iOS cycles the surface
|
|
193
|
+
touch handler, which a descendant recognizer cannot prevent; Android notifies
|
|
194
|
+
the native gesture start, and its end once the touch stops however it stops,
|
|
195
|
+
since React's pointer dispatcher drops input until it does). Vertical gestures fail before taking ownership. Active touches interrupted by
|
|
137
196
|
a second finger, system cancellation, disabling, detach or a newer prop update
|
|
138
197
|
cannot later emit an event. Cancellation returns to the previous stable state,
|
|
139
198
|
or resumes an external target whose programmatic animation the gesture interrupted.
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
Both platforms settle on their UI thread with the same
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
199
|
+
Gesture progress crosses the JS bridge only through the opt-in `onDrawerProgress`.
|
|
200
|
+
|
|
201
|
+
Both platforms settle on their UI thread with the same curves. A tap, dim
|
|
202
|
+
close, Back/escape or prop change starting from rest eases with
|
|
203
|
+
cubic-bezier(.55, .6, .2, 1) over `max(.12, D * |target - p0|)` seconds, where D
|
|
204
|
+
is .36 to open and .29 to close. A released drag settles on a spring with
|
|
205
|
+
natural frequency 25.5 rad/s and damping ratio .84, starting from its normalized
|
|
206
|
+
finger velocity `v0` clamped to [-12, 12] per second; release targets open when
|
|
207
|
+
`p + v0*.12 >= .5`. Only this spring may carry the page past open, by at most
|
|
208
|
+
3 percent of the drawer width; reported progress and touch/accessibility state
|
|
209
|
+
stay clamped to [0, 1]. The spring ends once within .0005 of its target and
|
|
210
|
+
slower than .02 per second, or at 600 ms. A request for a different target
|
|
211
|
+
while animating continues from the displayed progress with its current
|
|
212
|
+
velocity on the spring; a request for the same target keeps the running
|
|
213
|
+
animation and only replaces whether its completion is a user transition. A
|
|
214
|
+
touch starts from the current displayed progress and cancels the previous
|
|
215
|
+
completion. When the system asks for less motion (iOS Reduce Motion; Android
|
|
216
|
+
with animator duration scale 0), the menu does not scale. On iOS a tap,
|
|
217
|
+
close or prop change from rest then cross-fades from a snapshot to the final
|
|
218
|
+
state over 200 ms instead of moving, and a released drag settles critically
|
|
219
|
+
damped (damping ratio 1) without travelling past its target. A cross-fade is
|
|
220
|
+
an in-flight transition like an animation: its final state shows at once under
|
|
221
|
+
the snapshot, but the stable state and `onDrawerOpenChange` follow only when
|
|
222
|
+
the fade ends. A newer cross-fade replaces the previous snapshot
|
|
223
|
+
(capturing it as currently shown). A request for the target already being
|
|
224
|
+
faded to leaves the fade running and only replaces whether its completion is a
|
|
225
|
+
user transition. A touch, an animated settle, a newer cross-fade, disabling or
|
|
226
|
+
detach removes the snapshot without completing it, as a touch does a running
|
|
227
|
+
animation, so a drag that begins during a faded close never receives that
|
|
228
|
+
close's prop echo; a resize completes it at once. While the snapshot shows, the
|
|
229
|
+
host takes every touch itself, so none reaches a page, menu or dim control that
|
|
230
|
+
is already in the final state under it; the drawer pan still receives them.
|
|
231
|
+
Android has no separate reduced-motion setting and lands such transitions
|
|
232
|
+
immediately.
|
|
148
233
|
Resize snaps a pending settlement to its target, emitting its user event once
|
|
149
234
|
if appropriate; an active drag follows the same cancellation rule. Detach cancels
|
|
150
235
|
animations and callbacks; reattachment reapplies the latest external target.
|
|
151
236
|
The host retains at most one display-link/animator, one touch
|
|
152
|
-
sequence, two React child slots, and native dim surfaces
|
|
153
|
-
|
|
237
|
+
sequence, two React child slots, and native dim surfaces; on iOS one transient
|
|
238
|
+
snapshot during a reduced-motion cross-fade, removed when it ends; on Android
|
|
239
|
+
one hardware layer on the menu while its opacity is strictly between 0 and 1,
|
|
240
|
+
and three gradient shaders for the page shadow, rebuilt only when the corner
|
|
241
|
+
radius, height or palette changes. It owns no workers, persistence, JS
|
|
242
|
+
animation objects, RNGH or Reanimated dependency.
|
|
154
243
|
|
|
155
244
|
Implementation boundaries: `src/BottomTabs.tsx` owns slots and settled callbacks;
|
|
156
245
|
`src/BottomTabsDrawerNativeComponent.ts` defines the Fabric boundary;
|
|
157
246
|
`ios/RCTBottomTabsDrawerContainerView.swift` and
|
|
158
247
|
`android/src/main/java/com/onekey/bottomtabs/BottomTabsDrawerView.kt` own native
|
|
159
248
|
input, layout, animation and cleanup. The iOS Fabric component and Android manager only forward children,
|
|
160
|
-
props and the
|
|
249
|
+
props, the settled event and the opt-in progress event. Required acceptance includes both bar styles,
|
|
161
250
|
custom bars, content/vertical gestures, dim close, rapid reversal, cancellation,
|
|
162
251
|
disable/remove-content, resize, detach, accessibility, RTL and bottom-bar
|
|
163
252
|
gesture ownership, including a real pager, nested horizontal list and vertical
|
|
@@ -165,6 +254,31 @@ scrolling in the complete Fabric example. Source checks and emulator checks do n
|
|
|
165
254
|
device smoothness or exact reference-video fidelity.
|
|
166
255
|
The Android native suite also exercises generated drawer prop forwarding in RTL,
|
|
167
256
|
physical-left placement, and closing pans while opening swipes are disabled.
|
|
257
|
+
For the reference-recording revision it asserts the 80 percent travel, the
|
|
258
|
+
light and dark wash, the menu's final scale/opacity/layer, and that progress
|
|
259
|
+
events are opt-in, start in sync and end on the stable state; the wrapper tests
|
|
260
|
+
assert that progress stays off without a handler and during the mount commit,
|
|
261
|
+
that the handler, a replacement host and the color scheme reach native
|
|
262
|
+
unchanged, and that the menu slot is 80 percent wide. The iOS suite
|
|
263
|
+
`ios/tests/BottomTabsDrawerReduceMotionTests.swift` runs without an app host,
|
|
264
|
+
forcing Reduce Motion and supplying the fade snapshot through internal test
|
|
265
|
+
hooks. It asserts that a user close reports once, after the snapshot is gone;
|
|
266
|
+
that a drag taking over the fade drops the faded close and reports only its own
|
|
267
|
+
release; that a resize lands the fade at once; that same-target and newer
|
|
268
|
+
requests, disabling and detach take over or drop the pending report; and that
|
|
269
|
+
touches during an opening or closing fade land on the host, not on the menu,
|
|
270
|
+
page or dim under the snapshot.
|
|
271
|
+
Recorded evidence so far: on the iPhone 17 simulator (iOS 26) in the consumer
|
|
272
|
+
app, tap open/close timing, fling overshoot (about 2 points), smooth reversal,
|
|
273
|
+
the corner ramp, the reduced-motion cross-fade, the light/dark palettes and a
|
|
274
|
+
UI-thread Reanimated progress handler were compared frame by frame with the
|
|
275
|
+
reference recording. After the review fixes, the same setup showed menu content
|
|
276
|
+
reaching 20 points from the 80 percent edge, the header avatar hidden at full
|
|
277
|
+
open through the deferred progress event, no travel past open on a
|
|
278
|
+
reduced-motion fling, and three toggles within 120 ms under Reduce Motion
|
|
279
|
+
cross-fading to the final state with no leftover image (snapshot replacement
|
|
280
|
+
itself is source-verified). The Android suite has not yet been run for this revision;
|
|
281
|
+
physical-device smoothness on either platform remains unverified.
|
|
168
282
|
|
|
169
283
|
The standalone `example/react-native/pages/BottomTabsHomeDrawerExample.tsx`
|
|
170
284
|
reproduces Home’s wallet toolbar, balance/actions/banner shared header and
|
|
@@ -187,11 +301,44 @@ reselection never changes the selected page. A tab with `preventsDefault` emits
|
|
|
187
301
|
tab within the platform double-tap timeout (iOS 0.3 s; Android
|
|
188
302
|
`ViewConfiguration.getDoubleTapTimeout()`, 300 ms by default). Both presses still
|
|
189
303
|
emit `onPageSelected` first; the double press is an additional event, emitted
|
|
190
|
-
after the second press.
|
|
304
|
+
after the second press. A rejected pager top request with no accepted scroll
|
|
305
|
+
suppresses this additional event; both `onPageSelected` events still fire.
|
|
306
|
+
After the pair is handled, tracking resets, so a third quick press
|
|
191
307
|
starts a new pair. Double press is derived from accepted selections only: no
|
|
192
308
|
extra gesture recognizer is attached and single-press latency is unchanged.
|
|
193
309
|
JS-driven `selectedPage` changes do not count as presses.
|
|
194
310
|
|
|
311
|
+
Before `onTabDoublePress` is emitted, the selected tab's visible vertical
|
|
312
|
+
scrollers animate back to their top only when the pressed key matches the
|
|
313
|
+
selected scene. If `preventsDefault` leaves another tab selected, its scene
|
|
314
|
+
MUST remain untouched and `didScrollToTop` MUST be false. A prevented tab that
|
|
315
|
+
is already selected retains normal scroll-to-top behavior.
|
|
316
|
+
The event carries `didScrollToTop`: true only when at least one scroller was
|
|
317
|
+
away from its top and accepted the top request, false when all were already
|
|
318
|
+
there, so the host can decide what a double press at the top means. Rejection
|
|
319
|
+
MUST NOT be reported as success or as proof that the page is already at top.
|
|
320
|
+
On iOS, a standalone NativeList collection view delegates back to its direct
|
|
321
|
+
owner's `onekeyScrollToOffset:animated:` selector with offset zero and animation
|
|
322
|
+
enabled. This uses NativeList's existing explicit-command path to end an active
|
|
323
|
+
structural tail, invalidate stale scroll completions and own pending layout
|
|
324
|
+
before scrolling; BottomTabs MUST NOT also write that collection view's offset.
|
|
325
|
+
BottomTabs and NativeList native sources must ship together for this selector.
|
|
326
|
+
Scrollers inside a `CollapsiblePagerView` are never moved directly because the pager owns
|
|
327
|
+
their header state; the module calls the pager's own `tryScrollToTop` by name, as
|
|
328
|
+
it has no package dependency on the pager. A pager also counts as away from its
|
|
329
|
+
top when its `isAwayFromPageTop` reports a collapsed header over a body at top. Only visible scrollers count: hidden
|
|
330
|
+
tabs and off-screen pager pages are skipped. On iOS visibility is intersected
|
|
331
|
+
with the window and every clipping ancestor; a retained page fully clipped by
|
|
332
|
+
its pager MUST NOT count. On iOS a scroller must have content
|
|
333
|
+
taller than its viewport. Runtime verification: iOS 27 simulator (collapsible
|
|
334
|
+
pagers, pushed list pages, and a double press that also switches tabs). The
|
|
335
|
+
Android pressed-scene isolation regression passed on an API 36 emulator for
|
|
336
|
+
docked and floating bars; Android pager integration has not been run. The
|
|
337
|
+
Android pager lookup is reflective, so a minified release build still needs a run.
|
|
338
|
+
BottomTabs and Pager native sources must ship together for the acceptance-returning
|
|
339
|
+
entry point. Clipping-ancestor visibility and rejected-command event handling
|
|
340
|
+
are implemented in source; runtime acceptance for these cases remains pending.
|
|
341
|
+
|
|
195
342
|
Tab long press is not supported. The former `onTabLongPress` prop/event and the
|
|
196
343
|
native long-press recognizers were removed.
|
|
197
344
|
|
|
@@ -206,6 +353,36 @@ that delay, cancel, or require failure of the system tab bar gestures.
|
|
|
206
353
|
The previous drag-cancellation guard (which refused selection for any touch that
|
|
207
354
|
moved more than 10 points) was removed because it disabled drag-to-switch.
|
|
208
355
|
|
|
356
|
+
## iOS bottom tab bar hide and show transition
|
|
357
|
+
|
|
358
|
+
Status: implemented in module source and verified on iOS 27.0 Simulator XCTest.
|
|
359
|
+
|
|
360
|
+
When `tabBarHidden` changes dynamically while the container view is attached to a
|
|
361
|
+
window, laid out with nonzero bounds, and in `bottom` placement, `RCTBottomTabsContainerView`
|
|
362
|
+
animates `UITabBar.transform` vertically with a critically damped 0.28 s spring
|
|
363
|
+
(`usingSpringWithDamping: 1.0`, `.beginFromCurrentState`, `.curveEaseOut`,
|
|
364
|
+
`.allowUserInteraction`) by `max(tabBar.bounds.height, 62) + 12` points so the
|
|
365
|
+
floating Liquid Glass capsule slides smoothly off and back onto the bottom edge.
|
|
366
|
+
|
|
367
|
+
- **Immediate state & measurement:** `tabBar.isUserInteractionEnabled` and
|
|
368
|
+
`onTabBarMeasured` (`0` when hiding, `tabBar.bounds.height` when showing)
|
|
369
|
+
update immediately when `tabBarHidden` changes, without waiting for animation
|
|
370
|
+
completion.
|
|
371
|
+
- **Hide transition:** UIKit's system visibility (`setTabBarHidden(false, animated: false)`)
|
|
372
|
+
stays active while the bar slides down so layout passes triggered by concurrent
|
|
373
|
+
child navigation pushes do not snap `tabBar.alpha` to zero. When the slide-out
|
|
374
|
+
completes (and no newer `tabBarHidden` transition has superseded it), the view
|
|
375
|
+
resets `tabBar.transform = .identity` and applies `setTabBarHidden(true, animated: false)`
|
|
376
|
+
inside `UIView.performWithoutAnimation`.
|
|
377
|
+
- **Show transition & reversal:** showing unhides the system bar without animation,
|
|
378
|
+
seeds `tabBar.transform` at the downward offset when transitioning from a
|
|
379
|
+
settled hidden state (or preserves the in-flight transform on mid-transition
|
|
380
|
+
reversal), and animates back to `.identity`.
|
|
381
|
+
- **Non-animated cases:** initial setup, detached views (`window == nil`), zero-sized
|
|
382
|
+
containers, and `leading`/`trailing` vertical placements apply visibility
|
|
383
|
+
immediately without animation, strip active layer animations, and reset
|
|
384
|
+
`tabBar.transform` to `.identity`.
|
|
385
|
+
|
|
209
386
|
## Android tab bar style
|
|
210
387
|
|
|
211
388
|
`androidTabBarStyle` selects the Android presentation; iOS ignores it.
|
|
@@ -248,9 +425,23 @@ Floating interaction (single finger; motion splitting is disabled):
|
|
|
248
425
|
Release after a drag selects the candidate once, only if it differs from the
|
|
249
426
|
current tab. Cancel selects nothing.
|
|
250
427
|
4. The lens then settles back into the pill on the selected tab, which stays on
|
|
251
|
-
the old tab for cancelled or `preventsDefault` presses.
|
|
252
|
-
|
|
253
|
-
|
|
428
|
+
the old tab for cancelled or `preventsDefault` presses. When a stationary tap
|
|
429
|
+
releases while the indicator slide is still in flight, the lifted lens holds
|
|
430
|
+
briefly (proportional to the remaining slide fraction) before settling into
|
|
431
|
+
the resting pill as it arrives at the target tab.
|
|
432
|
+
|
|
433
|
+
Both press-initiated and JS-driven selection changes slide the pill with a
|
|
434
|
+
520 ms underdamped spring (`dampingRatio = 0.82`, `angularFrequency = 7.5`) and
|
|
435
|
+
frame-rate-normalized velocity stretch (16 ms reference step). An in-flight
|
|
436
|
+
slide animator already targeting the selected tab's X position is preserved
|
|
437
|
+
across touch release and subsequent JS `selectedPage` or `items` syncs instead
|
|
438
|
+
of being restarted or snapped.
|
|
439
|
+
When `tabBarHidden` changes dynamically while attached and laid out in `floating`
|
|
440
|
+
style, `BottomTabsView` animates `floatingBar.translationY` across its visible
|
|
441
|
+
bottom clearance (`DecelerateInterpolator`), preserving in-flight translation on
|
|
442
|
+
rapid reversals, keeping the live blur backdrop active while the bar slides off
|
|
443
|
+
screen, immediately reporting the updated measured height (`0` when hidden), and
|
|
444
|
+
setting `floatingBar.visibility = GONE` upon hide completion.
|
|
254
445
|
Switching style at runtime rebuilds the bar and restores Material's label sizes,
|
|
255
446
|
icon size, ripple, padding, and gravity when returning to `default`.
|
|
256
447
|
|
|
@@ -383,6 +574,13 @@ pages; release selects the nearest tab once; cancel restores; hidden bar, dark
|
|
|
383
574
|
mode, and 3-button navigation insets lay out correctly. Source compilation is
|
|
384
575
|
recorded separately from runtime acceptance.
|
|
385
576
|
|
|
577
|
+
`native-tests/android/BottomBlurTest.kt` includes
|
|
578
|
+
`testDoublePressOnlyScrollsThePressedScene`, inherited by the floating-style
|
|
579
|
+
suite. It covers a prevented press on another scene (no scroll, false), a
|
|
580
|
+
prevented press on the selected scene (scroll, true), and normal tab switching
|
|
581
|
+
followed by scroll-to-top, while preserving the other scene's offset. The same
|
|
582
|
+
cases remain required on iOS.
|
|
583
|
+
|
|
386
584
|
Vertical tab bar: `RCTBottomTabsContainerView.swift` (`currentTabBarPlacement`,
|
|
387
585
|
`updateTabBarPlacementAndSideAccessory`, `verticalTabBarPlatterFrame`).
|
|
388
586
|
Required iOS runtime cases on iPhone Duo: the outer display and landscape inner
|
|
@@ -144,7 +144,10 @@ static NSArray<NSDictionary *>* convertItemsToArray(const std::vector<RNBottomTa
|
|
|
144
144
|
if (!strongSelf) return;
|
|
145
145
|
auto emitter = std::static_pointer_cast<const RNBottomTabsViewEventEmitter>(strongSelf->_eventEmitter);
|
|
146
146
|
if (emitter) {
|
|
147
|
-
emitter->onTabDoublePress({
|
|
147
|
+
emitter->onTabDoublePress({
|
|
148
|
+
.key = std::string([[body objectForKey:@"key"] UTF8String] ?: ""),
|
|
149
|
+
.didScrollToTop = [[body objectForKey:@"didScrollToTop"] boolValue],
|
|
150
|
+
});
|
|
148
151
|
}
|
|
149
152
|
};
|
|
150
153
|
[_containerView setValue:onTabDoublePress forKey:@"onTabDoublePress"];
|