motion-on-native 1.2.2 → 1.2.4

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 (2) hide show
  1. package/lib/index.js +5 -3
  2. package/package.json +1 -1
package/lib/index.js CHANGED
@@ -135,7 +135,7 @@ function createMotionComponent(Component) {
135
135
  const sharedValue = getSharedValue(key);
136
136
  if (sharedValue) {
137
137
  let config;
138
- if (transitionConfig.repeat && transitionConfig.repeat > 0) {
138
+ if (transitionConfig.repeat && (transitionConfig.repeat > 0 || transitionConfig.repeat === 'infinity')) {
139
139
  // Use withRepeat for repeated animations
140
140
  const baseAnimation = transitionConfig.type === 'spring'
141
141
  ? (0, react_native_reanimated_1.withSpring)(value, {
@@ -271,13 +271,15 @@ function createMotionComponent(Component) {
271
271
  }, []);
272
272
  // Handle animate prop changes (only animate if values actually changed)
273
273
  const prevAnimateRef = (0, react_1.useRef)(animate);
274
+ const animateStringRef = (0, react_1.useRef)(JSON.stringify(animate));
274
275
  (0, react_1.useEffect)(() => {
275
276
  if (hasAnimated && !isExitingRef.current) {
276
277
  // Only animate if animate prop actually changed
277
- const hasChanged = JSON.stringify(prevAnimateRef.current) !== JSON.stringify(animate);
278
- if (hasChanged) {
278
+ const currentAnimateString = JSON.stringify(animate);
279
+ if (animateStringRef.current !== currentAnimateString) {
279
280
  animateToValues(animate);
280
281
  prevAnimateRef.current = animate;
282
+ animateStringRef.current = currentAnimateString;
281
283
  }
282
284
  }
283
285
  }, [animate]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "motion-on-native",
3
- "version": "1.2.2",
3
+ "version": "1.2.4",
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",