@oxyhq/bloom 1.14.0 → 1.14.2
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/bottom-sheet.mdx +1 -0
- package/docs/media-flight.mdx +15 -6
- package/lib/commonjs/bottom-sheet/BottomSheetBase.js +4 -0
- package/lib/commonjs/bottom-sheet/BottomSheetBase.js.map +1 -1
- package/lib/commonjs/media-flight/MediaSurface.js +51 -10
- package/lib/commonjs/media-flight/MediaSurface.js.map +1 -1
- package/lib/commonjs/media-flight/constants.js +32 -7
- package/lib/commonjs/media-flight/constants.js.map +1 -1
- package/lib/commonjs/tab-bar/TabBarBase.js +34 -6
- package/lib/commonjs/tab-bar/TabBarBase.js.map +1 -1
- package/lib/commonjs/theme/color-scope/ColorScope.js +42 -12
- package/lib/commonjs/theme/color-scope/ColorScope.js.map +1 -1
- package/lib/commonjs/theme/color-scope/ColorScope.web.js +2 -8
- package/lib/commonjs/theme/color-scope/ColorScope.web.js.map +1 -1
- package/lib/module/bottom-sheet/BottomSheetBase.js +5 -1
- package/lib/module/bottom-sheet/BottomSheetBase.js.map +1 -1
- package/lib/module/media-flight/MediaSurface.js +52 -11
- package/lib/module/media-flight/MediaSurface.js.map +1 -1
- package/lib/module/media-flight/constants.js +31 -6
- package/lib/module/media-flight/constants.js.map +1 -1
- package/lib/module/tab-bar/TabBarBase.js +35 -7
- package/lib/module/tab-bar/TabBarBase.js.map +1 -1
- package/lib/module/theme/color-scope/ColorScope.js +45 -13
- package/lib/module/theme/color-scope/ColorScope.js.map +1 -1
- package/lib/module/theme/color-scope/ColorScope.web.js +3 -9
- package/lib/module/theme/color-scope/ColorScope.web.js.map +1 -1
- package/lib/typescript/commonjs/bottom-sheet/BottomSheetBase.d.ts.map +1 -1
- package/lib/typescript/commonjs/bottom-sheet/types.d.ts +6 -0
- package/lib/typescript/commonjs/bottom-sheet/types.d.ts.map +1 -1
- package/lib/typescript/commonjs/media-flight/MediaSurface.d.ts.map +1 -1
- package/lib/typescript/commonjs/media-flight/constants.d.ts +30 -6
- package/lib/typescript/commonjs/media-flight/constants.d.ts.map +1 -1
- package/lib/typescript/commonjs/media-flight/types.d.ts +7 -2
- package/lib/typescript/commonjs/media-flight/types.d.ts.map +1 -1
- package/lib/typescript/commonjs/tab-bar/TabBarBase.d.ts.map +1 -1
- package/lib/typescript/commonjs/theme/color-scope/ColorScope.d.ts +36 -2
- package/lib/typescript/commonjs/theme/color-scope/ColorScope.d.ts.map +1 -1
- package/lib/typescript/commonjs/theme/color-scope/ColorScope.web.d.ts +6 -2
- package/lib/typescript/commonjs/theme/color-scope/ColorScope.web.d.ts.map +1 -1
- package/lib/typescript/module/bottom-sheet/BottomSheetBase.d.ts.map +1 -1
- package/lib/typescript/module/bottom-sheet/types.d.ts +6 -0
- package/lib/typescript/module/bottom-sheet/types.d.ts.map +1 -1
- package/lib/typescript/module/media-flight/MediaSurface.d.ts.map +1 -1
- package/lib/typescript/module/media-flight/constants.d.ts +30 -6
- package/lib/typescript/module/media-flight/constants.d.ts.map +1 -1
- package/lib/typescript/module/media-flight/types.d.ts +7 -2
- package/lib/typescript/module/media-flight/types.d.ts.map +1 -1
- package/lib/typescript/module/tab-bar/TabBarBase.d.ts.map +1 -1
- package/lib/typescript/module/theme/color-scope/ColorScope.d.ts +36 -2
- package/lib/typescript/module/theme/color-scope/ColorScope.d.ts.map +1 -1
- package/lib/typescript/module/theme/color-scope/ColorScope.web.d.ts +6 -2
- package/lib/typescript/module/theme/color-scope/ColorScope.web.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/__tests__/support/collision-fixture-barrel.ts +20 -0
- package/src/__tests__/support/constructed-style-sheets.ts +68 -0
- package/src/__tests__/support/press-host.ts +30 -0
- package/src/__tests__/support/rendered-style.ts +99 -0
- package/src/__tests__/support/unread-hook-fixture.ts +33 -0
- package/src/bottom-sheet/BottomSheetBase.tsx +13 -0
- package/src/bottom-sheet/types.ts +6 -0
- package/src/media-flight/MediaSurface.tsx +60 -14
- package/src/media-flight/constants.ts +31 -6
- package/src/media-flight/types.ts +7 -2
- package/src/tab-bar/TabBarBase.tsx +41 -7
- package/src/theme/__tests__/__fixtures__/golden-resolved-tokens.json +7682 -0
- package/src/theme/__tests__/fixtures/color-engine-golden.json +1 -0
- package/src/theme/color-scope/ColorScope.tsx +53 -12
- package/src/theme/color-scope/ColorScope.web.tsx +10 -8
|
@@ -22,7 +22,14 @@ import {
|
|
|
22
22
|
useMemo,
|
|
23
23
|
type ComponentType,
|
|
24
24
|
} from 'react';
|
|
25
|
-
import {
|
|
25
|
+
import {
|
|
26
|
+
Platform,
|
|
27
|
+
Pressable,
|
|
28
|
+
StyleSheet,
|
|
29
|
+
useWindowDimensions,
|
|
30
|
+
View,
|
|
31
|
+
type ViewStyle,
|
|
32
|
+
} from 'react-native';
|
|
26
33
|
import { Gesture, GestureDetector } from 'react-native-gesture-handler';
|
|
27
34
|
import Animated, {
|
|
28
35
|
Extrapolation,
|
|
@@ -260,8 +267,14 @@ function TabBarBody({
|
|
|
260
267
|
// Scrubbing: the highlight tracks the finger 1:1 while dragging (no spring —
|
|
261
268
|
// it must feel attached), haptic ticks fire on boundary crossings, and
|
|
262
269
|
// navigation happens only on release. Taps are handled by a Tap gesture
|
|
263
|
-
// racing the pan
|
|
264
|
-
//
|
|
270
|
+
// racing the pan.
|
|
271
|
+
//
|
|
272
|
+
// THE DETECTOR DOES NOT CONSUME THE PRESS, which this file assumed for a long
|
|
273
|
+
// time. A `Tap` gesture activates on RELEASE, by which point the inner
|
|
274
|
+
// `Pressable` has already fired `onPress`, and RNGH's cancellation of the RN
|
|
275
|
+
// responder comes too late to stop it. Measured on a Pixel 10 Pro: ONE tap
|
|
276
|
+
// produced both, ~600ms apart on a busy JS thread, so every consumer got two
|
|
277
|
+
// selections per tap. `TabBarButtonBody` is where that is resolved.
|
|
265
278
|
const gesture = useMemo(() => {
|
|
266
279
|
const indexAtX = (x: number, minimizedValue: number) => {
|
|
267
280
|
'worklet';
|
|
@@ -544,6 +557,9 @@ interface TabBarButtonBodyProps extends TabBarButtonProps {
|
|
|
544
557
|
}
|
|
545
558
|
|
|
546
559
|
/** One tab trigger: icon + label that fades out when the bar minimizes. */
|
|
560
|
+
/** Stable identity: a new array each render would re-send the actions to the OS. */
|
|
561
|
+
const ACTIVATE_ACTIONS = [{ name: 'activate' as const }];
|
|
562
|
+
|
|
547
563
|
function TabBarButtonBody({
|
|
548
564
|
Glyph,
|
|
549
565
|
item,
|
|
@@ -639,6 +655,15 @@ function TabBarButtonBody({
|
|
|
639
655
|
aria-selected={focused}
|
|
640
656
|
accessibilityLabel={item.label}
|
|
641
657
|
{...pressableProps}
|
|
658
|
+
// ASSISTIVE TECHNOLOGY, on native, is the one activation the bar's gesture
|
|
659
|
+
// cannot see: TalkBack and VoiceOver activate a view without ever
|
|
660
|
+
// producing a touch, so the `Tap` gesture never runs and the selection has
|
|
661
|
+
// to come from here.
|
|
662
|
+
accessibilityActions={ACTIVATE_ACTIONS}
|
|
663
|
+
onAccessibilityAction={(event) => {
|
|
664
|
+
if (event.nativeEvent.actionName !== 'activate') return;
|
|
665
|
+
if (isFocused === undefined) bar?.selectIndex(index);
|
|
666
|
+
}}
|
|
642
667
|
onPress={(event) => {
|
|
643
668
|
// The bar's GestureDetector normally consumes touches; this still fires
|
|
644
669
|
// for assistive-technology activation (VoiceOver) and keyboard focus.
|
|
@@ -654,10 +679,19 @@ function TabBarButtonBody({
|
|
|
654
679
|
bar.highlightOpacity.value = withTiming(1, HIGHLIGHT_FADE);
|
|
655
680
|
}
|
|
656
681
|
setMinimized(minimized, 0);
|
|
657
|
-
// Controlled path only. On the focus-driven path the
|
|
658
|
-
// `onPress` below performs the navigation, so reporting
|
|
659
|
-
// here as well would navigate twice.
|
|
660
|
-
|
|
682
|
+
// Controlled path only, and NOT on Android. On the focus-driven path the
|
|
683
|
+
// trigger's own `onPress` below performs the navigation, so reporting
|
|
684
|
+
// the selection here as well would navigate twice.
|
|
685
|
+
//
|
|
686
|
+
// ANDROID IS THE ONE PLATFORM THAT DOUBLES. RNGH sets
|
|
687
|
+
// `cancelsTouchesInView` on iOS, so a recognised tap cancels this press
|
|
688
|
+
// and the gesture above is the only reporter there; react-native-web
|
|
689
|
+
// likewise routes a keyboard Enter or Space through this press and
|
|
690
|
+
// nothing else. Android cancels nothing — measured on a Pixel 10 Pro,
|
|
691
|
+
// one tap produced `PRESSABLE selectIndex(1)` AND `GESTURE tap
|
|
692
|
+
// selectIndex(1)` ~600ms apart on a busy JS thread — so there, and only
|
|
693
|
+
// there, this press stands down.
|
|
694
|
+
if (isFocused === undefined && Platform.OS !== 'android') bar?.selectIndex(index);
|
|
661
695
|
onPress?.(event);
|
|
662
696
|
}}
|
|
663
697
|
// `Pressable`'s `style` also accepts a function of the press state; both
|