@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.
Files changed (68) hide show
  1. package/docs/bottom-sheet.mdx +1 -0
  2. package/docs/media-flight.mdx +15 -6
  3. package/lib/commonjs/bottom-sheet/BottomSheetBase.js +4 -0
  4. package/lib/commonjs/bottom-sheet/BottomSheetBase.js.map +1 -1
  5. package/lib/commonjs/media-flight/MediaSurface.js +51 -10
  6. package/lib/commonjs/media-flight/MediaSurface.js.map +1 -1
  7. package/lib/commonjs/media-flight/constants.js +32 -7
  8. package/lib/commonjs/media-flight/constants.js.map +1 -1
  9. package/lib/commonjs/tab-bar/TabBarBase.js +34 -6
  10. package/lib/commonjs/tab-bar/TabBarBase.js.map +1 -1
  11. package/lib/commonjs/theme/color-scope/ColorScope.js +42 -12
  12. package/lib/commonjs/theme/color-scope/ColorScope.js.map +1 -1
  13. package/lib/commonjs/theme/color-scope/ColorScope.web.js +2 -8
  14. package/lib/commonjs/theme/color-scope/ColorScope.web.js.map +1 -1
  15. package/lib/module/bottom-sheet/BottomSheetBase.js +5 -1
  16. package/lib/module/bottom-sheet/BottomSheetBase.js.map +1 -1
  17. package/lib/module/media-flight/MediaSurface.js +52 -11
  18. package/lib/module/media-flight/MediaSurface.js.map +1 -1
  19. package/lib/module/media-flight/constants.js +31 -6
  20. package/lib/module/media-flight/constants.js.map +1 -1
  21. package/lib/module/tab-bar/TabBarBase.js +35 -7
  22. package/lib/module/tab-bar/TabBarBase.js.map +1 -1
  23. package/lib/module/theme/color-scope/ColorScope.js +45 -13
  24. package/lib/module/theme/color-scope/ColorScope.js.map +1 -1
  25. package/lib/module/theme/color-scope/ColorScope.web.js +3 -9
  26. package/lib/module/theme/color-scope/ColorScope.web.js.map +1 -1
  27. package/lib/typescript/commonjs/bottom-sheet/BottomSheetBase.d.ts.map +1 -1
  28. package/lib/typescript/commonjs/bottom-sheet/types.d.ts +6 -0
  29. package/lib/typescript/commonjs/bottom-sheet/types.d.ts.map +1 -1
  30. package/lib/typescript/commonjs/media-flight/MediaSurface.d.ts.map +1 -1
  31. package/lib/typescript/commonjs/media-flight/constants.d.ts +30 -6
  32. package/lib/typescript/commonjs/media-flight/constants.d.ts.map +1 -1
  33. package/lib/typescript/commonjs/media-flight/types.d.ts +7 -2
  34. package/lib/typescript/commonjs/media-flight/types.d.ts.map +1 -1
  35. package/lib/typescript/commonjs/tab-bar/TabBarBase.d.ts.map +1 -1
  36. package/lib/typescript/commonjs/theme/color-scope/ColorScope.d.ts +36 -2
  37. package/lib/typescript/commonjs/theme/color-scope/ColorScope.d.ts.map +1 -1
  38. package/lib/typescript/commonjs/theme/color-scope/ColorScope.web.d.ts +6 -2
  39. package/lib/typescript/commonjs/theme/color-scope/ColorScope.web.d.ts.map +1 -1
  40. package/lib/typescript/module/bottom-sheet/BottomSheetBase.d.ts.map +1 -1
  41. package/lib/typescript/module/bottom-sheet/types.d.ts +6 -0
  42. package/lib/typescript/module/bottom-sheet/types.d.ts.map +1 -1
  43. package/lib/typescript/module/media-flight/MediaSurface.d.ts.map +1 -1
  44. package/lib/typescript/module/media-flight/constants.d.ts +30 -6
  45. package/lib/typescript/module/media-flight/constants.d.ts.map +1 -1
  46. package/lib/typescript/module/media-flight/types.d.ts +7 -2
  47. package/lib/typescript/module/media-flight/types.d.ts.map +1 -1
  48. package/lib/typescript/module/tab-bar/TabBarBase.d.ts.map +1 -1
  49. package/lib/typescript/module/theme/color-scope/ColorScope.d.ts +36 -2
  50. package/lib/typescript/module/theme/color-scope/ColorScope.d.ts.map +1 -1
  51. package/lib/typescript/module/theme/color-scope/ColorScope.web.d.ts +6 -2
  52. package/lib/typescript/module/theme/color-scope/ColorScope.web.d.ts.map +1 -1
  53. package/package.json +1 -1
  54. package/src/__tests__/support/collision-fixture-barrel.ts +20 -0
  55. package/src/__tests__/support/constructed-style-sheets.ts +68 -0
  56. package/src/__tests__/support/press-host.ts +30 -0
  57. package/src/__tests__/support/rendered-style.ts +99 -0
  58. package/src/__tests__/support/unread-hook-fixture.ts +33 -0
  59. package/src/bottom-sheet/BottomSheetBase.tsx +13 -0
  60. package/src/bottom-sheet/types.ts +6 -0
  61. package/src/media-flight/MediaSurface.tsx +60 -14
  62. package/src/media-flight/constants.ts +31 -6
  63. package/src/media-flight/types.ts +7 -2
  64. package/src/tab-bar/TabBarBase.tsx +41 -7
  65. package/src/theme/__tests__/__fixtures__/golden-resolved-tokens.json +7682 -0
  66. package/src/theme/__tests__/fixtures/color-engine-golden.json +1 -0
  67. package/src/theme/color-scope/ColorScope.tsx +53 -12
  68. 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 { Pressable, StyleSheet, useWindowDimensions, View, type ViewStyle } from 'react-native';
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 — the detector consumes the bar's touches, so the inner
264
- // Pressables never receive them.
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 trigger's own
658
- // `onPress` below performs the navigation, so reporting the selection
659
- // here as well would navigate twice.
660
- if (isFocused === undefined) bar?.selectIndex(index);
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