@webority-technologies/mobile 0.0.8 → 0.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.
Files changed (69) hide show
  1. package/lib/commonjs/components/Accordion/Accordion.js +3 -3
  2. package/lib/commonjs/components/Avatar/Avatar.js +1 -1
  3. package/lib/commonjs/components/Badge/Badge.js +1 -1
  4. package/lib/commonjs/components/Banner/Banner.js +2 -2
  5. package/lib/commonjs/components/BottomNavigation/BottomNavigation.js +1 -1
  6. package/lib/commonjs/components/Carousel/Carousel.js +2 -2
  7. package/lib/commonjs/components/Checkbox/Checkbox.js +1 -1
  8. package/lib/commonjs/components/DatePicker/DatePicker.js +8 -8
  9. package/lib/commonjs/components/DateRangePicker/DateRangePicker.js +4 -4
  10. package/lib/commonjs/components/FloatingActionButton/FloatingActionButton.js +2 -2
  11. package/lib/commonjs/components/FormField/FormField.js +1 -1
  12. package/lib/commonjs/components/Input/Input.js +15 -7
  13. package/lib/commonjs/components/Modal/Modal.js +4 -4
  14. package/lib/commonjs/components/OTPInput/OTPInput.js +1 -1
  15. package/lib/commonjs/components/ProgressBar/ProgressBar.js +2 -2
  16. package/lib/commonjs/components/Radio/Radio.js +1 -1
  17. package/lib/commonjs/components/SearchBar/SearchBar.js +1 -1
  18. package/lib/commonjs/components/SegmentedControl/SegmentedControl.js +2 -2
  19. package/lib/commonjs/components/Select/Select.js +3 -3
  20. package/lib/commonjs/components/Skeleton/Skeleton.js +1 -1
  21. package/lib/commonjs/components/Slider/Slider.js +6 -6
  22. package/lib/commonjs/components/Spinner/Spinner.js +2 -2
  23. package/lib/commonjs/components/Stepper/Stepper.js +3 -3
  24. package/lib/commonjs/components/Switch/Switch.js +3 -3
  25. package/lib/commonjs/components/Tabs/Tabs.js +2 -2
  26. package/lib/commonjs/components/TimePicker/TimePicker.js +3 -3
  27. package/lib/commonjs/components/Toast/Toast.js +3 -3
  28. package/lib/commonjs/components/Tooltip/Tooltip.js +2 -2
  29. package/lib/commonjs/theme/animatedValue.js +28 -0
  30. package/lib/commonjs/theme/index.js +7 -0
  31. package/lib/module/components/Accordion/Accordion.js +4 -4
  32. package/lib/module/components/Avatar/Avatar.js +2 -2
  33. package/lib/module/components/Badge/Badge.js +2 -2
  34. package/lib/module/components/Banner/Banner.js +3 -3
  35. package/lib/module/components/BottomNavigation/BottomNavigation.js +2 -2
  36. package/lib/module/components/Carousel/Carousel.js +3 -3
  37. package/lib/module/components/Checkbox/Checkbox.js +2 -2
  38. package/lib/module/components/DatePicker/DatePicker.js +9 -9
  39. package/lib/module/components/DateRangePicker/DateRangePicker.js +5 -5
  40. package/lib/module/components/FloatingActionButton/FloatingActionButton.js +3 -3
  41. package/lib/module/components/FormField/FormField.js +2 -2
  42. package/lib/module/components/Input/Input.js +16 -8
  43. package/lib/module/components/Modal/Modal.js +5 -5
  44. package/lib/module/components/OTPInput/OTPInput.js +2 -2
  45. package/lib/module/components/ProgressBar/ProgressBar.js +3 -3
  46. package/lib/module/components/Radio/Radio.js +2 -2
  47. package/lib/module/components/SearchBar/SearchBar.js +2 -2
  48. package/lib/module/components/SegmentedControl/SegmentedControl.js +3 -3
  49. package/lib/module/components/Select/Select.js +4 -4
  50. package/lib/module/components/Skeleton/Skeleton.js +2 -2
  51. package/lib/module/components/Slider/Slider.js +7 -7
  52. package/lib/module/components/Spinner/Spinner.js +3 -3
  53. package/lib/module/components/Stepper/Stepper.js +4 -4
  54. package/lib/module/components/Switch/Switch.js +4 -4
  55. package/lib/module/components/Tabs/Tabs.js +3 -3
  56. package/lib/module/components/TimePicker/TimePicker.js +4 -4
  57. package/lib/module/components/Toast/Toast.js +4 -4
  58. package/lib/module/components/Tooltip/Tooltip.js +3 -3
  59. package/lib/module/theme/animatedValue.js +24 -0
  60. package/lib/module/theme/index.js +1 -0
  61. package/lib/typescript/commonjs/components/Input/Input.d.ts +10 -0
  62. package/lib/typescript/commonjs/theme/animatedValue.d.ts +21 -0
  63. package/lib/typescript/commonjs/theme/index.d.ts +1 -0
  64. package/lib/typescript/commonjs/theme/types.d.ts +7 -1
  65. package/lib/typescript/module/components/Input/Input.d.ts +10 -0
  66. package/lib/typescript/module/theme/animatedValue.d.ts +21 -0
  67. package/lib/typescript/module/theme/index.d.ts +1 -0
  68. package/lib/typescript/module/theme/types.d.ts +7 -1
  69. package/package.json +1 -1
@@ -104,9 +104,9 @@ const Accordion = props => {
104
104
  const groupExpanded = group && id ? group.isExpanded(id) : null;
105
105
  const expanded = groupExpanded !== null ? groupExpanded : isControlled ? !!expandedProp : internalExpanded;
106
106
  const [measuredHeight, setMeasuredHeight] = (0, _react.useState)(null);
107
- const heightAnim = (0, _react.useRef)(new _reactNative.Animated.Value(expanded ? 1 : 0)).current;
108
- const opacityAnim = (0, _react.useRef)(new _reactNative.Animated.Value(expanded ? 1 : 0)).current;
109
- const rotateAnim = (0, _react.useRef)(new _reactNative.Animated.Value(expanded ? 1 : 0)).current;
107
+ const heightAnim = (0, _react.useRef)((0, _index.createAnimatedValue)(expanded ? 1 : 0)).current;
108
+ const opacityAnim = (0, _react.useRef)((0, _index.createAnimatedValue)(expanded ? 1 : 0)).current;
109
+ const rotateAnim = (0, _react.useRef)((0, _index.createAnimatedValue)(expanded ? 1 : 0)).current;
110
110
  const lastExpandedRef = (0, _react.useRef)(expanded);
111
111
  (0, _react.useEffect)(() => {
112
112
  // Skip animation when state matches the previous value (e.g. on mount).
@@ -181,7 +181,7 @@ const AvatarGroupItem = ({
181
181
  borderWidth,
182
182
  children
183
183
  }) => {
184
- const opacity = (0, _react.useRef)(new _reactNative.Animated.Value(0)).current;
184
+ const opacity = (0, _react.useRef)((0, _index.createAnimatedValue)(0)).current;
185
185
  (0, _react.useEffect)(() => {
186
186
  _reactNative.Animated.timing(opacity, {
187
187
  toValue: 1,
@@ -128,7 +128,7 @@ const Badge = exports.Badge = /*#__PURE__*/(0, _react.forwardRef)((props, ref) =
128
128
  const badgeAnchorOffset = theme.components.badge?.anchorOffset ?? 4;
129
129
  const formatted = variant === 'dot' ? null : formatValue(value, max);
130
130
  const shouldRender = !invisible && (variant === 'dot' || formatted !== null);
131
- const pulseScale = (0, _react.useRef)(new _reactNative.Animated.Value(1)).current;
131
+ const pulseScale = (0, _react.useRef)((0, _index.createAnimatedValue)(1)).current;
132
132
  (0, _react.useEffect)(() => {
133
133
  if (!pulse || !shouldRender) {
134
134
  pulseScale.setValue(1);
@@ -29,8 +29,8 @@ const Banner = exports.Banner = /*#__PURE__*/(0, _react.forwardRef)((props, ref)
29
29
  const theme = (0, _index.useTheme)();
30
30
  const styles = (0, _react.useMemo)(() => buildStyles(theme), [theme]);
31
31
  const tint = (0, _react.useMemo)(() => tintFor(theme, variant), [theme, variant]);
32
- const translateY = (0, _react.useRef)(new _reactNative.Animated.Value(animateMount && visible ? -20 : 0)).current;
33
- const opacity = (0, _react.useRef)(new _reactNative.Animated.Value(animateMount && visible ? 0 : visible ? 1 : 0)).current;
32
+ const translateY = (0, _react.useRef)((0, _index.createAnimatedValue)(animateMount && visible ? -20 : 0)).current;
33
+ const opacity = (0, _react.useRef)((0, _index.createAnimatedValue)(animateMount && visible ? 0 : visible ? 1 : 0)).current;
34
34
  const [mounted, setMounted] = (0, _react.useState)(visible);
35
35
  const isFirstRun = (0, _react.useRef)(true);
36
36
  (0, _react.useEffect)(() => {
@@ -63,7 +63,7 @@ const BottomNavigation = exports.BottomNavigation = /*#__PURE__*/(0, _react.forw
63
63
  const styles = (0, _react.useMemo)(() => buildStyles(theme), [theme]);
64
64
  const activeIndex = Math.max(0, tabs.findIndex(tab => tab.key === activeTab));
65
65
  const [tabWidth, setTabWidth] = _react.default.useState(0);
66
- const indicatorTranslateX = (0, _react.useRef)(new _reactNative.Animated.Value(0)).current;
66
+ const indicatorTranslateX = (0, _react.useRef)((0, _index.createAnimatedValue)(0)).current;
67
67
  const iconScales = (0, _react.useRef)({});
68
68
 
69
69
  // Ensure each tab has a persistent scale value
@@ -65,7 +65,7 @@ const CarouselInner = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
65
65
  const resolvedItemWidth = itemWidth === 'screen' ? containerWidth : itemWidth;
66
66
  const slideStride = resolvedItemWidth + spacing;
67
67
  const flatListRef = (0, _react.useRef)(null);
68
- const scrollX = (0, _react.useRef)(new _reactNative.Animated.Value(0)).current;
68
+ const scrollX = (0, _react.useRef)((0, _index.createAnimatedValue)(0)).current;
69
69
  const initialIndex = clamp(isControlled ? controlledIndex : defaultIndex, 0, Math.max(0, data.length - 1));
70
70
  const [currentIndex, setCurrentIndex] = (0, _react.useState)(initialIndex);
71
71
 
@@ -386,7 +386,7 @@ const ThumbnailItem = ({
386
386
  onPress,
387
387
  theme
388
388
  }) => {
389
- const scale = (0, _react.useRef)(new _reactNative.Animated.Value(isActive ? 1.1 : 1)).current;
389
+ const scale = (0, _react.useRef)((0, _index.createAnimatedValue)(isActive ? 1.1 : 1)).current;
390
390
  (0, _react.useEffect)(() => {
391
391
  _reactNative.Animated.spring(scale, {
392
392
  toValue: isActive ? 1.1 : 1,
@@ -51,7 +51,7 @@ const Checkbox = exports.Checkbox = /*#__PURE__*/(0, _react.forwardRef)((props,
51
51
  const checkboxLabelGap = theme.components.checkbox?.labelGap ?? 10;
52
52
  const fillColor = toneColor(theme, tone);
53
53
  const isActive = checked || indeterminate;
54
- const progress = (0, _react.useRef)(new _reactNative.Animated.Value(isActive ? 1 : 0)).current;
54
+ const progress = (0, _react.useRef)((0, _index.createAnimatedValue)(isActive ? 1 : 0)).current;
55
55
  (0, _react.useEffect)(() => {
56
56
  _reactNative.Animated.spring(progress, {
57
57
  toValue: isActive ? 1 : 0,
@@ -111,14 +111,14 @@ const DatePicker = props => {
111
111
  const [viewMode, setViewMode] = (0, _react.useState)('days');
112
112
 
113
113
  // Animations
114
- const backdrop = (0, _react.useRef)(new _reactNative.Animated.Value(0)).current;
115
- const sheet = (0, _react.useRef)(new _reactNative.Animated.Value(0)).current;
116
- const monthSlide = (0, _react.useRef)(new _reactNative.Animated.Value(0)).current;
117
- const monthFade = (0, _react.useRef)(new _reactNative.Animated.Value(1)).current;
118
- const selectScale = (0, _react.useRef)(new _reactNative.Animated.Value(1)).current;
119
- const viewFade = (0, _react.useRef)(new _reactNative.Animated.Value(1)).current;
120
- const viewScale = (0, _react.useRef)(new _reactNative.Animated.Value(1)).current;
121
- const headerScale = (0, _react.useRef)(new _reactNative.Animated.Value(1)).current;
114
+ const backdrop = (0, _react.useRef)((0, _index.createAnimatedValue)(0)).current;
115
+ const sheet = (0, _react.useRef)((0, _index.createAnimatedValue)(0)).current;
116
+ const monthSlide = (0, _react.useRef)((0, _index.createAnimatedValue)(0)).current;
117
+ const monthFade = (0, _react.useRef)((0, _index.createAnimatedValue)(1)).current;
118
+ const selectScale = (0, _react.useRef)((0, _index.createAnimatedValue)(1)).current;
119
+ const viewFade = (0, _react.useRef)((0, _index.createAnimatedValue)(1)).current;
120
+ const viewScale = (0, _react.useRef)((0, _index.createAnimatedValue)(1)).current;
121
+ const headerScale = (0, _react.useRef)((0, _index.createAnimatedValue)(1)).current;
122
122
 
123
123
  // Sync anchor / pending when value prop changes.
124
124
  (0, _react.useEffect)(() => {
@@ -96,10 +96,10 @@ const DateRangePicker = exports.DateRangePicker = /*#__PURE__*/(0, _react.forwar
96
96
  const [pendingEnd, setPendingEnd] = (0, _react.useState)(value.end ? startOfDay(value.end) : null);
97
97
 
98
98
  // Animations
99
- const backdrop = (0, _react.useRef)(new _reactNative.Animated.Value(0)).current;
100
- const sheet = (0, _react.useRef)(new _reactNative.Animated.Value(0)).current;
101
- const monthSlide = (0, _react.useRef)(new _reactNative.Animated.Value(0)).current;
102
- const monthFade = (0, _react.useRef)(new _reactNative.Animated.Value(1)).current;
99
+ const backdrop = (0, _react.useRef)((0, _index.createAnimatedValue)(0)).current;
100
+ const sheet = (0, _react.useRef)((0, _index.createAnimatedValue)(0)).current;
101
+ const monthSlide = (0, _react.useRef)((0, _index.createAnimatedValue)(0)).current;
102
+ const monthFade = (0, _react.useRef)((0, _index.createAnimatedValue)(1)).current;
103
103
 
104
104
  // Sync external value -> pending state when it changes.
105
105
  (0, _react.useEffect)(() => {
@@ -83,7 +83,7 @@ const FloatingActionButton = exports.FloatingActionButton = /*#__PURE__*/(0, _re
83
83
  } = (0, _usePressAnimation.usePressAnimation)({
84
84
  enabled: !disabled
85
85
  });
86
- const hideAnim = (0, _react.useRef)(new _reactNative.Animated.Value(0)).current;
86
+ const hideAnim = (0, _react.useRef)((0, _index.createAnimatedValue)(0)).current;
87
87
  (0, _react.useEffect)(() => {
88
88
  if (!hideOnScroll) {
89
89
  hideAnim.setValue(0);
@@ -239,7 +239,7 @@ const FloatingActionButtonGroup = props => {
239
239
  const isOpen = isControlled ? controlledOpen : internalOpen;
240
240
 
241
241
  // Animation drivers
242
- const progress = (0, _react.useRef)(new _reactNative.Animated.Value(isOpen ? 1 : 0)).current;
242
+ const progress = (0, _react.useRef)((0, _index.createAnimatedValue)(isOpen ? 1 : 0)).current;
243
243
  const itemAnims = (0, _react.useRef)([]);
244
244
 
245
245
  // Resize per-item anim array if action count changes
@@ -26,7 +26,7 @@ const FormField = exports.FormField = /*#__PURE__*/(0, _react.forwardRef)((props
26
26
  } = props;
27
27
  const theme = (0, _index.useTheme)();
28
28
  const styles = (0, _react.useMemo)(() => buildStyles(theme), [theme]);
29
- const errorOpacity = (0, _react.useRef)(new _reactNative.Animated.Value(error ? 1 : 0)).current;
29
+ const errorOpacity = (0, _react.useRef)((0, _index.createAnimatedValue)(error ? 1 : 0)).current;
30
30
  (0, _react.useEffect)(() => {
31
31
  _reactNative.Animated.timing(errorOpacity, {
32
32
  toValue: error ? 1 : 0,
@@ -59,7 +59,8 @@ const Input = exports.Input = /*#__PURE__*/(0, _react.forwardRef)((props, ref) =
59
59
  leftIcon,
60
60
  rightIcon,
61
61
  size = 'md',
62
- variant = 'outlined',
62
+ variant: variantProp,
63
+ labelMode: labelModeProp,
63
64
  required = false,
64
65
  maxLength,
65
66
  format,
@@ -80,20 +81,27 @@ const Input = exports.Input = /*#__PURE__*/(0, _react.forwardRef)((props, ref) =
80
81
  ...sizeMap[size],
81
82
  ...(theme.components.input?.[size] ?? {})
82
83
  };
84
+
85
+ // Per-call-site prop wins; otherwise theme defaults; otherwise library defaults.
86
+ const variant = variantProp ?? theme.components.input?.defaultVariant ?? 'outlined';
87
+ const labelMode = labelModeProp ?? theme.components.input?.defaultLabelMode ?? 'float';
83
88
  const [isFocused, setIsFocused] = (0, _react.useState)(false);
84
89
  const [isPasswordVisible, setIsPasswordVisible] = (0, _react.useState)(false);
85
90
  const hasValue = typeof value === 'string' && value.length > 0;
86
91
  const hasError = typeof error === 'string' && error.length > 0;
87
92
  const isEditable = !disabled && editable !== false;
88
93
  const shouldFloat = isFocused || hasValue;
89
- const showFloatingLabel = Boolean(label) && !multiline;
94
+ // Floating label only when explicitly opted into via labelMode='float' AND the
95
+ // field is single-line. labelMode='top' OR multiline both force a static label
96
+ // above the field — the staticLabel branch below handles both.
97
+ const showFloatingLabel = Boolean(label) && !multiline && labelMode === 'float';
90
98
 
91
99
  // Animations
92
- const focusAnim = (0, _react.useRef)(new _reactNative.Animated.Value(0)).current; // 0 -> blurred, 1 -> focused
93
- const errorAnim = (0, _react.useRef)(new _reactNative.Animated.Value(0)).current; // 0 -> no error, 1 -> error
94
- const labelAnim = (0, _react.useRef)(new _reactNative.Animated.Value(shouldFloat ? 1 : 0)).current;
95
- const shakeAnim = (0, _react.useRef)(new _reactNative.Animated.Value(0)).current;
96
- const messageAnim = (0, _react.useRef)(new _reactNative.Animated.Value(hasError || helperText ? 1 : 0)).current;
100
+ const focusAnim = (0, _react.useRef)((0, _index.createAnimatedValue)(0)).current;
101
+ const errorAnim = (0, _react.useRef)((0, _index.createAnimatedValue)(0)).current;
102
+ const labelAnim = (0, _react.useRef)((0, _index.createAnimatedValue)(shouldFloat ? 1 : 0)).current;
103
+ const shakeAnim = (0, _react.useRef)((0, _index.createAnimatedValue)(0)).current;
104
+ const messageAnim = (0, _react.useRef)((0, _index.createAnimatedValue)(hasError || helperText ? 1 : 0)).current;
97
105
 
98
106
  // Focus border animation
99
107
  (0, _react.useEffect)(() => {
@@ -29,10 +29,10 @@ const Modal = exports.Modal = /*#__PURE__*/(0, _react.forwardRef)((props, ref) =
29
29
  const theme = (0, _index.useTheme)();
30
30
  const duration = animationDuration ?? theme.motion.duration.normal;
31
31
  const screenHeight = _reactNative.Dimensions.get('window').height;
32
- const backdropAnim = (0, _react.useRef)(new _reactNative.Animated.Value(0)).current;
33
- const scaleAnim = (0, _react.useRef)(new _reactNative.Animated.Value(0.9)).current;
34
- const opacityAnim = (0, _react.useRef)(new _reactNative.Animated.Value(0)).current;
35
- const translateYAnim = (0, _react.useRef)(new _reactNative.Animated.Value(screenHeight)).current;
32
+ const backdropAnim = (0, _react.useRef)((0, _index.createAnimatedValue)(0)).current;
33
+ const scaleAnim = (0, _react.useRef)((0, _index.createAnimatedValue)(0.9)).current;
34
+ const opacityAnim = (0, _react.useRef)((0, _index.createAnimatedValue)(0)).current;
35
+ const translateYAnim = (0, _react.useRef)((0, _index.createAnimatedValue)(screenHeight)).current;
36
36
  const containerRef = (0, _react.useRef)(null);
37
37
  const wasVisibleRef = (0, _react.useRef)(false);
38
38
  const styles = (0, _react.useMemo)(() => buildStyles(theme), [theme]);
@@ -64,7 +64,7 @@ const OTPInput = exports.OTPInput = /*#__PURE__*/(0, _react.forwardRef)((props,
64
64
  const inputsRef = (0, _react.useRef)([]);
65
65
  const [focusedIndex, setFocusedIndex] = (0, _react.useState)(-1);
66
66
  const previousErrorRef = (0, _react.useRef)(null);
67
- const shake = (0, _react.useRef)(new _reactNative.Animated.Value(0)).current;
67
+ const shake = (0, _react.useRef)((0, _index.createAnimatedValue)(0)).current;
68
68
  const underlines = (0, _react.useRef)(Array.from({
69
69
  length
70
70
  }, () => new _reactNative.Animated.Value(0))).current;
@@ -45,8 +45,8 @@ const ProgressBar = exports.ProgressBar = /*#__PURE__*/(0, _react.forwardRef)((p
45
45
  } = props;
46
46
  const isIndeterminate = indeterminateProp ?? typeof progress !== 'number';
47
47
  const clamped = clampProgress(progress);
48
- const fillAnim = (0, _react.useRef)(new _reactNative.Animated.Value(clamped)).current;
49
- const loopAnim = (0, _react.useRef)(new _reactNative.Animated.Value(0)).current;
48
+ const fillAnim = (0, _react.useRef)((0, _index.createAnimatedValue)(clamped)).current;
49
+ const loopAnim = (0, _react.useRef)((0, _index.createAnimatedValue)(0)).current;
50
50
  const widthRef = (0, _react.useRef)(0);
51
51
  const styles = (0, _react.useMemo)(() => buildStyles(theme), [theme]);
52
52
  const resolvedRadius = radius ?? theme.radius.full;
@@ -67,7 +67,7 @@ const Radio = exports.Radio = /*#__PURE__*/(0, _react.forwardRef)((props, ref) =
67
67
  const inner = sizeOverrides?.inner ?? sizeMap[size].inner;
68
68
  const radioBorderWidth = theme.components.radio?.borderWidth ?? 1.5;
69
69
  const radioLabelGap = theme.components.radio?.labelGap ?? 10;
70
- const progress = (0, _react.useRef)(new _reactNative.Animated.Value(selected ? 1 : 0)).current;
70
+ const progress = (0, _react.useRef)((0, _index.createAnimatedValue)(selected ? 1 : 0)).current;
71
71
  (0, _react.useEffect)(() => {
72
72
  _reactNative.Animated.spring(progress, {
73
73
  toValue: selected ? 1 : 0,
@@ -67,7 +67,7 @@ const SearchBar = exports.SearchBar = /*#__PURE__*/(0, _react.forwardRef)((props
67
67
  const [isFocused, setIsFocused] = (0, _react.useState)(false);
68
68
  const [internalValue, setInternalValue] = (0, _react.useState)(value);
69
69
  const debouncedValue = (0, _useDebounce.useDebounce)(internalValue, debounceMs ?? 0);
70
- const cancelAnim = (0, _react.useRef)(new _reactNative.Animated.Value(0)).current;
70
+ const cancelAnim = (0, _react.useRef)((0, _index.createAnimatedValue)(0)).current;
71
71
 
72
72
  // Keep internal value in sync with controlled value when debouncing.
73
73
  (0, _react.useEffect)(() => {
@@ -52,8 +52,8 @@ const SegmentedControl = exports.SegmentedControl = /*#__PURE__*/(0, _react.forw
52
52
 
53
53
  // Total track width — measured from onLayout; thumb width = trackWidth / segments.length.
54
54
  const trackWidthRef = (0, _react.useRef)(0);
55
- const thumbTranslateX = (0, _react.useRef)(new _reactNative.Animated.Value(0)).current;
56
- const thumbWidth = (0, _react.useRef)(new _reactNative.Animated.Value(0)).current;
55
+ const thumbTranslateX = (0, _react.useRef)((0, _index.createAnimatedValue)(0)).current;
56
+ const thumbWidth = (0, _react.useRef)((0, _index.createAnimatedValue)(0)).current;
57
57
  const activeIndex = Math.max(0, segments.findIndex(s => s.value === value));
58
58
  const animateThumb = (0, _react.useCallback)((index, totalWidth) => {
59
59
  if (totalWidth <= 0 || segments.length === 0) return;
@@ -69,8 +69,8 @@ const Select = exports.Select = /*#__PURE__*/(0, _react.forwardRef)((props, ref)
69
69
  const sheetMaxHeight = Math.round(screenHeight * 0.7);
70
70
 
71
71
  // Animations: backdrop fade + sheet slide-up.
72
- const backdropAnim = (0, _react.useRef)(new _reactNative.Animated.Value(0)).current;
73
- const sheetAnim = (0, _react.useRef)(new _reactNative.Animated.Value(sheetMaxHeight)).current;
72
+ const backdropAnim = (0, _react.useRef)((0, _index.createAnimatedValue)(0)).current;
73
+ const sheetAnim = (0, _react.useRef)((0, _index.createAnimatedValue)(sheetMaxHeight)).current;
74
74
  (0, _react.useEffect)(() => {
75
75
  if (open) {
76
76
  _reactNative.Animated.parallel([_reactNative.Animated.timing(backdropAnim, {
@@ -395,7 +395,7 @@ const Chevron = ({
395
395
  size,
396
396
  open
397
397
  }) => {
398
- const rotate = (0, _react.useRef)(new _reactNative.Animated.Value(open ? 1 : 0)).current;
398
+ const rotate = (0, _react.useRef)((0, _index.createAnimatedValue)(open ? 1 : 0)).current;
399
399
  (0, _react.useEffect)(() => {
400
400
  _reactNative.Animated.timing(rotate, {
401
401
  toValue: open ? 1 : 0,
@@ -52,7 +52,7 @@ const Skeleton = ({
52
52
  const borderRadius = resolveRadius(theme, resolvedRadiusToken);
53
53
  const resolvedWidth = resolveWidth(width);
54
54
  const resolvedHeight = _index2.Responsive.size(height);
55
- const progress = (0, _react.useRef)(new _reactNative.Animated.Value(0)).current;
55
+ const progress = (0, _react.useRef)((0, _index.createAnimatedValue)(0)).current;
56
56
  const [containerWidth, setContainerWidth] = (0, _react.useState)(0);
57
57
  (0, _react.useEffect)(() => {
58
58
  progress.setValue(0);
@@ -70,16 +70,16 @@ const Slider = exports.Slider = /*#__PURE__*/(0, _react.forwardRef)((props, ref)
70
70
  const lastReportedHigh = (0, _react.useRef)(highRef.current);
71
71
 
72
72
  // Animated x positions (px) for thumbs.
73
- const lowX = (0, _react.useRef)(new _reactNative.Animated.Value(0)).current;
74
- const highX = (0, _react.useRef)(new _reactNative.Animated.Value(0)).current;
73
+ const lowX = (0, _react.useRef)((0, _index.createAnimatedValue)(0)).current;
74
+ const highX = (0, _react.useRef)((0, _index.createAnimatedValue)(0)).current;
75
75
 
76
76
  // Press / drag scale animations.
77
- const lowScale = (0, _react.useRef)(new _reactNative.Animated.Value(1)).current;
78
- const highScale = (0, _react.useRef)(new _reactNative.Animated.Value(1)).current;
77
+ const lowScale = (0, _react.useRef)((0, _index.createAnimatedValue)(1)).current;
78
+ const highScale = (0, _react.useRef)((0, _index.createAnimatedValue)(1)).current;
79
79
 
80
80
  // Label opacity per thumb.
81
- const lowLabelOpacity = (0, _react.useRef)(new _reactNative.Animated.Value(0)).current;
82
- const highLabelOpacity = (0, _react.useRef)(new _reactNative.Animated.Value(0)).current;
81
+ const lowLabelOpacity = (0, _react.useRef)((0, _index.createAnimatedValue)(0)).current;
82
+ const highLabelOpacity = (0, _react.useRef)((0, _index.createAnimatedValue)(0)).current;
83
83
 
84
84
  // Track which thumb is actively dragging (to anchor gesture math).
85
85
  const dragOffsetRef = (0, _react.useRef)(0);
@@ -23,7 +23,7 @@ const Dot = ({
23
23
  delay,
24
24
  duration
25
25
  }) => {
26
- const scale = (0, _react.useRef)(new _reactNative.Animated.Value(1)).current;
26
+ const scale = (0, _react.useRef)((0, _index.createAnimatedValue)(1)).current;
27
27
  (0, _react.useEffect)(() => {
28
28
  const animation = _reactNative.Animated.loop(_reactNative.Animated.sequence([_reactNative.Animated.delay(delay), _reactNative.Animated.timing(scale, {
29
29
  toValue: 1.4,
@@ -66,7 +66,7 @@ const Spinner = exports.Spinner = /*#__PURE__*/(0, _react.forwardRef)((props, re
66
66
  testID
67
67
  } = props;
68
68
  const theme = (0, _index.useTheme)();
69
- const fade = (0, _react.useRef)(new _reactNative.Animated.Value(0)).current;
69
+ const fade = (0, _react.useRef)((0, _index.createAnimatedValue)(0)).current;
70
70
  (0, _react.useEffect)(() => {
71
71
  _reactNative.Animated.timing(fade, {
72
72
  toValue: 1,
@@ -35,8 +35,8 @@ const StepCircle = ({
35
35
  onPress
36
36
  }) => {
37
37
  const isActive = status === 'active';
38
- const pulseScale = (0, _react.useRef)(new _reactNative.Animated.Value(1)).current;
39
- const pulseOpacity = (0, _react.useRef)(new _reactNative.Animated.Value(0.5)).current;
38
+ const pulseScale = (0, _react.useRef)((0, _index.createAnimatedValue)(1)).current;
39
+ const pulseOpacity = (0, _react.useRef)((0, _index.createAnimatedValue)(0.5)).current;
40
40
  (0, _react.useEffect)(() => {
41
41
  if (!isActive) {
42
42
  pulseScale.setValue(1);
@@ -181,7 +181,7 @@ const Stepper = exports.Stepper = /*#__PURE__*/(0, _react.forwardRef)((props, re
181
181
 
182
182
  // Connector progress: animates as activeStep changes.
183
183
  const initialProgress = total <= 1 ? 0 : activeStep / (total - 1);
184
- const progress = (0, _react.useRef)(new _reactNative.Animated.Value(initialProgress)).current;
184
+ const progress = (0, _react.useRef)((0, _index.createAnimatedValue)(initialProgress)).current;
185
185
  const lastTargetRef = (0, _react.useRef)(initialProgress);
186
186
  (0, _react.useEffect)(() => {
187
187
  const target = total <= 1 ? 0 : activeStep / (total - 1);
@@ -69,7 +69,7 @@ const Switch = exports.Switch = /*#__PURE__*/(0, _react.forwardRef)((props, ref)
69
69
  const styles = (0, _react.useMemo)(() => buildStyles(theme), [theme]);
70
70
  const offTrackColor = theme.mode === 'dark' ? theme.colors.secondary : theme.colors.surface.disabled;
71
71
  const onTrackColor = toneColor(theme, tone);
72
- const progress = (0, _react.useRef)(new _reactNative.Animated.Value(value ? 1 : 0)).current;
72
+ const progress = (0, _react.useRef)((0, _index.createAnimatedValue)(value ? 1 : 0)).current;
73
73
  (0, _react.useEffect)(() => {
74
74
  _reactNative.Animated.spring(progress, {
75
75
  toValue: value ? 1 : 0,
@@ -79,7 +79,7 @@ const Switch = exports.Switch = /*#__PURE__*/(0, _react.forwardRef)((props, ref)
79
79
  useNativeDriver: true
80
80
  }).start();
81
81
  }, [value, progress, theme.motion.spring.snappy]);
82
- const trackBgAnim = (0, _react.useRef)(new _reactNative.Animated.Value(value ? 1 : 0)).current;
82
+ const trackBgAnim = (0, _react.useRef)((0, _index.createAnimatedValue)(value ? 1 : 0)).current;
83
83
  (0, _react.useEffect)(() => {
84
84
  _reactNative.Animated.timing(trackBgAnim, {
85
85
  toValue: value ? 1 : 0,
@@ -98,7 +98,7 @@ const Switch = exports.Switch = /*#__PURE__*/(0, _react.forwardRef)((props, ref)
98
98
  inputRange: [0, 1],
99
99
  outputRange: [offTrackColor, onTrackColor]
100
100
  });
101
- const bounceScale = (0, _react.useRef)(new _reactNative.Animated.Value(1)).current;
101
+ const bounceScale = (0, _react.useRef)((0, _index.createAnimatedValue)(1)).current;
102
102
  const isFirstRender = (0, _react.useRef)(true);
103
103
  (0, _react.useEffect)(() => {
104
104
  if (!bounce) return;
@@ -39,8 +39,8 @@ const Tabs = exports.Tabs = /*#__PURE__*/(0, _react.forwardRef)((props, ref) =>
39
39
 
40
40
  // Per-tab measured layouts (key → {x, width}).
41
41
  const [layouts, setLayouts] = (0, _react.useState)({});
42
- const indicatorTranslateX = (0, _react.useRef)(new _reactNative.Animated.Value(0)).current;
43
- const indicatorWidth = (0, _react.useRef)(new _reactNative.Animated.Value(0)).current;
42
+ const indicatorTranslateX = (0, _react.useRef)((0, _index.createAnimatedValue)(0)).current;
43
+ const indicatorWidth = (0, _react.useRef)((0, _index.createAnimatedValue)(0)).current;
44
44
  const activeLayout = layouts[activeKey];
45
45
 
46
46
  // Animate indicator whenever activeKey or its layout changes.
@@ -65,7 +65,7 @@ const Wheel = ({
65
65
  testID
66
66
  }) => {
67
67
  const listRef = (0, _react.useRef)(null);
68
- const scrollY = (0, _react.useRef)(new _reactNative.Animated.Value(selectedIndex * ITEM_HEIGHT)).current;
68
+ const scrollY = (0, _react.useRef)((0, _index.createAnimatedValue)(selectedIndex * ITEM_HEIGHT)).current;
69
69
  const lastIndexRef = (0, _react.useRef)(selectedIndex);
70
70
  const lastHapticAtRef = (0, _react.useRef)(0);
71
71
 
@@ -264,8 +264,8 @@ const TimePicker = ({
264
264
  }, [visible, value, format, minuteStep, hours, minutes]);
265
265
 
266
266
  // Sheet animations.
267
- const opacity = (0, _react.useRef)(new _reactNative.Animated.Value(0)).current;
268
- const translateY = (0, _react.useRef)(new _reactNative.Animated.Value(40)).current;
267
+ const opacity = (0, _react.useRef)((0, _index.createAnimatedValue)(0)).current;
268
+ const translateY = (0, _react.useRef)((0, _index.createAnimatedValue)(40)).current;
269
269
  (0, _react.useEffect)(() => {
270
270
  if (visible) {
271
271
  _reactNative.Animated.parallel([_reactNative.Animated.timing(opacity, {
@@ -29,9 +29,9 @@ const Toast = ({
29
29
  const iconGlyphFontSize = toastTokens?.iconGlyphFontSize ?? 16;
30
30
  const tintBarWidth = toastTokens?.tintBarWidth ?? 4;
31
31
  const enterFrom = position === 'top' ? -120 : 120;
32
- const translateY = (0, _react.useRef)(new _reactNative.Animated.Value(enterFrom)).current;
33
- const translateX = (0, _react.useRef)(new _reactNative.Animated.Value(0)).current;
34
- const opacity = (0, _react.useRef)(new _reactNative.Animated.Value(0)).current;
32
+ const translateY = (0, _react.useRef)((0, _index.createAnimatedValue)(enterFrom)).current;
33
+ const translateX = (0, _react.useRef)((0, _index.createAnimatedValue)(0)).current;
34
+ const opacity = (0, _react.useRef)((0, _index.createAnimatedValue)(0)).current;
35
35
  const dismissedRef = (0, _react.useRef)(false);
36
36
  const dismiss = (animateOut = true) => {
37
37
  if (dismissedRef.current) return;
@@ -41,8 +41,8 @@ const Tooltip = props => {
41
41
  height: 0
42
42
  });
43
43
  const wrapperRef = (0, _react.useRef)(null);
44
- const scale = (0, _react.useRef)(new _reactNative.Animated.Value(visible ? 1 : 0.85)).current;
45
- const opacity = (0, _react.useRef)(new _reactNative.Animated.Value(visible ? 1 : 0)).current;
44
+ const scale = (0, _react.useRef)((0, _index.createAnimatedValue)(visible ? 1 : 0.85)).current;
45
+ const opacity = (0, _react.useRef)((0, _index.createAnimatedValue)(visible ? 1 : 0)).current;
46
46
  const autoHideTimer = (0, _react.useRef)(null);
47
47
  const didMount = (0, _react.useRef)(false);
48
48
  const setVisible = (0, _react.useCallback)(next => {
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.createAnimatedValue = void 0;
7
+ var _reactNative = require("react-native");
8
+ /**
9
+ * Create an `Animated.Value` that survives RN 0.85's dev-mode prop deepFreeze.
10
+ *
11
+ * RN's Fabric renderer deep-freezes prop trees on host components. If an
12
+ * `Animated.Value` is reachable from a `style` prop via interpolation chains
13
+ * (the `_parent` ref on `AnimatedInterpolation` nodes), the recursive freeze
14
+ * converts the value's `_animation` slot into a throwing setter — the next
15
+ * `Animated.timing(v).start()` then crashes with
16
+ * "_animation: object that is meant to be immutable".
17
+ *
18
+ * Sealing the value at construction makes `Object.isSealed(v) === true`,
19
+ * which causes `deepFreezeAndThrowOnMutationInDev` to skip-and-return at
20
+ * its top guard. Existing-property mutation (`_animation`, `_value`,
21
+ * `_listeners`, `_tracking`) keeps working — seal only blocks adding NEW
22
+ * properties, and `Animated.Value` doesn't add any post-construction.
23
+ *
24
+ * Use everywhere the library would otherwise call `new Animated.Value(...)`.
25
+ */
26
+ const createAnimatedValue = (initial, config) => Object.seal(new _reactNative.Animated.Value(initial, config));
27
+ exports.createAnimatedValue = createAnimatedValue;
28
+ //# sourceMappingURL=animatedValue.js.map
@@ -15,6 +15,12 @@ Object.defineProperty(exports, "ThemeProvider", {
15
15
  return _ThemeContext.ThemeProvider;
16
16
  }
17
17
  });
18
+ Object.defineProperty(exports, "createAnimatedValue", {
19
+ enumerable: true,
20
+ get: function () {
21
+ return _animatedValue.createAnimatedValue;
22
+ }
23
+ });
18
24
  Object.defineProperty(exports, "darkTheme", {
19
25
  enumerable: true,
20
26
  get: function () {
@@ -63,6 +69,7 @@ var _tokens = require("./tokens.js");
63
69
  var _merge = require("./merge.js");
64
70
  var _ThemeContext = require("./ThemeContext.js");
65
71
  var _textStyle = require("./textStyle.js");
72
+ var _animatedValue = require("./animatedValue.js");
66
73
  var _Gradient = require("./Gradient.js");
67
74
  let currentMode = 'light';
68
75
  let currentTheme = _tokens.lightTheme;
@@ -2,7 +2,7 @@
2
2
 
3
3
  import React, { createContext, useCallback, useContext, useEffect, useMemo, useRef, useState } from 'react';
4
4
  import { Animated, Easing, LayoutAnimation, Pressable, StyleSheet, Text, View } from 'react-native';
5
- import { useTheme } from "../../theme/index.js";
5
+ import { useTheme, createAnimatedValue } from "../../theme/index.js";
6
6
  import { triggerHaptic } from "../../utils/hapticUtils.js";
7
7
  import { SkeletonContent } from "../Skeleton/index.js";
8
8
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
@@ -98,9 +98,9 @@ const Accordion = props => {
98
98
  const groupExpanded = group && id ? group.isExpanded(id) : null;
99
99
  const expanded = groupExpanded !== null ? groupExpanded : isControlled ? !!expandedProp : internalExpanded;
100
100
  const [measuredHeight, setMeasuredHeight] = useState(null);
101
- const heightAnim = useRef(new Animated.Value(expanded ? 1 : 0)).current;
102
- const opacityAnim = useRef(new Animated.Value(expanded ? 1 : 0)).current;
103
- const rotateAnim = useRef(new Animated.Value(expanded ? 1 : 0)).current;
101
+ const heightAnim = useRef(createAnimatedValue(expanded ? 1 : 0)).current;
102
+ const opacityAnim = useRef(createAnimatedValue(expanded ? 1 : 0)).current;
103
+ const rotateAnim = useRef(createAnimatedValue(expanded ? 1 : 0)).current;
104
104
  const lastExpandedRef = useRef(expanded);
105
105
  useEffect(() => {
106
106
  // Skip animation when state matches the previous value (e.g. on mount).
@@ -2,7 +2,7 @@
2
2
 
3
3
  import React, { Children, cloneElement, forwardRef, isValidElement, useEffect, useMemo, useRef, useState } from 'react';
4
4
  import { Animated, Easing, Image, StyleSheet, Text, View } from 'react-native';
5
- import { useTheme } from "../../theme/index.js";
5
+ import { useTheme, createAnimatedValue } from "../../theme/index.js";
6
6
  import { SkeletonContent } from "../Skeleton/index.js";
7
7
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
8
8
  const sizeMap = {
@@ -176,7 +176,7 @@ const AvatarGroupItem = ({
176
176
  borderWidth,
177
177
  children
178
178
  }) => {
179
- const opacity = useRef(new Animated.Value(0)).current;
179
+ const opacity = useRef(createAnimatedValue(0)).current;
180
180
  useEffect(() => {
181
181
  Animated.timing(opacity, {
182
182
  toValue: 1,
@@ -2,7 +2,7 @@
2
2
 
3
3
  import React, { forwardRef, useEffect, useMemo, useRef } from 'react';
4
4
  import { Animated, Easing, StyleSheet, Text, View } from 'react-native';
5
- import { fontFor, useTheme } from "../../theme/index.js";
5
+ import { fontFor, useTheme, createAnimatedValue } from "../../theme/index.js";
6
6
  import { SkeletonContent } from "../Skeleton/index.js";
7
7
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
8
8
  const toneFor = (theme, tone) => {
@@ -123,7 +123,7 @@ const Badge = /*#__PURE__*/forwardRef((props, ref) => {
123
123
  const badgeAnchorOffset = theme.components.badge?.anchorOffset ?? 4;
124
124
  const formatted = variant === 'dot' ? null : formatValue(value, max);
125
125
  const shouldRender = !invisible && (variant === 'dot' || formatted !== null);
126
- const pulseScale = useRef(new Animated.Value(1)).current;
126
+ const pulseScale = useRef(createAnimatedValue(1)).current;
127
127
  useEffect(() => {
128
128
  if (!pulse || !shouldRender) {
129
129
  pulseScale.setValue(1);
@@ -2,7 +2,7 @@
2
2
 
3
3
  import React, { forwardRef, useEffect, useMemo, useRef, useState } from 'react';
4
4
  import { Animated, Pressable, StyleSheet, Text, View } from 'react-native';
5
- import { useTheme } from "../../theme/index.js";
5
+ import { useTheme, createAnimatedValue } from "../../theme/index.js";
6
6
  import { SkeletonContent } from "../Skeleton/index.js";
7
7
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
8
8
  const Banner = /*#__PURE__*/forwardRef((props, ref) => {
@@ -24,8 +24,8 @@ const Banner = /*#__PURE__*/forwardRef((props, ref) => {
24
24
  const theme = useTheme();
25
25
  const styles = useMemo(() => buildStyles(theme), [theme]);
26
26
  const tint = useMemo(() => tintFor(theme, variant), [theme, variant]);
27
- const translateY = useRef(new Animated.Value(animateMount && visible ? -20 : 0)).current;
28
- const opacity = useRef(new Animated.Value(animateMount && visible ? 0 : visible ? 1 : 0)).current;
27
+ const translateY = useRef(createAnimatedValue(animateMount && visible ? -20 : 0)).current;
28
+ const opacity = useRef(createAnimatedValue(animateMount && visible ? 0 : visible ? 1 : 0)).current;
29
29
  const [mounted, setMounted] = useState(visible);
30
30
  const isFirstRun = useRef(true);
31
31
  useEffect(() => {
@@ -3,7 +3,7 @@
3
3
  import React, { forwardRef, useEffect, useMemo, useRef } from 'react';
4
4
  import { Animated, Pressable, StyleSheet, Text, View } from 'react-native';
5
5
  import { useSafeAreaInsets } from 'react-native-safe-area-context';
6
- import { useTheme } from "../../theme/index.js";
6
+ import { useTheme, createAnimatedValue } from "../../theme/index.js";
7
7
  import { triggerHaptic } from "../../utils/index.js";
8
8
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
9
9
  const ICON_SIZE = 24;
@@ -58,7 +58,7 @@ const BottomNavigation = /*#__PURE__*/forwardRef((props, ref) => {
58
58
  const styles = useMemo(() => buildStyles(theme), [theme]);
59
59
  const activeIndex = Math.max(0, tabs.findIndex(tab => tab.key === activeTab));
60
60
  const [tabWidth, setTabWidth] = React.useState(0);
61
- const indicatorTranslateX = useRef(new Animated.Value(0)).current;
61
+ const indicatorTranslateX = useRef(createAnimatedValue(0)).current;
62
62
  const iconScales = useRef({});
63
63
 
64
64
  // Ensure each tab has a persistent scale value