motion-on-native 1.1.4 → 1.2.1
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 +26 -30
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -130,50 +130,46 @@ function createMotionComponent(Component) {
|
|
|
130
130
|
// Animation helper
|
|
131
131
|
const animateToValues = (targetValues, transitionConfig = transition) => {
|
|
132
132
|
Object.entries(targetValues).forEach(([key, value]) => {
|
|
133
|
-
var _a;
|
|
133
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
134
134
|
if (value !== undefined) {
|
|
135
135
|
const sharedValue = getSharedValue(key);
|
|
136
136
|
if (sharedValue) {
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
137
|
+
let config;
|
|
138
|
+
if (transitionConfig.repeat && transitionConfig.repeat > 0) {
|
|
139
|
+
// Use withRepeat for repeated animations
|
|
140
|
+
const baseAnimation = transitionConfig.type === 'spring'
|
|
141
|
+
? (0, react_native_reanimated_1.withSpring)(value, {
|
|
141
142
|
damping: (_a = transitionConfig.damping) !== null && _a !== void 0 ? _a : DEFAULT_TRANSITION.damping,
|
|
142
143
|
stiffness: (_b = transitionConfig.stiffness) !== null && _b !== void 0 ? _b : DEFAULT_TRANSITION.stiffness,
|
|
143
144
|
mass: (_c = transitionConfig.mass) !== null && _c !== void 0 ? _c : 1,
|
|
144
145
|
})
|
|
145
|
-
: (0, react_native_reanimated_1.withTiming)(
|
|
146
|
+
: (0, react_native_reanimated_1.withTiming)(value, {
|
|
146
147
|
duration: (_d = transitionConfig.duration) !== null && _d !== void 0 ? _d : DEFAULT_TRANSITION.duration,
|
|
148
|
+
easing: react_native_reanimated_1.Easing.linear,
|
|
147
149
|
});
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
}
|
|
165
|
-
}, duration);
|
|
166
|
-
}
|
|
167
|
-
};
|
|
168
|
-
const currentValue = sharedValue.value;
|
|
169
|
-
const repeatTimes = transitionConfig.repeat === 'infinity' ? Infinity : ((_a = transitionConfig.repeat) !== null && _a !== void 0 ? _a : 0);
|
|
150
|
+
const repeatCount = transitionConfig.repeat === 'infinity' ? -1 : transitionConfig.repeat;
|
|
151
|
+
const reverse = transitionConfig.repeatType === 'reverse';
|
|
152
|
+
config = (0, react_native_reanimated_1.withRepeat)(baseAnimation, repeatCount, reverse);
|
|
153
|
+
}
|
|
154
|
+
else {
|
|
155
|
+
// Single animation
|
|
156
|
+
config = transitionConfig.type === 'spring'
|
|
157
|
+
? (0, react_native_reanimated_1.withSpring)(value, {
|
|
158
|
+
damping: (_e = transitionConfig.damping) !== null && _e !== void 0 ? _e : DEFAULT_TRANSITION.damping,
|
|
159
|
+
stiffness: (_f = transitionConfig.stiffness) !== null && _f !== void 0 ? _f : DEFAULT_TRANSITION.stiffness,
|
|
160
|
+
mass: (_g = transitionConfig.mass) !== null && _g !== void 0 ? _g : 1,
|
|
161
|
+
})
|
|
162
|
+
: (0, react_native_reanimated_1.withTiming)(value, {
|
|
163
|
+
duration: (_h = transitionConfig.duration) !== null && _h !== void 0 ? _h : DEFAULT_TRANSITION.duration,
|
|
164
|
+
});
|
|
165
|
+
}
|
|
170
166
|
if (transitionConfig.delay) {
|
|
171
167
|
setTimeout(() => {
|
|
172
|
-
|
|
168
|
+
sharedValue.value = config;
|
|
173
169
|
}, transitionConfig.delay);
|
|
174
170
|
}
|
|
175
171
|
else {
|
|
176
|
-
|
|
172
|
+
sharedValue.value = config;
|
|
177
173
|
}
|
|
178
174
|
}
|
|
179
175
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "motion-on-native",
|
|
3
|
-
"version": "1.1
|
|
3
|
+
"version": "1.2.1",
|
|
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",
|