tamagui 1.79.7 → 1.79.8

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/dist/native.js CHANGED
@@ -10407,7 +10407,7 @@ var require_SheetScrollView_native = __commonJS({
10407
10407
  });
10408
10408
  module2.exports = __toCommonJS2(SheetScrollView_exports);
10409
10409
  var import_core13 = require_index_native15(), import_scroll_view = require_index_native33(), import_react2 = require("react"), import_SheetContext = require_SheetContext_native(), import_jsx_runtime6 = require("react/jsx-runtime"), SHEET_SCROLL_VIEW_NAME = "SheetScrollView", SheetScrollView = (0, import_react2.forwardRef)(
10410
- ({ __scopeSheet, children, ...props }, ref) => {
10410
+ ({ __scopeSheet, children, onScroll, ...props }, ref) => {
10411
10411
  let context = (0, import_SheetContext.useSheetContext)(SHEET_SCROLL_VIEW_NAME, __scopeSheet), { scrollBridge } = context, scrollRef = (0, import_react2.useRef)(null), state = (0, import_react2.useRef)({
10412
10412
  lastPageY: 0,
10413
10413
  dragAt: 0,
@@ -10437,7 +10437,7 @@ var require_SheetScrollView_native = __commonJS({
10437
10437
  scrollEventThrottle: 8,
10438
10438
  onScroll: (e) => {
10439
10439
  let { y } = e.nativeEvent.contentOffset;
10440
- scrollBridge.y = y, y > 0 && (scrollBridge.scrollStartY = -1);
10440
+ scrollBridge.y = y, y > 0 && (scrollBridge.scrollStartY = -1), onScroll == null || onScroll(e);
10441
10441
  },
10442
10442
  onStartShouldSetResponder: () => (scrollBridge.scrollStartY = -1, state.current.isDragging = !0, !0),
10443
10443
  onMoveShouldSetResponder: () => !1,
@@ -17230,8 +17230,8 @@ var require_SliderImpl_native = __commonJS({
17230
17230
  onStartShouldSetResponder: () => !0,
17231
17231
  onResponderTerminationRequest: () => !1,
17232
17232
  onResponderGrant: (0, import_core13.composeEventHandlers)(props.onResponderGrant, (event) => {
17233
- let target = event.target, isStartingOnThumb = context.thumbs.has(target);
17234
- import_core13.isWeb && target instanceof HTMLElement && context.thumbs.has(target) && target.focus(), onSlideStart(event, isStartingOnThumb ? "thumb" : "track");
17233
+ let target = event.target, thumbIndex = context.thumbs.get(target), isStartingOnThumb = thumbIndex !== void 0;
17234
+ import_core13.isWeb && target instanceof HTMLElement && context.thumbs.has(target) && target.focus(), !import_core13.isWeb && isStartingOnThumb && (context.valueIndexToChangeRef.current = thumbIndex), onSlideStart(event, isStartingOnThumb ? "thumb" : "track");
17235
17235
  }),
17236
17236
  onResponderMove: (0, import_core13.composeEventHandlers)(props.onResponderMove, (event) => {
17237
17237
  event.stopPropagation(), onSlideMove(event);
@@ -17518,10 +17518,10 @@ var require_Slider_native = __commonJS({
17518
17518
  ), value = context.values[index], percent = value === void 0 ? 0 : (0, import_helpers2.convertValueToPercentage)(value, context.min, context.max), label = (0, import_helpers2.getLabel)(index, context.values.length), sizeIn = sizeProp ?? context.size ?? "$true", [size2, setSize] = React2.useState(() => (0, import_core13.getVariableValue)(getThumbSize(sizeIn).width)), thumbInBoundsOffset = size2 ? (0, import_helpers2.getThumbInBoundsOffset)(size2, percent, orientation.direction) : 0;
17519
17519
  React2.useEffect(() => {
17520
17520
  if (thumb)
17521
- return context.thumbs.add(thumb), () => {
17521
+ return context.thumbs.set(thumb, index), () => {
17522
17522
  context.thumbs.delete(thumb);
17523
17523
  };
17524
- }, [thumb, context.thumbs]);
17524
+ }, [thumb, context.thumbs, index]);
17525
17525
  let positionalStyles = context.orientation === "horizontal" ? {
17526
17526
  x: thumbInBoundsOffset - size2 / 2,
17527
17527
  y: -size2 / 2,
@@ -17584,13 +17584,12 @@ var require_Slider_native = __commonJS({
17584
17584
  onSlideMove,
17585
17585
  onSlideStart,
17586
17586
  ...sliderProps
17587
- } = props, sliderRef = React2.useRef(null), composedRefs = (0, import_compose_refs.useComposedRefs)(sliderRef, forwardedRef), thumbRefs = React2.useRef(/* @__PURE__ */ new Set()), valueIndexToChangeRef = React2.useRef(0), isHorizontal = orientation === "horizontal", [values = [], setValues] = (0, import_use_controllable_state.useControllableState)({
17587
+ } = props, sliderRef = React2.useRef(null), composedRefs = (0, import_compose_refs.useComposedRefs)(sliderRef, forwardedRef), thumbRefs = React2.useRef(/* @__PURE__ */ new Map()), valueIndexToChangeRef = React2.useRef(0), isHorizontal = orientation === "horizontal", [values = [], setValues] = (0, import_use_controllable_state.useControllableState)({
17588
17588
  prop: value,
17589
17589
  defaultProp: defaultValue,
17590
17590
  transition: !0,
17591
17591
  onChange: (value2) => {
17592
- var _a;
17593
- import_core13.isWeb && ((_a = [...thumbRefs.current][valueIndexToChangeRef.current]) == null || _a.focus()), onValueChange(value2);
17592
+ updateThumbFocus(valueIndexToChangeRef.current), onValueChange(value2);
17594
17593
  }
17595
17594
  });
17596
17595
  import_core13.isWeb && React2.useEffect(() => {
@@ -17604,6 +17603,15 @@ var require_Slider_native = __commonJS({
17604
17603
  node.removeEventListener("touchstart", preventDefault);
17605
17604
  };
17606
17605
  }, []);
17606
+ function updateThumbFocus(focusIndex) {
17607
+ if (import_core13.isWeb) {
17608
+ for (let [node, index] of thumbRefs.current.entries())
17609
+ if (index === focusIndex) {
17610
+ node.focus();
17611
+ return;
17612
+ }
17613
+ }
17614
+ }
17607
17615
  function handleSlideMove(value2, event) {
17608
17616
  updateValues(value2, valueIndexToChangeRef.current), onSlideMove == null || onSlideMove(event, value2);
17609
17617
  }