motion-on-native 1.1.2 → 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.js +8 -2
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -247,10 +247,16 @@ function createMotionComponent(Component) {
|
|
|
247
247
|
}
|
|
248
248
|
return undefined;
|
|
249
249
|
}, []);
|
|
250
|
-
// Handle animate prop changes
|
|
250
|
+
// Handle animate prop changes (only animate if values actually changed)
|
|
251
|
+
const prevAnimateRef = (0, react_1.useRef)(animate);
|
|
251
252
|
(0, react_1.useEffect)(() => {
|
|
252
253
|
if (hasAnimated && !isExitingRef.current) {
|
|
253
|
-
|
|
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
|
+
}
|
|
254
260
|
}
|
|
255
261
|
}, [animate]);
|
|
256
262
|
// Handle shouldExit
|
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",
|