motion-on-native 1.1.1 → 1.1.3
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/index.d.ts +0 -4
- package/lib/index.js +8 -8
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -122,7 +122,6 @@ function createMotionComponent(Component) {
|
|
|
122
122
|
const right = (0, react_native_reanimated_1.useSharedValue)(getInitialValue('right', initial));
|
|
123
123
|
// Shadow properties
|
|
124
124
|
const shadowColor = (0, react_native_reanimated_1.useSharedValue)(getInitialValue('shadowColor', initial));
|
|
125
|
-
const shadowOffset = (0, react_native_reanimated_1.useSharedValue)(getInitialValue('shadowOffset', initial));
|
|
126
125
|
const shadowOpacity = (0, react_native_reanimated_1.useSharedValue)(getInitialValue('shadowOpacity', initial));
|
|
127
126
|
const shadowRadius = (0, react_native_reanimated_1.useSharedValue)(getInitialValue('shadowRadius', initial));
|
|
128
127
|
const elevation = (0, react_native_reanimated_1.useSharedValue)(getInitialValue('elevation', initial));
|
|
@@ -219,7 +218,6 @@ function createMotionComponent(Component) {
|
|
|
219
218
|
case 'right': return right;
|
|
220
219
|
// Shadow properties
|
|
221
220
|
case 'shadowColor': return shadowColor;
|
|
222
|
-
case 'shadowOffset': return shadowOffset;
|
|
223
221
|
case 'shadowOpacity': return shadowOpacity;
|
|
224
222
|
case 'shadowRadius': return shadowRadius;
|
|
225
223
|
case 'elevation': return elevation;
|
|
@@ -249,10 +247,16 @@ function createMotionComponent(Component) {
|
|
|
249
247
|
}
|
|
250
248
|
return undefined;
|
|
251
249
|
}, []);
|
|
252
|
-
// Handle animate prop changes
|
|
250
|
+
// Handle animate prop changes (only animate if values actually changed)
|
|
251
|
+
const prevAnimateRef = (0, react_1.useRef)(animate);
|
|
253
252
|
(0, react_1.useEffect)(() => {
|
|
254
253
|
if (hasAnimated && !isExitingRef.current) {
|
|
255
|
-
|
|
254
|
+
// Only animate if animate prop actually changed
|
|
255
|
+
const hasChanged = JSON.stringify(prevAnimateRef.current) !== JSON.stringify(animate);
|
|
256
|
+
if (hasChanged) {
|
|
257
|
+
animateToValues(animate);
|
|
258
|
+
prevAnimateRef.current = animate;
|
|
259
|
+
}
|
|
256
260
|
}
|
|
257
261
|
}, [animate]);
|
|
258
262
|
// Handle shouldExit
|
|
@@ -422,8 +426,6 @@ function createMotionComponent(Component) {
|
|
|
422
426
|
// Shadow properties
|
|
423
427
|
if (shadowColor.value !== 0)
|
|
424
428
|
style.shadowColor = shadowColor.value;
|
|
425
|
-
if (shadowOffset.value !== 0)
|
|
426
|
-
style.shadowOffset = shadowOffset.value;
|
|
427
429
|
if (shadowOpacity.value !== 0)
|
|
428
430
|
style.shadowOpacity = shadowOpacity.value;
|
|
429
431
|
if (shadowRadius.value !== 0)
|
|
@@ -463,8 +465,6 @@ function getDefaultValue(key) {
|
|
|
463
465
|
case 'skewX':
|
|
464
466
|
case 'skewY':
|
|
465
467
|
return '0deg';
|
|
466
|
-
case 'shadowOffset':
|
|
467
|
-
return { width: 0, height: 0 };
|
|
468
468
|
default:
|
|
469
469
|
return 0;
|
|
470
470
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "motion-on-native",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.3",
|
|
4
4
|
"description": "Framer Motion-inspired animation library for React Native with Reanimated. Easy spring animations, gestures, and transitions for mobile apps.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|