@webority-technologies/mobile 0.0.22 → 0.0.24

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 (249) hide show
  1. package/lib/commonjs/components/Accordion/Accordion.js +9 -7
  2. package/lib/commonjs/components/AnimatePresence/AnimatePresence.js +69 -0
  3. package/lib/commonjs/components/AnimatePresence/index.js +13 -0
  4. package/lib/commonjs/components/AppBar/AppBar.js +9 -6
  5. package/lib/commonjs/components/Avatar/Avatar.js +4 -2
  6. package/lib/commonjs/components/Badge/Badge.js +5 -5
  7. package/lib/commonjs/components/Banner/Banner.js +20 -6
  8. package/lib/commonjs/components/BottomNavigation/BottomNavigation.js +6 -4
  9. package/lib/commonjs/components/BottomSheet/BottomSheet.js +8 -9
  10. package/lib/commonjs/components/Box/Box.js +162 -0
  11. package/lib/commonjs/components/Box/index.js +37 -0
  12. package/lib/commonjs/components/Button/Button.js +7 -7
  13. package/lib/commonjs/components/Card/Card.js +3 -3
  14. package/lib/commonjs/components/Carousel/Carousel.js +4 -2
  15. package/lib/commonjs/components/Checkbox/Checkbox.js +17 -7
  16. package/lib/commonjs/components/Chip/Chip.js +4 -2
  17. package/lib/commonjs/components/DatePicker/DatePicker.js +31 -24
  18. package/lib/commonjs/components/DateRangePicker/DateRangePicker.js +16 -11
  19. package/lib/commonjs/components/Dialog/Dialog.js +6 -4
  20. package/lib/commonjs/components/Drawer/Drawer.js +4 -2
  21. package/lib/commonjs/components/FieldBase/FieldBase.js +8 -4
  22. package/lib/commonjs/components/FloatingActionButton/FloatingActionButton.js +23 -13
  23. package/lib/commonjs/components/FormField/FormField.js +61 -25
  24. package/lib/commonjs/components/ImageGallery/ImageGallery.js +17 -15
  25. package/lib/commonjs/components/Input/Input.js +41 -29
  26. package/lib/commonjs/components/KeyboardAwareScrollView/KeyboardAwareScrollView.js +102 -0
  27. package/lib/commonjs/components/KeyboardAwareScrollView/index.js +13 -0
  28. package/lib/commonjs/components/KeyboardToolbar/KeyboardToolbar.js +130 -0
  29. package/lib/commonjs/components/KeyboardToolbar/index.js +13 -0
  30. package/lib/commonjs/components/ListItem/ListItem.js +4 -3
  31. package/lib/commonjs/components/Modal/Modal.js +21 -9
  32. package/lib/commonjs/components/NumberInput/NumberInput.js +38 -29
  33. package/lib/commonjs/components/OTPInput/OTPInput.js +37 -22
  34. package/lib/commonjs/components/Radio/Radio.js +9 -8
  35. package/lib/commonjs/components/Radio/RadioGroup.js +10 -3
  36. package/lib/commonjs/components/Rating/Rating.js +4 -3
  37. package/lib/commonjs/components/SearchBar/SearchBar.js +11 -6
  38. package/lib/commonjs/components/SegmentedControl/SegmentedControl.js +23 -12
  39. package/lib/commonjs/components/Select/Select.js +40 -36
  40. package/lib/commonjs/components/Skeleton/SkeletonContent.js +5 -2
  41. package/lib/commonjs/components/Slider/Slider.js +241 -225
  42. package/lib/commonjs/components/Spinner/Spinner.js +5 -5
  43. package/lib/commonjs/components/Stepper/Stepper.js +6 -5
  44. package/lib/commonjs/components/Swipeable/Swipeable.js +8 -9
  45. package/lib/commonjs/components/Switch/Switch.js +29 -16
  46. package/lib/commonjs/components/Tabs/Tabs.js +8 -5
  47. package/lib/commonjs/components/Text/Text.js +142 -0
  48. package/lib/commonjs/components/Text/index.js +13 -0
  49. package/lib/commonjs/components/TimePicker/TimePicker.js +23 -15
  50. package/lib/commonjs/components/Toast/Toast.js +22 -10
  51. package/lib/commonjs/components/Tooltip/Tooltip.js +6 -2
  52. package/lib/commonjs/components/index.js +156 -103
  53. package/lib/commonjs/form/FormContext.js +40 -0
  54. package/lib/commonjs/form/index.js +68 -0
  55. package/lib/commonjs/form/path.js +79 -0
  56. package/lib/commonjs/form/rules.js +67 -0
  57. package/lib/commonjs/form/types.js +2 -0
  58. package/lib/commonjs/form/useField.js +54 -0
  59. package/lib/commonjs/form/useForm.js +316 -0
  60. package/lib/commonjs/hooks/index.js +14 -0
  61. package/lib/commonjs/hooks/useControllableState.js +30 -0
  62. package/lib/commonjs/hooks/useReducedMotion.js +31 -0
  63. package/lib/commonjs/index.js +96 -11
  64. package/lib/commonjs/theme/ThemeContext.js +30 -2
  65. package/lib/commonjs/theme/tokens.js +12 -0
  66. package/lib/commonjs/utils/hapticUtils.js +11 -1
  67. package/lib/commonjs/utils/index.js +6 -0
  68. package/lib/module/components/Accordion/Accordion.js +10 -8
  69. package/lib/module/components/AnimatePresence/AnimatePresence.js +63 -0
  70. package/lib/module/components/AnimatePresence/index.js +4 -0
  71. package/lib/module/components/AppBar/AppBar.js +10 -7
  72. package/lib/module/components/Avatar/Avatar.js +4 -2
  73. package/lib/module/components/Badge/Badge.js +5 -5
  74. package/lib/module/components/Banner/Banner.js +20 -6
  75. package/lib/module/components/BottomNavigation/BottomNavigation.js +6 -4
  76. package/lib/module/components/BottomSheet/BottomSheet.js +8 -9
  77. package/lib/module/components/Box/Box.js +156 -0
  78. package/lib/module/components/Box/index.js +4 -0
  79. package/lib/module/components/Button/Button.js +7 -7
  80. package/lib/module/components/Card/Card.js +4 -4
  81. package/lib/module/components/Carousel/Carousel.js +4 -2
  82. package/lib/module/components/Checkbox/Checkbox.js +18 -8
  83. package/lib/module/components/Chip/Chip.js +5 -3
  84. package/lib/module/components/DatePicker/DatePicker.js +32 -25
  85. package/lib/module/components/DateRangePicker/DateRangePicker.js +17 -12
  86. package/lib/module/components/Dialog/Dialog.js +7 -5
  87. package/lib/module/components/Drawer/Drawer.js +5 -3
  88. package/lib/module/components/FieldBase/FieldBase.js +8 -4
  89. package/lib/module/components/FloatingActionButton/FloatingActionButton.js +24 -14
  90. package/lib/module/components/FormField/FormField.js +62 -26
  91. package/lib/module/components/ImageGallery/ImageGallery.js +18 -16
  92. package/lib/module/components/Input/Input.js +41 -29
  93. package/lib/module/components/KeyboardAwareScrollView/KeyboardAwareScrollView.js +98 -0
  94. package/lib/module/components/KeyboardAwareScrollView/index.js +4 -0
  95. package/lib/module/components/KeyboardToolbar/KeyboardToolbar.js +125 -0
  96. package/lib/module/components/KeyboardToolbar/index.js +4 -0
  97. package/lib/module/components/ListItem/ListItem.js +5 -4
  98. package/lib/module/components/Modal/Modal.js +22 -10
  99. package/lib/module/components/NumberInput/NumberInput.js +36 -27
  100. package/lib/module/components/OTPInput/OTPInput.js +37 -22
  101. package/lib/module/components/Radio/Radio.js +10 -9
  102. package/lib/module/components/Radio/RadioGroup.js +10 -3
  103. package/lib/module/components/Rating/Rating.js +5 -4
  104. package/lib/module/components/SearchBar/SearchBar.js +12 -7
  105. package/lib/module/components/SegmentedControl/SegmentedControl.js +24 -13
  106. package/lib/module/components/Select/Select.js +41 -37
  107. package/lib/module/components/Skeleton/SkeletonContent.js +5 -2
  108. package/lib/module/components/Slider/Slider.js +244 -228
  109. package/lib/module/components/Spinner/Spinner.js +5 -5
  110. package/lib/module/components/Stepper/Stepper.js +7 -6
  111. package/lib/module/components/Swipeable/Swipeable.js +9 -10
  112. package/lib/module/components/Switch/Switch.js +29 -16
  113. package/lib/module/components/Tabs/Tabs.js +9 -6
  114. package/lib/module/components/Text/Text.js +138 -0
  115. package/lib/module/components/Text/index.js +4 -0
  116. package/lib/module/components/TimePicker/TimePicker.js +24 -16
  117. package/lib/module/components/Toast/Toast.js +22 -10
  118. package/lib/module/components/Tooltip/Tooltip.js +6 -2
  119. package/lib/module/components/index.js +5 -0
  120. package/lib/module/form/FormContext.js +32 -0
  121. package/lib/module/form/index.js +12 -0
  122. package/lib/module/form/path.js +72 -0
  123. package/lib/module/form/rules.js +52 -0
  124. package/lib/module/form/types.js +2 -0
  125. package/lib/module/form/useField.js +49 -0
  126. package/lib/module/form/useForm.js +312 -0
  127. package/lib/module/hooks/index.js +2 -0
  128. package/lib/module/hooks/useControllableState.js +26 -0
  129. package/lib/module/hooks/useReducedMotion.js +27 -0
  130. package/lib/module/index.js +3 -1
  131. package/lib/module/theme/ThemeContext.js +30 -2
  132. package/lib/module/theme/tokens.js +12 -0
  133. package/lib/module/utils/hapticUtils.js +9 -0
  134. package/lib/module/utils/index.js +1 -1
  135. package/lib/typescript/commonjs/components/Accordion/Accordion.d.ts +3 -0
  136. package/lib/typescript/commonjs/components/AnimatePresence/AnimatePresence.d.ts +30 -0
  137. package/lib/typescript/commonjs/components/AnimatePresence/index.d.ts +3 -0
  138. package/lib/typescript/commonjs/components/AppBar/AppBar.d.ts +6 -0
  139. package/lib/typescript/commonjs/components/Banner/Banner.d.ts +3 -0
  140. package/lib/typescript/commonjs/components/BottomNavigation/BottomNavigation.d.ts +1 -1
  141. package/lib/typescript/commonjs/components/Box/Box.d.ts +60 -0
  142. package/lib/typescript/commonjs/components/Box/index.d.ts +3 -0
  143. package/lib/typescript/commonjs/components/Button/Button.d.ts +1 -1
  144. package/lib/typescript/commonjs/components/Card/Card.d.ts +3 -0
  145. package/lib/typescript/commonjs/components/Checkbox/Checkbox.d.ts +4 -2
  146. package/lib/typescript/commonjs/components/Chip/Chip.d.ts +3 -0
  147. package/lib/typescript/commonjs/components/DatePicker/DatePicker.d.ts +6 -3
  148. package/lib/typescript/commonjs/components/DateRangePicker/DateRangePicker.d.ts +6 -0
  149. package/lib/typescript/commonjs/components/Dialog/Dialog.d.ts +5 -2
  150. package/lib/typescript/commonjs/components/Drawer/Drawer.d.ts +3 -0
  151. package/lib/typescript/commonjs/components/FloatingActionButton/FloatingActionButton.d.ts +5 -0
  152. package/lib/typescript/commonjs/components/FormField/FormField.d.ts +13 -2
  153. package/lib/typescript/commonjs/components/ImageGallery/ImageGallery.d.ts +6 -0
  154. package/lib/typescript/commonjs/components/KeyboardAwareScrollView/KeyboardAwareScrollView.d.ts +20 -0
  155. package/lib/typescript/commonjs/components/KeyboardAwareScrollView/index.d.ts +3 -0
  156. package/lib/typescript/commonjs/components/KeyboardToolbar/KeyboardToolbar.d.ts +29 -0
  157. package/lib/typescript/commonjs/components/KeyboardToolbar/index.d.ts +3 -0
  158. package/lib/typescript/commonjs/components/ListItem/ListItem.d.ts +3 -0
  159. package/lib/typescript/commonjs/components/Modal/Modal.d.ts +6 -0
  160. package/lib/typescript/commonjs/components/NumberInput/NumberInput.d.ts +6 -2
  161. package/lib/typescript/commonjs/components/OTPInput/OTPInput.d.ts +9 -2
  162. package/lib/typescript/commonjs/components/Radio/Radio.d.ts +2 -2
  163. package/lib/typescript/commonjs/components/Radio/RadioGroup.d.ts +3 -2
  164. package/lib/typescript/commonjs/components/Rating/Rating.d.ts +6 -0
  165. package/lib/typescript/commonjs/components/SearchBar/SearchBar.d.ts +3 -0
  166. package/lib/typescript/commonjs/components/SegmentedControl/SegmentedControl.d.ts +6 -2
  167. package/lib/typescript/commonjs/components/Select/Select.d.ts +6 -0
  168. package/lib/typescript/commonjs/components/Slider/Slider.d.ts +9 -4
  169. package/lib/typescript/commonjs/components/Spinner/Spinner.d.ts +1 -1
  170. package/lib/typescript/commonjs/components/Stepper/Stepper.d.ts +6 -0
  171. package/lib/typescript/commonjs/components/Swipeable/Swipeable.d.ts +3 -0
  172. package/lib/typescript/commonjs/components/Switch/Switch.d.ts +3 -2
  173. package/lib/typescript/commonjs/components/Tabs/Tabs.d.ts +3 -0
  174. package/lib/typescript/commonjs/components/Text/Text.d.ts +25 -0
  175. package/lib/typescript/commonjs/components/Text/index.d.ts +3 -0
  176. package/lib/typescript/commonjs/components/TimePicker/TimePicker.d.ts +6 -3
  177. package/lib/typescript/commonjs/components/index.d.ts +10 -0
  178. package/lib/typescript/commonjs/form/FormContext.d.ts +17 -0
  179. package/lib/typescript/commonjs/form/index.d.ts +9 -0
  180. package/lib/typescript/commonjs/form/path.d.ts +10 -0
  181. package/lib/typescript/commonjs/form/rules.d.ts +31 -0
  182. package/lib/typescript/commonjs/form/types.d.ts +94 -0
  183. package/lib/typescript/commonjs/form/useField.d.ts +27 -0
  184. package/lib/typescript/commonjs/form/useForm.d.ts +10 -0
  185. package/lib/typescript/commonjs/hooks/index.d.ts +3 -0
  186. package/lib/typescript/commonjs/hooks/useControllableState.d.ts +17 -0
  187. package/lib/typescript/commonjs/hooks/useReducedMotion.d.ts +8 -0
  188. package/lib/typescript/commonjs/index.d.ts +4 -2
  189. package/lib/typescript/commonjs/theme/types.d.ts +17 -67
  190. package/lib/typescript/commonjs/utils/hapticUtils.d.ts +8 -0
  191. package/lib/typescript/commonjs/utils/index.d.ts +1 -1
  192. package/lib/typescript/module/components/Accordion/Accordion.d.ts +3 -0
  193. package/lib/typescript/module/components/AnimatePresence/AnimatePresence.d.ts +30 -0
  194. package/lib/typescript/module/components/AnimatePresence/index.d.ts +3 -0
  195. package/lib/typescript/module/components/AppBar/AppBar.d.ts +6 -0
  196. package/lib/typescript/module/components/Banner/Banner.d.ts +3 -0
  197. package/lib/typescript/module/components/BottomNavigation/BottomNavigation.d.ts +1 -1
  198. package/lib/typescript/module/components/Box/Box.d.ts +60 -0
  199. package/lib/typescript/module/components/Box/index.d.ts +3 -0
  200. package/lib/typescript/module/components/Button/Button.d.ts +1 -1
  201. package/lib/typescript/module/components/Card/Card.d.ts +3 -0
  202. package/lib/typescript/module/components/Checkbox/Checkbox.d.ts +4 -2
  203. package/lib/typescript/module/components/Chip/Chip.d.ts +3 -0
  204. package/lib/typescript/module/components/DatePicker/DatePicker.d.ts +6 -3
  205. package/lib/typescript/module/components/DateRangePicker/DateRangePicker.d.ts +6 -0
  206. package/lib/typescript/module/components/Dialog/Dialog.d.ts +5 -2
  207. package/lib/typescript/module/components/Drawer/Drawer.d.ts +3 -0
  208. package/lib/typescript/module/components/FloatingActionButton/FloatingActionButton.d.ts +5 -0
  209. package/lib/typescript/module/components/FormField/FormField.d.ts +13 -2
  210. package/lib/typescript/module/components/ImageGallery/ImageGallery.d.ts +6 -0
  211. package/lib/typescript/module/components/KeyboardAwareScrollView/KeyboardAwareScrollView.d.ts +20 -0
  212. package/lib/typescript/module/components/KeyboardAwareScrollView/index.d.ts +3 -0
  213. package/lib/typescript/module/components/KeyboardToolbar/KeyboardToolbar.d.ts +29 -0
  214. package/lib/typescript/module/components/KeyboardToolbar/index.d.ts +3 -0
  215. package/lib/typescript/module/components/ListItem/ListItem.d.ts +3 -0
  216. package/lib/typescript/module/components/Modal/Modal.d.ts +6 -0
  217. package/lib/typescript/module/components/NumberInput/NumberInput.d.ts +6 -2
  218. package/lib/typescript/module/components/OTPInput/OTPInput.d.ts +9 -2
  219. package/lib/typescript/module/components/Radio/Radio.d.ts +2 -2
  220. package/lib/typescript/module/components/Radio/RadioGroup.d.ts +3 -2
  221. package/lib/typescript/module/components/Rating/Rating.d.ts +6 -0
  222. package/lib/typescript/module/components/SearchBar/SearchBar.d.ts +3 -0
  223. package/lib/typescript/module/components/SegmentedControl/SegmentedControl.d.ts +6 -2
  224. package/lib/typescript/module/components/Select/Select.d.ts +6 -0
  225. package/lib/typescript/module/components/Slider/Slider.d.ts +9 -4
  226. package/lib/typescript/module/components/Spinner/Spinner.d.ts +1 -1
  227. package/lib/typescript/module/components/Stepper/Stepper.d.ts +6 -0
  228. package/lib/typescript/module/components/Swipeable/Swipeable.d.ts +3 -0
  229. package/lib/typescript/module/components/Switch/Switch.d.ts +3 -2
  230. package/lib/typescript/module/components/Tabs/Tabs.d.ts +3 -0
  231. package/lib/typescript/module/components/Text/Text.d.ts +25 -0
  232. package/lib/typescript/module/components/Text/index.d.ts +3 -0
  233. package/lib/typescript/module/components/TimePicker/TimePicker.d.ts +6 -3
  234. package/lib/typescript/module/components/index.d.ts +10 -0
  235. package/lib/typescript/module/form/FormContext.d.ts +17 -0
  236. package/lib/typescript/module/form/index.d.ts +9 -0
  237. package/lib/typescript/module/form/path.d.ts +10 -0
  238. package/lib/typescript/module/form/rules.d.ts +31 -0
  239. package/lib/typescript/module/form/types.d.ts +94 -0
  240. package/lib/typescript/module/form/useField.d.ts +27 -0
  241. package/lib/typescript/module/form/useForm.d.ts +10 -0
  242. package/lib/typescript/module/hooks/index.d.ts +3 -0
  243. package/lib/typescript/module/hooks/useControllableState.d.ts +17 -0
  244. package/lib/typescript/module/hooks/useReducedMotion.d.ts +8 -0
  245. package/lib/typescript/module/index.d.ts +4 -2
  246. package/lib/typescript/module/theme/types.d.ts +17 -67
  247. package/lib/typescript/module/utils/hapticUtils.d.ts +8 -0
  248. package/lib/typescript/module/utils/index.d.ts +1 -1
  249. package/package.json +1 -1
@@ -39,7 +39,7 @@ const StepCircle = ({
39
39
  pulseSize,
40
40
  pulseEnabled,
41
41
  pulseDuration,
42
- pressHapticEnabled,
42
+ pressHaptic,
43
43
  circleSlotStyle
44
44
  }) => {
45
45
  const isActive = status === 'active';
@@ -86,7 +86,7 @@ const StepCircle = ({
86
86
  const canPress = interactive && status === 'complete';
87
87
  const handlePress = () => {
88
88
  if (!canPress) return;
89
- if (pressHapticEnabled) (0, _hapticUtils.triggerHaptic)('selection');
89
+ if (pressHaptic) (0, _hapticUtils.triggerHaptic)(pressHaptic);
90
90
  onPress?.(index);
91
91
  };
92
92
  const inner = /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
@@ -181,6 +181,7 @@ const Stepper = exports.Stepper = /*#__PURE__*/(0, _react.forwardRef)((props, re
181
181
  circleStyle,
182
182
  labelStyle,
183
183
  connectorStyle,
184
+ haptic,
184
185
  testID
185
186
  } = props;
186
187
  const theme = (0, _index.useTheme)();
@@ -189,7 +190,7 @@ const Stepper = exports.Stepper = /*#__PURE__*/(0, _react.forwardRef)((props, re
189
190
  const pulseSize = stepperTheme?.pulseSize ?? PULSE_SIZE;
190
191
  const pulseEnabled = stepperTheme?.pulseAnimation ?? false;
191
192
  const pulseDuration = stepperTheme?.pulseDuration ?? PULSE_DURATION;
192
- const pressHapticEnabled = stepperTheme?.pressHaptic ?? false;
193
+ const pressHaptic = (0, _hapticUtils.resolveHaptic)(haptic, 'selection');
193
194
  const styles = (0, _react.useMemo)(() => buildStyles(theme), [theme]);
194
195
  const toneColor = toneColorFor(theme, tone);
195
196
  const upcomingColor = theme.colors.border.primary;
@@ -270,7 +271,7 @@ const Stepper = exports.Stepper = /*#__PURE__*/(0, _react.forwardRef)((props, re
270
271
  pulseSize: pulseSize,
271
272
  pulseEnabled: pulseEnabled,
272
273
  pulseDuration: pulseDuration,
273
- pressHapticEnabled: pressHapticEnabled,
274
+ pressHaptic: pressHaptic,
274
275
  circleSlotStyle: circleStyle
275
276
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
276
277
  style: [styles.hLabel, {
@@ -309,7 +310,7 @@ const Stepper = exports.Stepper = /*#__PURE__*/(0, _react.forwardRef)((props, re
309
310
  pulseSize: pulseSize,
310
311
  pulseEnabled: pulseEnabled,
311
312
  pulseDuration: pulseDuration,
312
- pressHapticEnabled: pressHapticEnabled,
313
+ pressHaptic: pressHaptic,
313
314
  circleSlotStyle: circleStyle
314
315
  }), !isLast ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
315
316
  style: [styles.vConnectorContainer, connectorStyle],
@@ -62,6 +62,7 @@ const Swipeable = props => {
62
62
  onSwipeOpen,
63
63
  onSwipeClose,
64
64
  disabled = false,
65
+ haptic,
65
66
  containerStyle,
66
67
  contentStyle: contentSlotStyle,
67
68
  actionStyle,
@@ -80,9 +81,6 @@ const Swipeable = props => {
80
81
  stiffness: swipeTheme?.springStiffness ?? SPRING_CONFIG.stiffness,
81
82
  mass: swipeTheme?.springMass ?? SPRING_CONFIG.mass
82
83
  };
83
- const fullSwipeHapticEnabled = swipeTheme?.fullSwipeHaptic ?? true;
84
- const actionPressHapticEnabled = swipeTheme?.actionPressHaptic ?? true;
85
- const a11yActionHapticEnabled = swipeTheme?.a11yActionHaptic ?? true;
86
84
  const styles = (0, _react.useMemo)(() => buildStyles(theme), [theme]);
87
85
  const hasLeft = !!leftActions && leftActions.length > 0;
88
86
  const hasRight = !!rightActions && rightActions.length > 0;
@@ -122,22 +120,23 @@ const Swipeable = props => {
122
120
  const list = side === 'left' ? leftActions : rightActions;
123
121
  const first = list?.[0];
124
122
  if (!first) return;
125
- if (fullSwipeHapticEnabled) (0, _index2.triggerHaptic)('notificationSuccess');
123
+ if (haptic !== false) (0, _index2.triggerHaptic)('notificationSuccess');
126
124
  first.onPress();
127
125
  // After the off-screen slide, snap back to 0 silently.
128
126
  translateX.value = (0, _reactNativeReanimated.withSpring)(0, springConfig);
129
127
  openSideRef.current = null;
130
128
  onSwipeClose?.();
131
- }, [leftActions, rightActions, translateX, onSwipeClose, springConfig, fullSwipeHapticEnabled]);
129
+ }, [leftActions, rightActions, translateX, onSwipeClose, springConfig, haptic]);
132
130
  const close = (0, _react.useCallback)(() => {
133
131
  translateX.value = (0, _reactNativeReanimated.withSpring)(0, springConfig);
134
132
  notifyClose();
135
133
  }, [translateX, notifyClose, springConfig]);
136
134
  const handleActionPress = (0, _react.useCallback)(action => {
137
- if (actionPressHapticEnabled) (0, _index2.triggerHaptic)('selection');
135
+ const h = (0, _index2.resolveHaptic)(haptic, 'selection');
136
+ if (h) (0, _index2.triggerHaptic)(h);
138
137
  action.onPress();
139
138
  close();
140
- }, [close, actionPressHapticEnabled]);
139
+ }, [close, haptic]);
141
140
 
142
141
  // ───────── Pan gesture (UI thread) ─────────
143
142
  const panGesture = (0, _react.useMemo)(() => {
@@ -243,10 +242,10 @@ const Swipeable = props => {
243
242
  const all = [...(leftActions ?? []), ...(rightActions ?? [])];
244
243
  const match = all.find(a => a.key === name);
245
244
  if (match) {
246
- if (a11yActionHapticEnabled) (0, _index2.triggerHaptic)('selection');
245
+ if (haptic !== false) (0, _index2.triggerHaptic)('selection');
247
246
  match.onPress();
248
247
  }
249
- }, [leftActions, rightActions, a11yActionHapticEnabled]);
248
+ }, [leftActions, rightActions, haptic]);
250
249
 
251
250
  // ───────── Render ─────────
252
251
  // No actions configured → render children directly; zero gesture overhead.
@@ -7,6 +7,7 @@ exports.default = exports.Switch = void 0;
7
7
  var _react = _interopRequireWildcard(require("react"));
8
8
  var _reactNative = require("react-native");
9
9
  var _index = require("../../theme/index.js");
10
+ var _index2 = require("../../hooks/index.js");
10
11
  var _hapticUtils = require("../../utils/hapticUtils.js");
11
12
  var _jsxRuntime = require("react/jsx-runtime");
12
13
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
@@ -46,7 +47,8 @@ const toneColor = (theme, tone) => {
46
47
  const Switch = exports.Switch = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
47
48
  const {
48
49
  value,
49
- onValueChange,
50
+ defaultValue,
51
+ onChange,
50
52
  disabled = false,
51
53
  size = 'md',
52
54
  tone = 'primary',
@@ -61,6 +63,11 @@ const Switch = exports.Switch = /*#__PURE__*/(0, _react.forwardRef)((props, ref)
61
63
  testID,
62
64
  ...rest
63
65
  } = props;
66
+ const [current, setCurrent] = (0, _index2.useControllableState)({
67
+ value,
68
+ defaultValue: defaultValue ?? false,
69
+ onChange
70
+ });
64
71
  const theme = (0, _index.useTheme)();
65
72
  const sizeStyles = {
66
73
  ...sizeMap[size],
@@ -70,25 +77,29 @@ const Switch = exports.Switch = /*#__PURE__*/(0, _react.forwardRef)((props, ref)
70
77
  const styles = (0, _react.useMemo)(() => buildStyles(theme), [theme]);
71
78
  const offTrackColor = theme.mode === 'dark' ? theme.colors.secondary : theme.colors.surface.disabled;
72
79
  const onTrackColor = toneColor(theme, tone);
73
- const progress = (0, _react.useRef)((0, _index.createAnimatedValue)(value ? 1 : 0)).current;
80
+ const progress = (0, _react.useRef)((0, _index.createAnimatedValue)(current ? 1 : 0)).current;
74
81
  (0, _react.useEffect)(() => {
75
- _reactNative.Animated.spring(progress, {
76
- toValue: value ? 1 : 0,
82
+ const anim = _reactNative.Animated.spring(progress, {
83
+ toValue: current ? 1 : 0,
77
84
  damping: theme.motion.spring.snappy.damping,
78
85
  stiffness: theme.motion.spring.snappy.stiffness,
79
86
  mass: theme.motion.spring.snappy.mass,
80
87
  useNativeDriver: true
81
- }).start();
82
- }, [value, progress, theme.motion.spring.snappy]);
83
- const trackBgAnim = (0, _react.useRef)((0, _index.createAnimatedValue)(value ? 1 : 0)).current;
88
+ });
89
+ anim.start();
90
+ return () => anim.stop();
91
+ }, [current, progress, theme.motion.spring.snappy]);
92
+ const trackBgAnim = (0, _react.useRef)((0, _index.createAnimatedValue)(current ? 1 : 0)).current;
84
93
  (0, _react.useEffect)(() => {
85
- _reactNative.Animated.timing(trackBgAnim, {
86
- toValue: value ? 1 : 0,
94
+ const anim = _reactNative.Animated.timing(trackBgAnim, {
95
+ toValue: current ? 1 : 0,
87
96
  duration: theme.motion.duration.fast,
88
97
  easing: _reactNative.Easing.out(_reactNative.Easing.ease),
89
98
  useNativeDriver: false
90
- }).start();
91
- }, [value, trackBgAnim, theme.motion.duration.fast]);
99
+ });
100
+ anim.start();
101
+ return () => anim.stop();
102
+ }, [current, trackBgAnim, theme.motion.duration.fast]);
92
103
  const offX = sizeStyles.padding;
93
104
  const onX = sizeStyles.trackWidth - sizeStyles.thumbSize - sizeStyles.padding;
94
105
  const translateX = progress.interpolate({
@@ -107,7 +118,7 @@ const Switch = exports.Switch = /*#__PURE__*/(0, _react.forwardRef)((props, ref)
107
118
  isFirstRender.current = false;
108
119
  return;
109
120
  }
110
- _reactNative.Animated.sequence([_reactNative.Animated.spring(bounceScale, {
121
+ const anim = _reactNative.Animated.sequence([_reactNative.Animated.spring(bounceScale, {
111
122
  toValue: 1.15,
112
123
  damping: 10,
113
124
  stiffness: 220,
@@ -119,12 +130,14 @@ const Switch = exports.Switch = /*#__PURE__*/(0, _react.forwardRef)((props, ref)
119
130
  stiffness: 240,
120
131
  mass: 1,
121
132
  useNativeDriver: true
122
- })]).start();
123
- }, [value, bounce, bounceScale]);
133
+ })]);
134
+ anim.start();
135
+ return () => anim.stop();
136
+ }, [current, bounce, bounceScale]);
124
137
  const handlePress = event => {
125
138
  if (disabled) return;
126
139
  if (haptic !== false) (0, _hapticUtils.triggerHaptic)(haptic);
127
- onValueChange(!value);
140
+ setCurrent(!current);
128
141
  rest.onPressOut?.(event);
129
142
  };
130
143
  const accessibleLabel = accessibilityLabel ?? label;
@@ -135,7 +148,7 @@ const Switch = exports.Switch = /*#__PURE__*/(0, _react.forwardRef)((props, ref)
135
148
  accessibilityRole: "switch",
136
149
  accessibilityLabel: accessibleLabel,
137
150
  accessibilityState: {
138
- checked: value,
151
+ checked: current,
139
152
  disabled
140
153
  },
141
154
  testID: testID,
@@ -38,6 +38,7 @@ const Tabs = exports.Tabs = /*#__PURE__*/(0, _react.forwardRef)((props, ref) =>
38
38
  dividerStyle,
39
39
  indicatorStyle,
40
40
  progress,
41
+ haptic,
41
42
  accessibilityLabel,
42
43
  testID
43
44
  } = props;
@@ -51,7 +52,6 @@ const Tabs = exports.Tabs = /*#__PURE__*/(0, _react.forwardRef)((props, ref) =>
51
52
  const pillInset = tabsTokens?.pillInset ?? 4;
52
53
  const disabledOpacity = tabsTokens?.disabledOpacity ?? 0.45;
53
54
  const badgeGap = tabsTokens?.badgeGap ?? 6;
54
- const hapticOnPress = tabsTokens?.hapticOnPress ?? false;
55
55
 
56
56
  // Per-tab measured layouts (key → {x, width}).
57
57
  const [layouts, setLayouts] = (0, _react.useState)({});
@@ -87,7 +87,7 @@ const Tabs = exports.Tabs = /*#__PURE__*/(0, _react.forwardRef)((props, ref) =>
87
87
  if (!activeLayout) return;
88
88
  if (useProgress) return;
89
89
  const spring = theme.motion.spring.snappy;
90
- _reactNative.Animated.parallel([
90
+ const anim = _reactNative.Animated.parallel([
91
91
  // Both must use the JS driver: width can't run on native, and mixing
92
92
  // drivers on the same view (transform native + width JS) trips RN's
93
93
  // "node already moved to native" guard under the new architecture.
@@ -103,7 +103,9 @@ const Tabs = exports.Tabs = /*#__PURE__*/(0, _react.forwardRef)((props, ref) =>
103
103
  stiffness: spring.stiffness,
104
104
  mass: spring.mass,
105
105
  useNativeDriver: false
106
- })]).start();
106
+ })]);
107
+ anim.start();
108
+ return () => anim.stop();
107
109
  }, [activeLayout, activeKey, indicatorTranslateX, indicatorWidth, theme.motion.spring.snappy, useProgress]);
108
110
  const handleLayout = (0, _react.useCallback)(key => e => {
109
111
  const {
@@ -125,9 +127,10 @@ const Tabs = exports.Tabs = /*#__PURE__*/(0, _react.forwardRef)((props, ref) =>
125
127
  const handlePress = (0, _react.useCallback)(tab => {
126
128
  if (tab.disabled) return;
127
129
  if (tab.key === activeKey) return;
128
- if (hapticOnPress) (0, _index2.triggerHaptic)('selection');
130
+ const h = (0, _index2.resolveHaptic)(haptic, 'selection');
131
+ if (h) (0, _index2.triggerHaptic)(h);
129
132
  onChange(tab.key);
130
- }, [activeKey, onChange, hapticOnPress]);
133
+ }, [activeKey, onChange, haptic]);
131
134
  const indicatorIsPill = variant === 'pills';
132
135
 
133
136
  // Indicator visual.
@@ -0,0 +1,142 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = exports.Text = void 0;
7
+ var _react = _interopRequireWildcard(require("react"));
8
+ var _reactNative = require("react-native");
9
+ var _index = require("../../theme/index.js");
10
+ var _jsxRuntime = require("react/jsx-runtime");
11
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
12
+ const VARIANTS = {
13
+ display: {
14
+ size: '4xl',
15
+ weight: 'bold',
16
+ line: 'tight',
17
+ color: 'primary',
18
+ heading: true
19
+ },
20
+ h1: {
21
+ size: '3xl',
22
+ weight: 'bold',
23
+ line: 'tight',
24
+ color: 'primary',
25
+ heading: true
26
+ },
27
+ h2: {
28
+ size: '2xl',
29
+ weight: 'semibold',
30
+ line: 'tight',
31
+ color: 'primary',
32
+ heading: true
33
+ },
34
+ h3: {
35
+ size: 'xl',
36
+ weight: 'semibold',
37
+ line: 'tight',
38
+ color: 'primary',
39
+ heading: true
40
+ },
41
+ title: {
42
+ size: 'lg',
43
+ weight: 'semibold',
44
+ line: 'normal',
45
+ color: 'primary'
46
+ },
47
+ body: {
48
+ size: 'base',
49
+ weight: 'normal',
50
+ line: 'normal',
51
+ color: 'primary'
52
+ },
53
+ bodySmall: {
54
+ size: 'sm',
55
+ weight: 'normal',
56
+ line: 'normal',
57
+ color: 'secondary'
58
+ },
59
+ caption: {
60
+ size: 'xs',
61
+ weight: 'normal',
62
+ line: 'normal',
63
+ color: 'tertiary'
64
+ },
65
+ label: {
66
+ size: 'sm',
67
+ weight: 'medium',
68
+ line: 'normal',
69
+ color: 'secondary'
70
+ },
71
+ overline: {
72
+ size: 'xs',
73
+ weight: 'semibold',
74
+ line: 'normal',
75
+ color: 'secondary',
76
+ uppercase: true,
77
+ letterSpacing: 'wide'
78
+ }
79
+ };
80
+ const TEXT_ROLES = {
81
+ primary: true,
82
+ secondary: true,
83
+ tertiary: true,
84
+ inverse: true,
85
+ disabled: true,
86
+ link: true
87
+ };
88
+ const SEMANTIC = {
89
+ success: true,
90
+ warning: true,
91
+ error: true,
92
+ info: true
93
+ };
94
+ const resolveColor = (theme, color) => {
95
+ // Text roles win over the same-named brand colour ('primary' -> text.primary),
96
+ // which is the intent the vast majority of the time for text.
97
+ if (TEXT_ROLES[color]) return theme.colors.text[color];
98
+ if (SEMANTIC[color]) return theme.colors[color];
99
+ return color; // raw colour string
100
+ };
101
+ const Text = exports.Text = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
102
+ const {
103
+ variant = 'body',
104
+ color,
105
+ weight,
106
+ size,
107
+ align,
108
+ italic,
109
+ underline,
110
+ style,
111
+ children,
112
+ ...rest
113
+ } = props;
114
+ const theme = (0, _index.useTheme)();
115
+ const textStyle = (0, _react.useMemo)(() => {
116
+ const spec = VARIANTS[variant];
117
+ const fontSize = typeof size === 'number' ? size : theme.typography.fontSize[size ?? spec.size];
118
+ const lineHeight = Math.round(fontSize * theme.typography.lineHeight[spec.line]);
119
+ return {
120
+ fontSize,
121
+ lineHeight,
122
+ color: resolveColor(theme, color ?? spec.color),
123
+ textAlign: align,
124
+ textTransform: spec.uppercase ? 'uppercase' : undefined,
125
+ letterSpacing: spec.letterSpacing ? theme.typography.letterSpacing[spec.letterSpacing] : undefined,
126
+ fontStyle: italic ? 'italic' : undefined,
127
+ textDecorationLine: underline ? 'underline' : undefined,
128
+ ...(0, _index.fontFor)(theme, weight ?? spec.weight)
129
+ };
130
+ }, [theme, variant, color, weight, size, align, italic, underline]);
131
+ const heading = VARIANTS[variant].heading;
132
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
133
+ ref: ref,
134
+ style: [textStyle, style],
135
+ accessibilityRole: heading ? 'header' : rest.accessibilityRole,
136
+ ...rest,
137
+ children: children
138
+ });
139
+ });
140
+ Text.displayName = 'Text';
141
+ var _default = exports.default = Text;
142
+ //# sourceMappingURL=Text.js.map
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "Text", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _Text.Text;
10
+ }
11
+ });
12
+ var _Text = require("./Text.js");
13
+ //# sourceMappingURL=index.js.map
@@ -17,12 +17,12 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
17
17
  /**
18
18
  * TimePicker supports two modes:
19
19
  *
20
- * 1. Controlled-modal mode — pass `visible`, `onSelect`, `onClose`. The
20
+ * 1. Controlled-modal mode — pass `visible`, `onChange`, `onClose`. The
21
21
  * component renders only the modal sheet and the caller owns open/close
22
22
  * state plus its own trigger UI.
23
23
  * 2. Trigger mode — omit `visible`. The component renders a PickerTrigger
24
24
  * field (label / value / placeholder / chevron / clear / helper / error)
25
- * and manages its own modal open state. `onSelect` is still called on
25
+ * and manages its own modal open state. `onChange` is still called on
26
26
  * confirm.
27
27
  */
28
28
 
@@ -76,6 +76,7 @@ const Wheel = ({
76
76
  onIndexChange,
77
77
  formatItem,
78
78
  theme,
79
+ haptic,
79
80
  testID
80
81
  }) => {
81
82
  const listRef = (0, _react.useRef)(null);
@@ -98,7 +99,6 @@ const Wheel = ({
98
99
  });
99
100
  }
100
101
  }, [selectedIndex, scrollY]);
101
- const hapticEnabled = theme.components.timePicker?.haptic ?? false;
102
102
  const hapticDebounceMs = theme.components.timePicker?.hapticDebounceMs ?? HAPTIC_DEBOUNCE_MS;
103
103
  const onScroll = (0, _react.useMemo)(() => _reactNative.Animated.event([{
104
104
  nativeEvent: {
@@ -113,14 +113,15 @@ const Wheel = ({
113
113
  const idx = Math.round(y / ITEM_HEIGHT);
114
114
  if (idx !== lastIndexRef.current && idx >= 0 && idx < data.length) {
115
115
  const now = Date.now();
116
- if (hapticEnabled && now - lastHapticAtRef.current >= hapticDebounceMs) {
117
- (0, _hapticUtils.triggerHaptic)('selection');
116
+ if (now - lastHapticAtRef.current >= hapticDebounceMs) {
117
+ const h = (0, _hapticUtils.resolveHaptic)(haptic, 'selection');
118
+ if (h) (0, _hapticUtils.triggerHaptic)(h);
118
119
  lastHapticAtRef.current = now;
119
120
  }
120
121
  lastIndexRef.current = idx;
121
122
  }
122
123
  }
123
- }), [scrollY, data.length, hapticEnabled, hapticDebounceMs]);
124
+ }), [scrollY, data.length, haptic, hapticDebounceMs]);
124
125
  const onMomentumScrollEnd = (0, _react.useCallback)(event => {
125
126
  const y = event.nativeEvent.contentOffset.y;
126
127
  const idx = Math.max(0, Math.min(data.length - 1, Math.round(y / ITEM_HEIGHT)));
@@ -223,7 +224,7 @@ const TimePicker = props => {
223
224
  const {
224
225
  visible,
225
226
  value,
226
- onSelect,
227
+ onChange,
227
228
  onClose,
228
229
  format = '12h',
229
230
  minuteStep = 1,
@@ -246,7 +247,8 @@ const TimePicker = props => {
246
247
  clearable,
247
248
  onClear,
248
249
  formatValue,
249
- triggerStyle
250
+ triggerStyle,
251
+ haptic
250
252
  } = props;
251
253
  const isControlled = props.visible !== undefined;
252
254
  const [internalOpen, setInternalOpen] = (0, _react.useState)(false);
@@ -310,8 +312,9 @@ const TimePicker = props => {
310
312
  const opacity = (0, _react.useRef)((0, _index.createAnimatedValue)(0)).current;
311
313
  const translateY = (0, _react.useRef)((0, _index.createAnimatedValue)(40)).current;
312
314
  (0, _react.useEffect)(() => {
315
+ let anim;
313
316
  if (open) {
314
- _reactNative.Animated.parallel([
317
+ anim = _reactNative.Animated.parallel([
315
318
  // Backdrop opacity uses JS driver — see Modal.tsx for the Fabric reason.
316
319
  _reactNative.Animated.timing(opacity, {
317
320
  toValue: 1,
@@ -324,11 +327,13 @@ const TimePicker = props => {
324
327
  stiffness: theme.motion.spring.snappy.stiffness,
325
328
  mass: theme.motion.spring.snappy.mass,
326
329
  useNativeDriver: true
327
- })]).start();
330
+ })]);
331
+ anim.start();
328
332
  } else {
329
333
  opacity.setValue(0);
330
334
  (0, _index.setNativeValue)(translateY, 40);
331
335
  }
336
+ return () => anim?.stop();
332
337
  }, [open, opacity, translateY, theme.motion]);
333
338
  const announce = (0, _react.useCallback)(msg => {
334
339
  if (_reactNative.Platform.OS === 'ios' || _reactNative.Platform.OS === 'android') {
@@ -348,21 +353,21 @@ const TimePicker = props => {
348
353
  announce(periods[idx] ?? '');
349
354
  }, [periods, announce]);
350
355
  const handleCancel = (0, _react.useCallback)(() => {
351
- if (theme.components.timePicker?.haptic) (0, _hapticUtils.triggerHaptic)('selection');
356
+ if (haptic !== false) (0, _hapticUtils.triggerHaptic)('selection');
352
357
  handleCloseModal();
353
- }, [handleCloseModal, theme.components.timePicker]);
358
+ }, [handleCloseModal, haptic]);
354
359
  const handleConfirm = (0, _react.useCallback)(() => {
355
360
  const displayHour = hours[hourIndex] ?? 0;
356
361
  const period = periods[periodIndex] ?? 'AM';
357
362
  const hour24 = to24h(displayHour, period, format);
358
363
  const minute = minutes[minuteIndex] ?? 0;
359
- if (theme.components.timePicker?.haptic) (0, _hapticUtils.triggerHaptic)('notificationSuccess');
360
- onSelect?.({
364
+ if (haptic !== false) (0, _hapticUtils.triggerHaptic)('notificationSuccess');
365
+ onChange?.({
361
366
  hour: hour24,
362
367
  minute
363
368
  });
364
369
  handleCloseModal();
365
- }, [hours, hourIndex, periods, periodIndex, minutes, minuteIndex, format, onSelect, handleCloseModal, theme.components.timePicker]);
370
+ }, [hours, hourIndex, periods, periodIndex, minutes, minuteIndex, format, onChange, handleCloseModal, haptic]);
366
371
  const summary = (0, _react.useMemo)(() => {
367
372
  const displayHour = hours[hourIndex] ?? 0;
368
373
  const minute = minutes[minuteIndex] ?? 0;
@@ -446,6 +451,7 @@ const TimePicker = props => {
446
451
  onIndexChange: handleHourIndex,
447
452
  formatItem: formatHourItem,
448
453
  theme: theme,
454
+ haptic: haptic,
449
455
  testID: "time-picker-hour"
450
456
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
451
457
  style: styles.separator,
@@ -458,6 +464,7 @@ const TimePicker = props => {
458
464
  onIndexChange: handleMinuteIndex,
459
465
  formatItem: formatMinuteItem,
460
466
  theme: theme,
467
+ haptic: haptic,
461
468
  testID: "time-picker-minute"
462
469
  }), format === '12h' ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
463
470
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
@@ -470,6 +477,7 @@ const TimePicker = props => {
470
477
  onIndexChange: handlePeriodIndex,
471
478
  formatItem: formatPeriodItem,
472
479
  theme: theme,
480
+ haptic: haptic,
473
481
  testID: "time-picker-period"
474
482
  })]
475
483
  }) : null]
@@ -44,6 +44,18 @@ const Toast = ({
44
44
  const translateX = (0, _react.useRef)((0, _index.createAnimatedValue)(0)).current;
45
45
  const opacity = (0, _react.useRef)((0, _index.createAnimatedValue)(0)).current;
46
46
  const dismissedRef = (0, _react.useRef)(false);
47
+ const stackTranslate = position === 'top' ? index * stackOffset : -index * stackOffset;
48
+ const stackScale = Math.max(1 - index * stackScaleStep, stackMinScale);
49
+
50
+ // The stack offset rides on its own value so the enter spring (translateY)
51
+ // and the layout offset compose once instead of rebuilding a fresh
52
+ // `new Animated.Value` + `Animated.add` node on every render. setNativeValue
53
+ // keeps it in sync after the node has moved to the native driver.
54
+ const stackTranslateY = (0, _react.useRef)((0, _index.createAnimatedValue)(stackTranslate)).current;
55
+ (0, _react.useEffect)(() => {
56
+ (0, _index.setNativeValue)(stackTranslateY, stackTranslate);
57
+ }, [stackTranslate, stackTranslateY]);
58
+ const composedTranslateY = (0, _react.useMemo)(() => _reactNative.Animated.add(translateY, stackTranslateY), [translateY, stackTranslateY]);
47
59
  const dismiss = (animateOut = true) => {
48
60
  if (dismissedRef.current) return;
49
61
  dismissedRef.current = true;
@@ -62,7 +74,7 @@ const Toast = ({
62
74
  }
63
75
  };
64
76
  (0, _react.useEffect)(() => {
65
- _reactNative.Animated.parallel([_reactNative.Animated.spring(translateY, {
77
+ const enter = _reactNative.Animated.parallel([_reactNative.Animated.spring(translateY, {
66
78
  toValue: 0,
67
79
  damping: enterSpringDamping,
68
80
  stiffness: enterSpringStiffness,
@@ -72,13 +84,17 @@ const Toast = ({
72
84
  toValue: 1,
73
85
  duration: theme.motion.duration.fast,
74
86
  useNativeDriver: true
75
- })]).start();
87
+ })]);
88
+ enter.start();
76
89
  const duration = toast.duration ?? defaultDurationMs;
77
90
  if (duration > 0) {
78
91
  const timer = setTimeout(() => dismiss(true), duration);
79
- return () => clearTimeout(timer);
92
+ return () => {
93
+ enter.stop();
94
+ clearTimeout(timer);
95
+ };
80
96
  }
81
- return undefined;
97
+ return () => enter.stop();
82
98
  // eslint-disable-next-line react-hooks/exhaustive-deps
83
99
  }, []);
84
100
  const panResponder = (0, _react.useMemo)(() => _reactNative.PanResponder.create({
@@ -113,11 +129,7 @@ const Toast = ({
113
129
  })]).start();
114
130
  }
115
131
  }
116
- }),
117
- // eslint-disable-next-line react-hooks/exhaustive-deps
118
- []);
119
- const stackTranslate = position === 'top' ? index * stackOffset : -index * stackOffset;
120
- const stackScale = Math.max(1 - index * stackScaleStep, stackMinScale);
132
+ }), [translateX, opacity, swipeDismissThreshold, swipeVelocityThreshold, theme.motion.duration.fast, onDismiss, toast.id]);
121
133
  const handleActionPress = () => {
122
134
  toast.action?.onPress();
123
135
  dismiss(true);
@@ -157,7 +169,7 @@ const Toast = ({
157
169
  shadowColor: theme.shadows.md.shadowColor,
158
170
  opacity,
159
171
  transform: [{
160
- translateY: _reactNative.Animated.add(translateY, new _reactNative.Animated.Value(stackTranslate))
172
+ translateY: composedTranslateY
161
173
  }, {
162
174
  translateX
163
175
  }, {
@@ -107,6 +107,7 @@ const Tooltip = props => {
107
107
  }
108
108
  };
109
109
  }
110
+ let anim;
110
111
  if (visible) {
111
112
  measureAnchor();
112
113
  const enterAnims = [_reactNative.Animated.timing(opacity, {
@@ -123,7 +124,8 @@ const Tooltip = props => {
123
124
  useNativeDriver: true
124
125
  }));
125
126
  }
126
- _reactNative.Animated.parallel(enterAnims).start();
127
+ anim = _reactNative.Animated.parallel(enterAnims);
128
+ anim.start();
127
129
  if (trigger === 'press') {
128
130
  if (autoHideTimer.current) clearTimeout(autoHideTimer.current);
129
131
  autoHideTimer.current = setTimeout(() => {
@@ -143,13 +145,15 @@ const Tooltip = props => {
143
145
  useNativeDriver: true
144
146
  }));
145
147
  }
146
- _reactNative.Animated.parallel(exitAnims).start();
148
+ anim = _reactNative.Animated.parallel(exitAnims);
149
+ anim.start();
147
150
  if (autoHideTimer.current) {
148
151
  clearTimeout(autoHideTimer.current);
149
152
  autoHideTimer.current = null;
150
153
  }
151
154
  }
152
155
  return () => {
156
+ anim?.stop();
153
157
  if (autoHideTimer.current) {
154
158
  clearTimeout(autoHideTimer.current);
155
159
  autoHideTimer.current = null;