@idealyst/animate 1.2.59 → 1.2.61
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/package.json +3 -3
- package/src/useAnimatedStyle.native.ts +26 -26
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@idealyst/animate",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.61",
|
|
4
4
|
"description": "Cross-platform animation hooks for React and React Native",
|
|
5
5
|
"readme": "README.md",
|
|
6
6
|
"main": "src/index.ts",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"publish:npm": "npm publish"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
|
-
"@idealyst/theme": "^1.2.
|
|
33
|
+
"@idealyst/theme": "^1.2.61",
|
|
34
34
|
"react": ">=16.8.0",
|
|
35
35
|
"react-native": ">=0.60.0",
|
|
36
36
|
"react-native-reanimated": ">=3.0.0",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
}
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
|
-
"@idealyst/theme": "^1.2.
|
|
51
|
+
"@idealyst/theme": "^1.2.61",
|
|
52
52
|
"@types/react": "^19.1.0",
|
|
53
53
|
"react": "^19.1.0",
|
|
54
54
|
"react-native": "^0.80.1",
|
|
@@ -133,9 +133,8 @@ export function useAnimatedStyle(
|
|
|
133
133
|
return result;
|
|
134
134
|
}, [normalizedTransform]);
|
|
135
135
|
|
|
136
|
-
//
|
|
137
|
-
const animate = (
|
|
138
|
-
'worklet';
|
|
136
|
+
// Create animation wrapper - called from JS thread, returns animation modifier
|
|
137
|
+
const animate = (targetValue: any, isString = false) => {
|
|
139
138
|
if (useSpring && !isString) {
|
|
140
139
|
const config = springConfig(springType as any);
|
|
141
140
|
return finalDelay > 0
|
|
@@ -157,54 +156,54 @@ export function useAnimatedStyle(
|
|
|
157
156
|
useEffect(() => {
|
|
158
157
|
// Visual properties
|
|
159
158
|
if (style.opacity !== undefined) {
|
|
160
|
-
opacity.value = animate(
|
|
159
|
+
opacity.value = animate(style.opacity);
|
|
161
160
|
}
|
|
162
161
|
if (style.backgroundColor !== undefined) {
|
|
163
|
-
backgroundColor.value = animate(
|
|
162
|
+
backgroundColor.value = animate(style.backgroundColor, true);
|
|
164
163
|
}
|
|
165
164
|
if (style.borderColor !== undefined) {
|
|
166
|
-
borderColor.value = animate(
|
|
165
|
+
borderColor.value = animate(style.borderColor, true);
|
|
167
166
|
}
|
|
168
167
|
if (style.borderWidth !== undefined) {
|
|
169
|
-
borderWidth.value = animate(
|
|
168
|
+
borderWidth.value = animate(style.borderWidth);
|
|
170
169
|
}
|
|
171
170
|
if (style.borderRadius !== undefined) {
|
|
172
|
-
borderRadius.value = animate(
|
|
171
|
+
borderRadius.value = animate(style.borderRadius);
|
|
173
172
|
}
|
|
174
173
|
|
|
175
174
|
// Layout properties
|
|
176
175
|
if (style.top !== undefined) {
|
|
177
|
-
top.value = animate(
|
|
176
|
+
top.value = animate(style.top);
|
|
178
177
|
}
|
|
179
178
|
if (style.right !== undefined) {
|
|
180
|
-
right.value = animate(
|
|
179
|
+
right.value = animate(style.right);
|
|
181
180
|
}
|
|
182
181
|
if (style.bottom !== undefined) {
|
|
183
|
-
bottom.value = animate(
|
|
182
|
+
bottom.value = animate(style.bottom);
|
|
184
183
|
}
|
|
185
184
|
if (style.left !== undefined) {
|
|
186
|
-
left.value = animate(
|
|
185
|
+
left.value = animate(style.left);
|
|
187
186
|
}
|
|
188
187
|
if (style.width !== undefined) {
|
|
189
|
-
width.value = animate(
|
|
188
|
+
width.value = animate(style.width);
|
|
190
189
|
}
|
|
191
190
|
if (style.height !== undefined) {
|
|
192
|
-
height.value = animate(
|
|
191
|
+
height.value = animate(style.height);
|
|
193
192
|
}
|
|
194
193
|
|
|
195
194
|
// Update transform values
|
|
196
|
-
translateX.value = animate(
|
|
197
|
-
translateY.value = animate(
|
|
198
|
-
scale.value = animate(
|
|
199
|
-
scaleX.value = animate(
|
|
200
|
-
scaleY.value = animate(
|
|
201
|
-
rotate.value = animate(
|
|
202
|
-
rotateX.value = animate(
|
|
203
|
-
rotateY.value = animate(
|
|
204
|
-
rotateZ.value = animate(
|
|
205
|
-
skewX.value = animate(
|
|
206
|
-
skewY.value = animate(
|
|
207
|
-
perspective.value = animate(
|
|
195
|
+
translateX.value = animate(transforms.translateX);
|
|
196
|
+
translateY.value = animate(transforms.translateY);
|
|
197
|
+
scale.value = animate(transforms.scale);
|
|
198
|
+
scaleX.value = animate(transforms.scaleX);
|
|
199
|
+
scaleY.value = animate(transforms.scaleY);
|
|
200
|
+
rotate.value = animate(transforms.rotate, true);
|
|
201
|
+
rotateX.value = animate(transforms.rotateX, true);
|
|
202
|
+
rotateY.value = animate(transforms.rotateY, true);
|
|
203
|
+
rotateZ.value = animate(transforms.rotateZ, true);
|
|
204
|
+
skewX.value = animate(transforms.skewX, true);
|
|
205
|
+
skewY.value = animate(transforms.skewY, true);
|
|
206
|
+
perspective.value = animate(transforms.perspective);
|
|
208
207
|
}, [
|
|
209
208
|
style.opacity,
|
|
210
209
|
style.backgroundColor,
|
|
@@ -222,6 +221,7 @@ export function useAnimatedStyle(
|
|
|
222
221
|
|
|
223
222
|
// Create animated style - only include properties that were specified
|
|
224
223
|
const animatedStyle = useReanimatedStyle(() => {
|
|
224
|
+
'worklet';
|
|
225
225
|
const result: Record<string, any> = {
|
|
226
226
|
opacity: opacity.value,
|
|
227
227
|
backgroundColor: backgroundColor.value,
|