@webority-technologies/mobile 0.0.8 → 0.0.9
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/lib/commonjs/components/Accordion/Accordion.js +3 -3
- package/lib/commonjs/components/Avatar/Avatar.js +1 -1
- package/lib/commonjs/components/Badge/Badge.js +1 -1
- package/lib/commonjs/components/Banner/Banner.js +2 -2
- package/lib/commonjs/components/BottomNavigation/BottomNavigation.js +1 -1
- package/lib/commonjs/components/Carousel/Carousel.js +2 -2
- package/lib/commonjs/components/Checkbox/Checkbox.js +1 -1
- package/lib/commonjs/components/DatePicker/DatePicker.js +8 -8
- package/lib/commonjs/components/DateRangePicker/DateRangePicker.js +4 -4
- package/lib/commonjs/components/FloatingActionButton/FloatingActionButton.js +2 -2
- package/lib/commonjs/components/FormField/FormField.js +1 -1
- package/lib/commonjs/components/Input/Input.js +5 -5
- package/lib/commonjs/components/Modal/Modal.js +4 -4
- package/lib/commonjs/components/OTPInput/OTPInput.js +1 -1
- package/lib/commonjs/components/ProgressBar/ProgressBar.js +2 -2
- package/lib/commonjs/components/Radio/Radio.js +1 -1
- package/lib/commonjs/components/SearchBar/SearchBar.js +1 -1
- package/lib/commonjs/components/SegmentedControl/SegmentedControl.js +2 -2
- package/lib/commonjs/components/Select/Select.js +3 -3
- package/lib/commonjs/components/Skeleton/Skeleton.js +1 -1
- package/lib/commonjs/components/Slider/Slider.js +6 -6
- package/lib/commonjs/components/Spinner/Spinner.js +2 -2
- package/lib/commonjs/components/Stepper/Stepper.js +3 -3
- package/lib/commonjs/components/Switch/Switch.js +3 -3
- package/lib/commonjs/components/Tabs/Tabs.js +2 -2
- package/lib/commonjs/components/TimePicker/TimePicker.js +3 -3
- package/lib/commonjs/components/Toast/Toast.js +3 -3
- package/lib/commonjs/components/Tooltip/Tooltip.js +2 -2
- package/lib/commonjs/theme/animatedValue.js +28 -0
- package/lib/commonjs/theme/index.js +7 -0
- package/lib/module/components/Accordion/Accordion.js +4 -4
- package/lib/module/components/Avatar/Avatar.js +2 -2
- package/lib/module/components/Badge/Badge.js +2 -2
- package/lib/module/components/Banner/Banner.js +3 -3
- package/lib/module/components/BottomNavigation/BottomNavigation.js +2 -2
- package/lib/module/components/Carousel/Carousel.js +3 -3
- package/lib/module/components/Checkbox/Checkbox.js +2 -2
- package/lib/module/components/DatePicker/DatePicker.js +9 -9
- package/lib/module/components/DateRangePicker/DateRangePicker.js +5 -5
- package/lib/module/components/FloatingActionButton/FloatingActionButton.js +3 -3
- package/lib/module/components/FormField/FormField.js +2 -2
- package/lib/module/components/Input/Input.js +6 -6
- package/lib/module/components/Modal/Modal.js +5 -5
- package/lib/module/components/OTPInput/OTPInput.js +2 -2
- package/lib/module/components/ProgressBar/ProgressBar.js +3 -3
- package/lib/module/components/Radio/Radio.js +2 -2
- package/lib/module/components/SearchBar/SearchBar.js +2 -2
- package/lib/module/components/SegmentedControl/SegmentedControl.js +3 -3
- package/lib/module/components/Select/Select.js +4 -4
- package/lib/module/components/Skeleton/Skeleton.js +2 -2
- package/lib/module/components/Slider/Slider.js +7 -7
- package/lib/module/components/Spinner/Spinner.js +3 -3
- package/lib/module/components/Stepper/Stepper.js +4 -4
- package/lib/module/components/Switch/Switch.js +4 -4
- package/lib/module/components/Tabs/Tabs.js +3 -3
- package/lib/module/components/TimePicker/TimePicker.js +4 -4
- package/lib/module/components/Toast/Toast.js +4 -4
- package/lib/module/components/Tooltip/Tooltip.js +3 -3
- package/lib/module/theme/animatedValue.js +24 -0
- package/lib/module/theme/index.js +1 -0
- package/lib/typescript/commonjs/theme/animatedValue.d.ts +21 -0
- package/lib/typescript/commonjs/theme/index.d.ts +1 -0
- package/lib/typescript/module/theme/animatedValue.d.ts +21 -0
- package/lib/typescript/module/theme/index.d.ts +1 -0
- package/package.json +1 -1
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import React, { forwardRef, useEffect, useMemo, useRef } 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 { triggerHaptic } from "../../utils/hapticUtils.js";
|
|
7
7
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
8
|
const sizeMap = {
|
|
@@ -46,7 +46,7 @@ const Checkbox = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
46
46
|
const checkboxLabelGap = theme.components.checkbox?.labelGap ?? 10;
|
|
47
47
|
const fillColor = toneColor(theme, tone);
|
|
48
48
|
const isActive = checked || indeterminate;
|
|
49
|
-
const progress = useRef(
|
|
49
|
+
const progress = useRef(createAnimatedValue(isActive ? 1 : 0)).current;
|
|
50
50
|
useEffect(() => {
|
|
51
51
|
Animated.spring(progress, {
|
|
52
52
|
toValue: isActive ? 1 : 0,
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
4
4
|
import { AccessibilityInfo, Animated, Easing, Modal, 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/index.js";
|
|
7
7
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
8
8
|
const DAY_MS = 24 * 60 * 60 * 1000;
|
|
@@ -106,14 +106,14 @@ const DatePicker = props => {
|
|
|
106
106
|
const [viewMode, setViewMode] = useState('days');
|
|
107
107
|
|
|
108
108
|
// Animations
|
|
109
|
-
const backdrop = useRef(
|
|
110
|
-
const sheet = useRef(
|
|
111
|
-
const monthSlide = useRef(
|
|
112
|
-
const monthFade = useRef(
|
|
113
|
-
const selectScale = useRef(
|
|
114
|
-
const viewFade = useRef(
|
|
115
|
-
const viewScale = useRef(
|
|
116
|
-
const headerScale = useRef(
|
|
109
|
+
const backdrop = useRef(createAnimatedValue(0)).current;
|
|
110
|
+
const sheet = useRef(createAnimatedValue(0)).current;
|
|
111
|
+
const monthSlide = useRef(createAnimatedValue(0)).current;
|
|
112
|
+
const monthFade = useRef(createAnimatedValue(1)).current;
|
|
113
|
+
const selectScale = useRef(createAnimatedValue(1)).current;
|
|
114
|
+
const viewFade = useRef(createAnimatedValue(1)).current;
|
|
115
|
+
const viewScale = useRef(createAnimatedValue(1)).current;
|
|
116
|
+
const headerScale = useRef(createAnimatedValue(1)).current;
|
|
117
117
|
|
|
118
118
|
// Sync anchor / pending when value prop changes.
|
|
119
119
|
useEffect(() => {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import React, { forwardRef, useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
4
4
|
import { AccessibilityInfo, Animated, Easing, Modal, 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/index.js";
|
|
7
7
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
8
|
const DAY_MS = 24 * 60 * 60 * 1000;
|
|
@@ -91,10 +91,10 @@ const DateRangePicker = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
91
91
|
const [pendingEnd, setPendingEnd] = useState(value.end ? startOfDay(value.end) : null);
|
|
92
92
|
|
|
93
93
|
// Animations
|
|
94
|
-
const backdrop = useRef(
|
|
95
|
-
const sheet = useRef(
|
|
96
|
-
const monthSlide = useRef(
|
|
97
|
-
const monthFade = useRef(
|
|
94
|
+
const backdrop = useRef(createAnimatedValue(0)).current;
|
|
95
|
+
const sheet = useRef(createAnimatedValue(0)).current;
|
|
96
|
+
const monthSlide = useRef(createAnimatedValue(0)).current;
|
|
97
|
+
const monthFade = useRef(createAnimatedValue(1)).current;
|
|
98
98
|
|
|
99
99
|
// Sync external value -> pending state when it changes.
|
|
100
100
|
useEffect(() => {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import React, { forwardRef, useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
4
4
|
import { Animated, Easing, 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 { usePressAnimation } from "../../hooks/usePressAnimation.js";
|
|
8
8
|
import { triggerHaptic } from "../../utils/hapticUtils.js";
|
|
9
9
|
import { AppIcon } from "../AppIcon/index.js";
|
|
@@ -78,7 +78,7 @@ const FloatingActionButton = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
78
78
|
} = usePressAnimation({
|
|
79
79
|
enabled: !disabled
|
|
80
80
|
});
|
|
81
|
-
const hideAnim = useRef(
|
|
81
|
+
const hideAnim = useRef(createAnimatedValue(0)).current;
|
|
82
82
|
useEffect(() => {
|
|
83
83
|
if (!hideOnScroll) {
|
|
84
84
|
hideAnim.setValue(0);
|
|
@@ -234,7 +234,7 @@ const FloatingActionButtonGroup = props => {
|
|
|
234
234
|
const isOpen = isControlled ? controlledOpen : internalOpen;
|
|
235
235
|
|
|
236
236
|
// Animation drivers
|
|
237
|
-
const progress = useRef(
|
|
237
|
+
const progress = useRef(createAnimatedValue(isOpen ? 1 : 0)).current;
|
|
238
238
|
const itemAnims = useRef([]);
|
|
239
239
|
|
|
240
240
|
// Resize per-item anim array if action count changes
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import React, { forwardRef, useEffect, useMemo, useRef } from 'react';
|
|
4
4
|
import { Animated, 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 { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
7
7
|
const FormField = /*#__PURE__*/forwardRef((props, ref) => {
|
|
8
8
|
const {
|
|
@@ -21,7 +21,7 @@ const FormField = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
21
21
|
} = props;
|
|
22
22
|
const theme = useTheme();
|
|
23
23
|
const styles = useMemo(() => buildStyles(theme), [theme]);
|
|
24
|
-
const errorOpacity = useRef(
|
|
24
|
+
const errorOpacity = useRef(createAnimatedValue(error ? 1 : 0)).current;
|
|
25
25
|
useEffect(() => {
|
|
26
26
|
Animated.timing(errorOpacity, {
|
|
27
27
|
toValue: error ? 1 : 0,
|
|
@@ -5,7 +5,7 @@ import { Animated, Easing, Pressable, StyleSheet, Text, TextInput, View } from '
|
|
|
5
5
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
6
6
|
// @ts-ignore - react-native-vector-icons ships no bundled types in this version
|
|
7
7
|
import Feather from 'react-native-vector-icons/Feather';
|
|
8
|
-
import { fontFor, useTheme } from "../../theme/index.js";
|
|
8
|
+
import { createAnimatedValue, fontFor, useTheme } from "../../theme/index.js";
|
|
9
9
|
import { triggerHaptic } from "../../utils/index.js";
|
|
10
10
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
11
|
const sizeMap = {
|
|
@@ -82,11 +82,11 @@ const Input = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
82
82
|
const showFloatingLabel = Boolean(label) && !multiline;
|
|
83
83
|
|
|
84
84
|
// Animations
|
|
85
|
-
const focusAnim = useRef(
|
|
86
|
-
const errorAnim = useRef(
|
|
87
|
-
const labelAnim = useRef(
|
|
88
|
-
const shakeAnim = useRef(
|
|
89
|
-
const messageAnim = useRef(
|
|
85
|
+
const focusAnim = useRef(createAnimatedValue(0)).current;
|
|
86
|
+
const errorAnim = useRef(createAnimatedValue(0)).current;
|
|
87
|
+
const labelAnim = useRef(createAnimatedValue(shouldFloat ? 1 : 0)).current;
|
|
88
|
+
const shakeAnim = useRef(createAnimatedValue(0)).current;
|
|
89
|
+
const messageAnim = useRef(createAnimatedValue(hasError || helperText ? 1 : 0)).current;
|
|
90
90
|
|
|
91
91
|
// Focus border animation
|
|
92
92
|
useEffect(() => {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import React, { forwardRef, useCallback, useEffect, useMemo, useRef } from 'react';
|
|
4
4
|
import { AccessibilityInfo, Animated, Dimensions, findNodeHandle, Modal as RNModal, Pressable, StyleSheet, 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 { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
8
|
const Modal = /*#__PURE__*/forwardRef((props, ref) => {
|
|
@@ -24,10 +24,10 @@ const Modal = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
24
24
|
const theme = useTheme();
|
|
25
25
|
const duration = animationDuration ?? theme.motion.duration.normal;
|
|
26
26
|
const screenHeight = Dimensions.get('window').height;
|
|
27
|
-
const backdropAnim = useRef(
|
|
28
|
-
const scaleAnim = useRef(
|
|
29
|
-
const opacityAnim = useRef(
|
|
30
|
-
const translateYAnim = useRef(
|
|
27
|
+
const backdropAnim = useRef(createAnimatedValue(0)).current;
|
|
28
|
+
const scaleAnim = useRef(createAnimatedValue(0.9)).current;
|
|
29
|
+
const opacityAnim = useRef(createAnimatedValue(0)).current;
|
|
30
|
+
const translateYAnim = useRef(createAnimatedValue(screenHeight)).current;
|
|
31
31
|
const containerRef = useRef(null);
|
|
32
32
|
const wasVisibleRef = useRef(false);
|
|
33
33
|
const styles = useMemo(() => buildStyles(theme), [theme]);
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import React, { forwardRef, useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';
|
|
4
4
|
import { Animated, Easing, Pressable, StyleSheet, Text, TextInput, View } from 'react-native';
|
|
5
|
-
import { fontFor, useTheme } from "../../theme/index.js";
|
|
5
|
+
import { fontFor, useTheme, createAnimatedValue } from "../../theme/index.js";
|
|
6
6
|
import { triggerHaptic } from "../../utils/index.js";
|
|
7
7
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
8
|
const sizeMap = {
|
|
@@ -59,7 +59,7 @@ const OTPInput = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
59
59
|
const inputsRef = useRef([]);
|
|
60
60
|
const [focusedIndex, setFocusedIndex] = useState(-1);
|
|
61
61
|
const previousErrorRef = useRef(null);
|
|
62
|
-
const shake = useRef(
|
|
62
|
+
const shake = useRef(createAnimatedValue(0)).current;
|
|
63
63
|
const underlines = useRef(Array.from({
|
|
64
64
|
length
|
|
65
65
|
}, () => new Animated.Value(0))).current;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import React, { forwardRef, useEffect, useMemo, useRef } from 'react';
|
|
4
4
|
import { Animated, Easing, StyleSheet, View } from 'react-native';
|
|
5
|
-
import { useTheme } from "../../theme/index.js";
|
|
5
|
+
import { useTheme, createAnimatedValue } from "../../theme/index.js";
|
|
6
6
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
7
|
const toneColor = (theme, tone) => {
|
|
8
8
|
switch (tone) {
|
|
@@ -40,8 +40,8 @@ const ProgressBar = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
40
40
|
} = props;
|
|
41
41
|
const isIndeterminate = indeterminateProp ?? typeof progress !== 'number';
|
|
42
42
|
const clamped = clampProgress(progress);
|
|
43
|
-
const fillAnim = useRef(
|
|
44
|
-
const loopAnim = useRef(
|
|
43
|
+
const fillAnim = useRef(createAnimatedValue(clamped)).current;
|
|
44
|
+
const loopAnim = useRef(createAnimatedValue(0)).current;
|
|
45
45
|
const widthRef = useRef(0);
|
|
46
46
|
const styles = useMemo(() => buildStyles(theme), [theme]);
|
|
47
47
|
const resolvedRadius = radius ?? theme.radius.full;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import React, { createContext, forwardRef, useContext, useEffect, useMemo, useRef } 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 { triggerHaptic } from "../../utils/hapticUtils.js";
|
|
7
7
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
8
|
export const RadioGroupContext = /*#__PURE__*/createContext(null);
|
|
@@ -61,7 +61,7 @@ const Radio = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
61
61
|
const inner = sizeOverrides?.inner ?? sizeMap[size].inner;
|
|
62
62
|
const radioBorderWidth = theme.components.radio?.borderWidth ?? 1.5;
|
|
63
63
|
const radioLabelGap = theme.components.radio?.labelGap ?? 10;
|
|
64
|
-
const progress = useRef(
|
|
64
|
+
const progress = useRef(createAnimatedValue(selected ? 1 : 0)).current;
|
|
65
65
|
useEffect(() => {
|
|
66
66
|
Animated.spring(progress, {
|
|
67
67
|
toValue: selected ? 1 : 0,
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import React, { forwardRef, useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
4
4
|
import { Animated, Easing, Pressable, StyleSheet, Text, TextInput, View } from 'react-native';
|
|
5
|
-
import { fontFor, useTheme } from "../../theme/index.js";
|
|
5
|
+
import { fontFor, useTheme, createAnimatedValue } from "../../theme/index.js";
|
|
6
6
|
import { triggerHaptic } from "../../utils/hapticUtils.js";
|
|
7
7
|
import { useDebounce } from "../../hooks/useDebounce.js";
|
|
8
8
|
import { AppIcon } from "../AppIcon/index.js";
|
|
@@ -62,7 +62,7 @@ const SearchBar = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
62
62
|
const [isFocused, setIsFocused] = useState(false);
|
|
63
63
|
const [internalValue, setInternalValue] = useState(value);
|
|
64
64
|
const debouncedValue = useDebounce(internalValue, debounceMs ?? 0);
|
|
65
|
-
const cancelAnim = useRef(
|
|
65
|
+
const cancelAnim = useRef(createAnimatedValue(0)).current;
|
|
66
66
|
|
|
67
67
|
// Keep internal value in sync with controlled value when debouncing.
|
|
68
68
|
useEffect(() => {
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
import React, { forwardRef, useCallback, useEffect, useMemo, useRef } from 'react';
|
|
12
12
|
import { Animated, Pressable, StyleSheet, Text, View } from 'react-native';
|
|
13
|
-
import { useTheme } from "../../theme/index.js";
|
|
13
|
+
import { useTheme, createAnimatedValue } from "../../theme/index.js";
|
|
14
14
|
import { triggerHaptic } from "../../utils/index.js";
|
|
15
15
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
16
16
|
const sizeMap = {
|
|
@@ -47,8 +47,8 @@ const SegmentedControl = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
47
47
|
|
|
48
48
|
// Total track width — measured from onLayout; thumb width = trackWidth / segments.length.
|
|
49
49
|
const trackWidthRef = useRef(0);
|
|
50
|
-
const thumbTranslateX = useRef(
|
|
51
|
-
const thumbWidth = useRef(
|
|
50
|
+
const thumbTranslateX = useRef(createAnimatedValue(0)).current;
|
|
51
|
+
const thumbWidth = useRef(createAnimatedValue(0)).current;
|
|
52
52
|
const activeIndex = Math.max(0, segments.findIndex(s => s.value === value));
|
|
53
53
|
const animateThumb = useCallback((index, totalWidth) => {
|
|
54
54
|
if (totalWidth <= 0 || segments.length === 0) return;
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
import React, { forwardRef, useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
12
12
|
import { Animated, Dimensions, Easing, FlatList, Modal, Pressable, StyleSheet, Text, TextInput, View } from 'react-native';
|
|
13
|
-
import { useTheme } from "../../theme/index.js";
|
|
13
|
+
import { useTheme, createAnimatedValue } from "../../theme/index.js";
|
|
14
14
|
import { triggerHaptic } from "../../utils/index.js";
|
|
15
15
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
16
16
|
const sizeMap = {
|
|
@@ -64,8 +64,8 @@ const Select = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
64
64
|
const sheetMaxHeight = Math.round(screenHeight * 0.7);
|
|
65
65
|
|
|
66
66
|
// Animations: backdrop fade + sheet slide-up.
|
|
67
|
-
const backdropAnim = useRef(
|
|
68
|
-
const sheetAnim = useRef(
|
|
67
|
+
const backdropAnim = useRef(createAnimatedValue(0)).current;
|
|
68
|
+
const sheetAnim = useRef(createAnimatedValue(sheetMaxHeight)).current;
|
|
69
69
|
useEffect(() => {
|
|
70
70
|
if (open) {
|
|
71
71
|
Animated.parallel([Animated.timing(backdropAnim, {
|
|
@@ -390,7 +390,7 @@ const Chevron = ({
|
|
|
390
390
|
size,
|
|
391
391
|
open
|
|
392
392
|
}) => {
|
|
393
|
-
const rotate = useRef(
|
|
393
|
+
const rotate = useRef(createAnimatedValue(open ? 1 : 0)).current;
|
|
394
394
|
useEffect(() => {
|
|
395
395
|
Animated.timing(rotate, {
|
|
396
396
|
toValue: open ? 1 : 0,
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
|
4
4
|
import { Animated, Easing, StyleSheet, View } from 'react-native';
|
|
5
|
-
import { useTheme } from "../../theme/index.js";
|
|
5
|
+
import { useTheme, createAnimatedValue } from "../../theme/index.js";
|
|
6
6
|
import { Responsive } from "../../utils/index.js";
|
|
7
7
|
import { useSkeletonDefaults } from "./SkeletonProvider.js";
|
|
8
8
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -47,7 +47,7 @@ const Skeleton = ({
|
|
|
47
47
|
const borderRadius = resolveRadius(theme, resolvedRadiusToken);
|
|
48
48
|
const resolvedWidth = resolveWidth(width);
|
|
49
49
|
const resolvedHeight = Responsive.size(height);
|
|
50
|
-
const progress = useRef(
|
|
50
|
+
const progress = useRef(createAnimatedValue(0)).current;
|
|
51
51
|
const [containerWidth, setContainerWidth] = useState(0);
|
|
52
52
|
useEffect(() => {
|
|
53
53
|
progress.setValue(0);
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import React, { forwardRef, useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
4
4
|
import { Animated, Easing, PanResponder, Platform, 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/index.js";
|
|
7
7
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
8
|
const SIZE_MAP = {
|
|
@@ -65,16 +65,16 @@ const Slider = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
65
65
|
const lastReportedHigh = useRef(highRef.current);
|
|
66
66
|
|
|
67
67
|
// Animated x positions (px) for thumbs.
|
|
68
|
-
const lowX = useRef(
|
|
69
|
-
const highX = useRef(
|
|
68
|
+
const lowX = useRef(createAnimatedValue(0)).current;
|
|
69
|
+
const highX = useRef(createAnimatedValue(0)).current;
|
|
70
70
|
|
|
71
71
|
// Press / drag scale animations.
|
|
72
|
-
const lowScale = useRef(
|
|
73
|
-
const highScale = useRef(
|
|
72
|
+
const lowScale = useRef(createAnimatedValue(1)).current;
|
|
73
|
+
const highScale = useRef(createAnimatedValue(1)).current;
|
|
74
74
|
|
|
75
75
|
// Label opacity per thumb.
|
|
76
|
-
const lowLabelOpacity = useRef(
|
|
77
|
-
const highLabelOpacity = useRef(
|
|
76
|
+
const lowLabelOpacity = useRef(createAnimatedValue(0)).current;
|
|
77
|
+
const highLabelOpacity = useRef(createAnimatedValue(0)).current;
|
|
78
78
|
|
|
79
79
|
// Track which thumb is actively dragging (to anchor gesture math).
|
|
80
80
|
const dragOffsetRef = useRef(0);
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import React, { forwardRef, useEffect, useMemo, useRef } from 'react';
|
|
4
4
|
import { ActivityIndicator, Animated, Easing, StyleSheet, Text, View } from 'react-native';
|
|
5
|
-
import { useTheme } from "../../theme/index.js";
|
|
5
|
+
import { useTheme, createAnimatedValue } from "../../theme/index.js";
|
|
6
6
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
7
|
const sizeMap = {
|
|
8
8
|
small: 20,
|
|
@@ -18,7 +18,7 @@ const Dot = ({
|
|
|
18
18
|
delay,
|
|
19
19
|
duration
|
|
20
20
|
}) => {
|
|
21
|
-
const scale = useRef(
|
|
21
|
+
const scale = useRef(createAnimatedValue(1)).current;
|
|
22
22
|
useEffect(() => {
|
|
23
23
|
const animation = Animated.loop(Animated.sequence([Animated.delay(delay), Animated.timing(scale, {
|
|
24
24
|
toValue: 1.4,
|
|
@@ -61,7 +61,7 @@ const Spinner = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
61
61
|
testID
|
|
62
62
|
} = props;
|
|
63
63
|
const theme = useTheme();
|
|
64
|
-
const fade = useRef(
|
|
64
|
+
const fade = useRef(createAnimatedValue(0)).current;
|
|
65
65
|
useEffect(() => {
|
|
66
66
|
Animated.timing(fade, {
|
|
67
67
|
toValue: 1,
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import React, { forwardRef, useEffect, useMemo, useRef } from 'react';
|
|
4
4
|
import { Animated, Easing, 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";
|
|
@@ -30,8 +30,8 @@ const StepCircle = ({
|
|
|
30
30
|
onPress
|
|
31
31
|
}) => {
|
|
32
32
|
const isActive = status === 'active';
|
|
33
|
-
const pulseScale = useRef(
|
|
34
|
-
const pulseOpacity = useRef(
|
|
33
|
+
const pulseScale = useRef(createAnimatedValue(1)).current;
|
|
34
|
+
const pulseOpacity = useRef(createAnimatedValue(0.5)).current;
|
|
35
35
|
useEffect(() => {
|
|
36
36
|
if (!isActive) {
|
|
37
37
|
pulseScale.setValue(1);
|
|
@@ -176,7 +176,7 @@ const Stepper = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
176
176
|
|
|
177
177
|
// Connector progress: animates as activeStep changes.
|
|
178
178
|
const initialProgress = total <= 1 ? 0 : activeStep / (total - 1);
|
|
179
|
-
const progress = useRef(
|
|
179
|
+
const progress = useRef(createAnimatedValue(initialProgress)).current;
|
|
180
180
|
const lastTargetRef = useRef(initialProgress);
|
|
181
181
|
useEffect(() => {
|
|
182
182
|
const target = total <= 1 ? 0 : activeStep / (total - 1);
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import React, { forwardRef, useEffect, useMemo, useRef } from 'react';
|
|
4
4
|
import { Animated, Easing, 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 { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
8
|
const sizeMap = {
|
|
@@ -64,7 +64,7 @@ const Switch = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
64
64
|
const styles = useMemo(() => buildStyles(theme), [theme]);
|
|
65
65
|
const offTrackColor = theme.mode === 'dark' ? theme.colors.secondary : theme.colors.surface.disabled;
|
|
66
66
|
const onTrackColor = toneColor(theme, tone);
|
|
67
|
-
const progress = useRef(
|
|
67
|
+
const progress = useRef(createAnimatedValue(value ? 1 : 0)).current;
|
|
68
68
|
useEffect(() => {
|
|
69
69
|
Animated.spring(progress, {
|
|
70
70
|
toValue: value ? 1 : 0,
|
|
@@ -74,7 +74,7 @@ const Switch = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
74
74
|
useNativeDriver: true
|
|
75
75
|
}).start();
|
|
76
76
|
}, [value, progress, theme.motion.spring.snappy]);
|
|
77
|
-
const trackBgAnim = useRef(
|
|
77
|
+
const trackBgAnim = useRef(createAnimatedValue(value ? 1 : 0)).current;
|
|
78
78
|
useEffect(() => {
|
|
79
79
|
Animated.timing(trackBgAnim, {
|
|
80
80
|
toValue: value ? 1 : 0,
|
|
@@ -93,7 +93,7 @@ const Switch = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
93
93
|
inputRange: [0, 1],
|
|
94
94
|
outputRange: [offTrackColor, onTrackColor]
|
|
95
95
|
});
|
|
96
|
-
const bounceScale = useRef(
|
|
96
|
+
const bounceScale = useRef(createAnimatedValue(1)).current;
|
|
97
97
|
const isFirstRender = useRef(true);
|
|
98
98
|
useEffect(() => {
|
|
99
99
|
if (!bounce) return;
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
|
|
14
14
|
import React, { forwardRef, useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
15
15
|
import { Animated, Pressable, ScrollView, StyleSheet, Text, View } from 'react-native';
|
|
16
|
-
import { useTheme } from "../../theme/index.js";
|
|
16
|
+
import { useTheme, createAnimatedValue } from "../../theme/index.js";
|
|
17
17
|
import { triggerHaptic } from "../../utils/index.js";
|
|
18
18
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
19
19
|
const Tabs = /*#__PURE__*/forwardRef((props, ref) => {
|
|
@@ -34,8 +34,8 @@ const Tabs = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
34
34
|
|
|
35
35
|
// Per-tab measured layouts (key → {x, width}).
|
|
36
36
|
const [layouts, setLayouts] = useState({});
|
|
37
|
-
const indicatorTranslateX = useRef(
|
|
38
|
-
const indicatorWidth = useRef(
|
|
37
|
+
const indicatorTranslateX = useRef(createAnimatedValue(0)).current;
|
|
38
|
+
const indicatorWidth = useRef(createAnimatedValue(0)).current;
|
|
39
39
|
const activeLayout = layouts[activeKey];
|
|
40
40
|
|
|
41
41
|
// Animate indicator whenever activeKey or its layout changes.
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
4
4
|
import { AccessibilityInfo, Animated, Easing, FlatList, Modal, Platform, 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 Button from "../Button/Button.js";
|
|
8
8
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
@@ -59,7 +59,7 @@ const Wheel = ({
|
|
|
59
59
|
testID
|
|
60
60
|
}) => {
|
|
61
61
|
const listRef = useRef(null);
|
|
62
|
-
const scrollY = useRef(
|
|
62
|
+
const scrollY = useRef(createAnimatedValue(selectedIndex * ITEM_HEIGHT)).current;
|
|
63
63
|
const lastIndexRef = useRef(selectedIndex);
|
|
64
64
|
const lastHapticAtRef = useRef(0);
|
|
65
65
|
|
|
@@ -258,8 +258,8 @@ const TimePicker = ({
|
|
|
258
258
|
}, [visible, value, format, minuteStep, hours, minutes]);
|
|
259
259
|
|
|
260
260
|
// Sheet animations.
|
|
261
|
-
const opacity = useRef(
|
|
262
|
-
const translateY = useRef(
|
|
261
|
+
const opacity = useRef(createAnimatedValue(0)).current;
|
|
262
|
+
const translateY = useRef(createAnimatedValue(40)).current;
|
|
263
263
|
useEffect(() => {
|
|
264
264
|
if (visible) {
|
|
265
265
|
Animated.parallel([Animated.timing(opacity, {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import React, { useEffect, useMemo, useRef } from 'react';
|
|
4
4
|
import { Animated, PanResponder, Pressable, 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 { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
7
|
const SWIPE_DISMISS_THRESHOLD = 80;
|
|
8
8
|
const SWIPE_VELOCITY_THRESHOLD = 0.5;
|
|
@@ -24,9 +24,9 @@ const Toast = ({
|
|
|
24
24
|
const iconGlyphFontSize = toastTokens?.iconGlyphFontSize ?? 16;
|
|
25
25
|
const tintBarWidth = toastTokens?.tintBarWidth ?? 4;
|
|
26
26
|
const enterFrom = position === 'top' ? -120 : 120;
|
|
27
|
-
const translateY = useRef(
|
|
28
|
-
const translateX = useRef(
|
|
29
|
-
const opacity = useRef(
|
|
27
|
+
const translateY = useRef(createAnimatedValue(enterFrom)).current;
|
|
28
|
+
const translateX = useRef(createAnimatedValue(0)).current;
|
|
29
|
+
const opacity = useRef(createAnimatedValue(0)).current;
|
|
30
30
|
const dismissedRef = useRef(false);
|
|
31
31
|
const dismiss = (animateOut = true) => {
|
|
32
32
|
if (dismissedRef.current) return;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
4
4
|
import { Animated, Dimensions, Modal, 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 { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
7
7
|
const TOOLTIP_GAP = 8;
|
|
8
8
|
const SCREEN_PADDING = 8;
|
|
@@ -36,8 +36,8 @@ const Tooltip = props => {
|
|
|
36
36
|
height: 0
|
|
37
37
|
});
|
|
38
38
|
const wrapperRef = useRef(null);
|
|
39
|
-
const scale = useRef(
|
|
40
|
-
const opacity = useRef(
|
|
39
|
+
const scale = useRef(createAnimatedValue(visible ? 1 : 0.85)).current;
|
|
40
|
+
const opacity = useRef(createAnimatedValue(visible ? 1 : 0)).current;
|
|
41
41
|
const autoHideTimer = useRef(null);
|
|
42
42
|
const didMount = useRef(false);
|
|
43
43
|
const setVisible = useCallback(next => {
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { Animated } from 'react-native';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Create an `Animated.Value` that survives RN 0.85's dev-mode prop deepFreeze.
|
|
7
|
+
*
|
|
8
|
+
* RN's Fabric renderer deep-freezes prop trees on host components. If an
|
|
9
|
+
* `Animated.Value` is reachable from a `style` prop via interpolation chains
|
|
10
|
+
* (the `_parent` ref on `AnimatedInterpolation` nodes), the recursive freeze
|
|
11
|
+
* converts the value's `_animation` slot into a throwing setter — the next
|
|
12
|
+
* `Animated.timing(v).start()` then crashes with
|
|
13
|
+
* "_animation: object that is meant to be immutable".
|
|
14
|
+
*
|
|
15
|
+
* Sealing the value at construction makes `Object.isSealed(v) === true`,
|
|
16
|
+
* which causes `deepFreezeAndThrowOnMutationInDev` to skip-and-return at
|
|
17
|
+
* its top guard. Existing-property mutation (`_animation`, `_value`,
|
|
18
|
+
* `_listeners`, `_tracking`) keeps working — seal only blocks adding NEW
|
|
19
|
+
* properties, and `Animated.Value` doesn't add any post-construction.
|
|
20
|
+
*
|
|
21
|
+
* Use everywhere the library would otherwise call `new Animated.Value(...)`.
|
|
22
|
+
*/
|
|
23
|
+
export const createAnimatedValue = (initial, config) => Object.seal(new Animated.Value(initial, config));
|
|
24
|
+
//# sourceMappingURL=animatedValue.js.map
|
|
@@ -46,5 +46,6 @@ export { ThemeProvider, useTheme, useThemeMode } from "./ThemeContext.js";
|
|
|
46
46
|
export { lightTheme, darkTheme } from "./tokens.js";
|
|
47
47
|
export { mergeTheme } from "./merge.js";
|
|
48
48
|
export { fontFor } from "./textStyle.js";
|
|
49
|
+
export { createAnimatedValue } from "./animatedValue.js";
|
|
49
50
|
export { Gradient, isGradientAvailable } from "./Gradient.js";
|
|
50
51
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Animated } from 'react-native';
|
|
2
|
+
/**
|
|
3
|
+
* Create an `Animated.Value` that survives RN 0.85's dev-mode prop deepFreeze.
|
|
4
|
+
*
|
|
5
|
+
* RN's Fabric renderer deep-freezes prop trees on host components. If an
|
|
6
|
+
* `Animated.Value` is reachable from a `style` prop via interpolation chains
|
|
7
|
+
* (the `_parent` ref on `AnimatedInterpolation` nodes), the recursive freeze
|
|
8
|
+
* converts the value's `_animation` slot into a throwing setter — the next
|
|
9
|
+
* `Animated.timing(v).start()` then crashes with
|
|
10
|
+
* "_animation: object that is meant to be immutable".
|
|
11
|
+
*
|
|
12
|
+
* Sealing the value at construction makes `Object.isSealed(v) === true`,
|
|
13
|
+
* which causes `deepFreezeAndThrowOnMutationInDev` to skip-and-return at
|
|
14
|
+
* its top guard. Existing-property mutation (`_animation`, `_value`,
|
|
15
|
+
* `_listeners`, `_tracking`) keeps working — seal only blocks adding NEW
|
|
16
|
+
* properties, and `Animated.Value` doesn't add any post-construction.
|
|
17
|
+
*
|
|
18
|
+
* Use everywhere the library would otherwise call `new Animated.Value(...)`.
|
|
19
|
+
*/
|
|
20
|
+
export declare const createAnimatedValue: (initial: number, config?: ConstructorParameters<typeof Animated.Value>[1]) => Animated.Value;
|
|
21
|
+
//# sourceMappingURL=animatedValue.d.ts.map
|
|
@@ -11,6 +11,7 @@ export { lightTheme, darkTheme } from './tokens';
|
|
|
11
11
|
export { mergeTheme } from './merge';
|
|
12
12
|
export { fontFor } from './textStyle';
|
|
13
13
|
export type { FontWeightKey } from './textStyle';
|
|
14
|
+
export { createAnimatedValue } from './animatedValue';
|
|
14
15
|
export { Gradient, isGradientAvailable } from './Gradient';
|
|
15
16
|
export type { GradientProps } from './Gradient';
|
|
16
17
|
export type { ColorMode, ColorPalette, GradientDefinition, GradientScale, RadiusScale, ShadowDefinition, ShadowScale, SpacingScale, Theme, ThemeOverrides, TypographyScale, MotionScale, DeepPartial } from './types';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Animated } from 'react-native';
|
|
2
|
+
/**
|
|
3
|
+
* Create an `Animated.Value` that survives RN 0.85's dev-mode prop deepFreeze.
|
|
4
|
+
*
|
|
5
|
+
* RN's Fabric renderer deep-freezes prop trees on host components. If an
|
|
6
|
+
* `Animated.Value` is reachable from a `style` prop via interpolation chains
|
|
7
|
+
* (the `_parent` ref on `AnimatedInterpolation` nodes), the recursive freeze
|
|
8
|
+
* converts the value's `_animation` slot into a throwing setter — the next
|
|
9
|
+
* `Animated.timing(v).start()` then crashes with
|
|
10
|
+
* "_animation: object that is meant to be immutable".
|
|
11
|
+
*
|
|
12
|
+
* Sealing the value at construction makes `Object.isSealed(v) === true`,
|
|
13
|
+
* which causes `deepFreezeAndThrowOnMutationInDev` to skip-and-return at
|
|
14
|
+
* its top guard. Existing-property mutation (`_animation`, `_value`,
|
|
15
|
+
* `_listeners`, `_tracking`) keeps working — seal only blocks adding NEW
|
|
16
|
+
* properties, and `Animated.Value` doesn't add any post-construction.
|
|
17
|
+
*
|
|
18
|
+
* Use everywhere the library would otherwise call `new Animated.Value(...)`.
|
|
19
|
+
*/
|
|
20
|
+
export declare const createAnimatedValue: (initial: number, config?: ConstructorParameters<typeof Animated.Value>[1]) => Animated.Value;
|
|
21
|
+
//# sourceMappingURL=animatedValue.d.ts.map
|