motion-on-native 1.1.0 → 1.1.2

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 CHANGED
@@ -56,10 +56,6 @@ export interface AnimationProps {
56
56
  left?: number;
57
57
  right?: number;
58
58
  shadowColor?: string;
59
- shadowOffset?: {
60
- width: number;
61
- height: number;
62
- };
63
59
  shadowOpacity?: number;
64
60
  shadowRadius?: number;
65
61
  elevation?: number;
package/lib/index.js CHANGED
@@ -64,12 +64,67 @@ function createMotionComponent(Component) {
64
64
  const opacity = (0, react_native_reanimated_1.useSharedValue)(getInitialValue('opacity', initial));
65
65
  const x = (0, react_native_reanimated_1.useSharedValue)(getInitialValue('x', initial));
66
66
  const y = (0, react_native_reanimated_1.useSharedValue)(getInitialValue('y', initial));
67
+ const z = (0, react_native_reanimated_1.useSharedValue)(getInitialValue('z', initial));
67
68
  const scale = (0, react_native_reanimated_1.useSharedValue)(getInitialValue('scale', initial));
69
+ const scaleX = (0, react_native_reanimated_1.useSharedValue)(getInitialValue('scaleX', initial));
70
+ const scaleY = (0, react_native_reanimated_1.useSharedValue)(getInitialValue('scaleY', initial));
68
71
  const rotate = (0, react_native_reanimated_1.useSharedValue)(getInitialValue('rotate', initial));
72
+ const rotateX = (0, react_native_reanimated_1.useSharedValue)(getInitialValue('rotateX', initial));
73
+ const rotateY = (0, react_native_reanimated_1.useSharedValue)(getInitialValue('rotateY', initial));
74
+ const rotateZ = (0, react_native_reanimated_1.useSharedValue)(getInitialValue('rotateZ', initial));
75
+ const skewX = (0, react_native_reanimated_1.useSharedValue)(getInitialValue('skewX', initial));
76
+ const skewY = (0, react_native_reanimated_1.useSharedValue)(getInitialValue('skewY', initial));
77
+ // Layout properties
69
78
  const width = (0, react_native_reanimated_1.useSharedValue)(getInitialValue('width', initial));
70
79
  const height = (0, react_native_reanimated_1.useSharedValue)(getInitialValue('height', initial));
71
- const backgroundColor = (0, react_native_reanimated_1.useSharedValue)(getInitialValue('backgroundColor', initial));
80
+ const minWidth = (0, react_native_reanimated_1.useSharedValue)(getInitialValue('minWidth', initial));
81
+ const minHeight = (0, react_native_reanimated_1.useSharedValue)(getInitialValue('minHeight', initial));
82
+ const maxWidth = (0, react_native_reanimated_1.useSharedValue)(getInitialValue('maxWidth', initial));
83
+ const maxHeight = (0, react_native_reanimated_1.useSharedValue)(getInitialValue('maxHeight', initial));
84
+ // Spacing properties
85
+ const margin = (0, react_native_reanimated_1.useSharedValue)(getInitialValue('margin', initial));
86
+ const marginTop = (0, react_native_reanimated_1.useSharedValue)(getInitialValue('marginTop', initial));
87
+ const marginBottom = (0, react_native_reanimated_1.useSharedValue)(getInitialValue('marginBottom', initial));
88
+ const marginLeft = (0, react_native_reanimated_1.useSharedValue)(getInitialValue('marginLeft', initial));
89
+ const marginRight = (0, react_native_reanimated_1.useSharedValue)(getInitialValue('marginRight', initial));
90
+ const marginHorizontal = (0, react_native_reanimated_1.useSharedValue)(getInitialValue('marginHorizontal', initial));
91
+ const marginVertical = (0, react_native_reanimated_1.useSharedValue)(getInitialValue('marginVertical', initial));
92
+ const padding = (0, react_native_reanimated_1.useSharedValue)(getInitialValue('padding', initial));
93
+ const paddingTop = (0, react_native_reanimated_1.useSharedValue)(getInitialValue('paddingTop', initial));
94
+ const paddingBottom = (0, react_native_reanimated_1.useSharedValue)(getInitialValue('paddingBottom', initial));
95
+ const paddingLeft = (0, react_native_reanimated_1.useSharedValue)(getInitialValue('paddingLeft', initial));
96
+ const paddingRight = (0, react_native_reanimated_1.useSharedValue)(getInitialValue('paddingRight', initial));
97
+ const paddingHorizontal = (0, react_native_reanimated_1.useSharedValue)(getInitialValue('paddingHorizontal', initial));
98
+ const paddingVertical = (0, react_native_reanimated_1.useSharedValue)(getInitialValue('paddingVertical', initial));
99
+ // Border properties
72
100
  const borderRadius = (0, react_native_reanimated_1.useSharedValue)(getInitialValue('borderRadius', initial));
101
+ const borderTopLeftRadius = (0, react_native_reanimated_1.useSharedValue)(getInitialValue('borderTopLeftRadius', initial));
102
+ const borderTopRightRadius = (0, react_native_reanimated_1.useSharedValue)(getInitialValue('borderTopRightRadius', initial));
103
+ const borderBottomLeftRadius = (0, react_native_reanimated_1.useSharedValue)(getInitialValue('borderBottomLeftRadius', initial));
104
+ const borderBottomRightRadius = (0, react_native_reanimated_1.useSharedValue)(getInitialValue('borderBottomRightRadius', initial));
105
+ const borderWidth = (0, react_native_reanimated_1.useSharedValue)(getInitialValue('borderWidth', initial));
106
+ const borderTopWidth = (0, react_native_reanimated_1.useSharedValue)(getInitialValue('borderTopWidth', initial));
107
+ const borderBottomWidth = (0, react_native_reanimated_1.useSharedValue)(getInitialValue('borderBottomWidth', initial));
108
+ const borderLeftWidth = (0, react_native_reanimated_1.useSharedValue)(getInitialValue('borderLeftWidth', initial));
109
+ const borderRightWidth = (0, react_native_reanimated_1.useSharedValue)(getInitialValue('borderRightWidth', initial));
110
+ const borderColor = (0, react_native_reanimated_1.useSharedValue)(getInitialValue('borderColor', initial));
111
+ const borderTopColor = (0, react_native_reanimated_1.useSharedValue)(getInitialValue('borderTopColor', initial));
112
+ const borderBottomColor = (0, react_native_reanimated_1.useSharedValue)(getInitialValue('borderBottomColor', initial));
113
+ const borderLeftColor = (0, react_native_reanimated_1.useSharedValue)(getInitialValue('borderLeftColor', initial));
114
+ const borderRightColor = (0, react_native_reanimated_1.useSharedValue)(getInitialValue('borderRightColor', initial));
115
+ // Color properties
116
+ const backgroundColor = (0, react_native_reanimated_1.useSharedValue)(getInitialValue('backgroundColor', initial));
117
+ const color = (0, react_native_reanimated_1.useSharedValue)(getInitialValue('color', initial));
118
+ // Position properties
119
+ const top = (0, react_native_reanimated_1.useSharedValue)(getInitialValue('top', initial));
120
+ const bottom = (0, react_native_reanimated_1.useSharedValue)(getInitialValue('bottom', initial));
121
+ const left = (0, react_native_reanimated_1.useSharedValue)(getInitialValue('left', initial));
122
+ const right = (0, react_native_reanimated_1.useSharedValue)(getInitialValue('right', initial));
123
+ // Shadow properties
124
+ const shadowColor = (0, react_native_reanimated_1.useSharedValue)(getInitialValue('shadowColor', initial));
125
+ const shadowOpacity = (0, react_native_reanimated_1.useSharedValue)(getInitialValue('shadowOpacity', initial));
126
+ const shadowRadius = (0, react_native_reanimated_1.useSharedValue)(getInitialValue('shadowRadius', initial));
127
+ const elevation = (0, react_native_reanimated_1.useSharedValue)(getInitialValue('elevation', initial));
73
128
  // Animation helper
74
129
  const animateToValues = (targetValues, transitionConfig = transition) => {
75
130
  Object.entries(targetValues).forEach(([key, value]) => {
@@ -101,15 +156,71 @@ function createMotionComponent(Component) {
101
156
  // Get shared value by key
102
157
  const getSharedValue = (key) => {
103
158
  switch (key) {
159
+ // Transform properties
104
160
  case 'opacity': return opacity;
105
161
  case 'x': return x;
106
162
  case 'y': return y;
163
+ case 'z': return z;
107
164
  case 'scale': return scale;
165
+ case 'scaleX': return scaleX;
166
+ case 'scaleY': return scaleY;
108
167
  case 'rotate': return rotate;
168
+ case 'rotateX': return rotateX;
169
+ case 'rotateY': return rotateY;
170
+ case 'rotateZ': return rotateZ;
171
+ case 'skewX': return skewX;
172
+ case 'skewY': return skewY;
173
+ // Layout properties
109
174
  case 'width': return width;
110
175
  case 'height': return height;
111
- case 'backgroundColor': return backgroundColor;
176
+ case 'minWidth': return minWidth;
177
+ case 'minHeight': return minHeight;
178
+ case 'maxWidth': return maxWidth;
179
+ case 'maxHeight': return maxHeight;
180
+ // Spacing properties
181
+ case 'margin': return margin;
182
+ case 'marginTop': return marginTop;
183
+ case 'marginBottom': return marginBottom;
184
+ case 'marginLeft': return marginLeft;
185
+ case 'marginRight': return marginRight;
186
+ case 'marginHorizontal': return marginHorizontal;
187
+ case 'marginVertical': return marginVertical;
188
+ case 'padding': return padding;
189
+ case 'paddingTop': return paddingTop;
190
+ case 'paddingBottom': return paddingBottom;
191
+ case 'paddingLeft': return paddingLeft;
192
+ case 'paddingRight': return paddingRight;
193
+ case 'paddingHorizontal': return paddingHorizontal;
194
+ case 'paddingVertical': return paddingVertical;
195
+ // Border properties
112
196
  case 'borderRadius': return borderRadius;
197
+ case 'borderTopLeftRadius': return borderTopLeftRadius;
198
+ case 'borderTopRightRadius': return borderTopRightRadius;
199
+ case 'borderBottomLeftRadius': return borderBottomLeftRadius;
200
+ case 'borderBottomRightRadius': return borderBottomRightRadius;
201
+ case 'borderWidth': return borderWidth;
202
+ case 'borderTopWidth': return borderTopWidth;
203
+ case 'borderBottomWidth': return borderBottomWidth;
204
+ case 'borderLeftWidth': return borderLeftWidth;
205
+ case 'borderRightWidth': return borderRightWidth;
206
+ case 'borderColor': return borderColor;
207
+ case 'borderTopColor': return borderTopColor;
208
+ case 'borderBottomColor': return borderBottomColor;
209
+ case 'borderLeftColor': return borderLeftColor;
210
+ case 'borderRightColor': return borderRightColor;
211
+ // Color properties
212
+ case 'backgroundColor': return backgroundColor;
213
+ case 'color': return color;
214
+ // Position properties
215
+ case 'top': return top;
216
+ case 'bottom': return bottom;
217
+ case 'left': return left;
218
+ case 'right': return right;
219
+ // Shadow properties
220
+ case 'shadowColor': return shadowColor;
221
+ case 'shadowOpacity': return shadowOpacity;
222
+ case 'shadowRadius': return shadowRadius;
223
+ case 'elevation': return elevation;
113
224
  default: return null;
114
225
  }
115
226
  };
@@ -197,10 +308,26 @@ function createMotionComponent(Component) {
197
308
  transform.push({ translateX: x.value });
198
309
  if (y.value !== 0)
199
310
  transform.push({ translateY: y.value });
311
+ if (z.value !== 0)
312
+ transform.push({ translateZ: z.value });
200
313
  if (scale.value !== 1)
201
314
  transform.push({ scale: scale.value });
315
+ if (scaleX.value !== 1)
316
+ transform.push({ scaleX: scaleX.value });
317
+ if (scaleY.value !== 1)
318
+ transform.push({ scaleY: scaleY.value });
202
319
  if (rotate.value !== '0deg')
203
320
  transform.push({ rotate: rotate.value });
321
+ if (rotateX.value !== '0deg')
322
+ transform.push({ rotateX: rotateX.value });
323
+ if (rotateY.value !== '0deg')
324
+ transform.push({ rotateY: rotateY.value });
325
+ if (rotateZ.value !== '0deg')
326
+ transform.push({ rotateZ: rotateZ.value });
327
+ if (skewX.value !== '0deg')
328
+ transform.push({ skewX: skewX.value });
329
+ if (skewY.value !== '0deg')
330
+ transform.push({ skewY: skewY.value });
204
331
  if (transform.length > 0)
205
332
  style.transform = transform;
206
333
  // Layout properties
@@ -208,10 +335,97 @@ function createMotionComponent(Component) {
208
335
  style.width = width.value;
209
336
  if (height.value !== 0)
210
337
  style.height = height.value;
211
- if (backgroundColor.value !== 0)
212
- style.backgroundColor = backgroundColor.value;
338
+ if (minWidth.value !== 0)
339
+ style.minWidth = minWidth.value;
340
+ if (minHeight.value !== 0)
341
+ style.minHeight = minHeight.value;
342
+ if (maxWidth.value !== 0)
343
+ style.maxWidth = maxWidth.value;
344
+ if (maxHeight.value !== 0)
345
+ style.maxHeight = maxHeight.value;
346
+ // Spacing properties
347
+ if (margin.value !== 0)
348
+ style.margin = margin.value;
349
+ if (marginTop.value !== 0)
350
+ style.marginTop = marginTop.value;
351
+ if (marginBottom.value !== 0)
352
+ style.marginBottom = marginBottom.value;
353
+ if (marginLeft.value !== 0)
354
+ style.marginLeft = marginLeft.value;
355
+ if (marginRight.value !== 0)
356
+ style.marginRight = marginRight.value;
357
+ if (marginHorizontal.value !== 0)
358
+ style.marginHorizontal = marginHorizontal.value;
359
+ if (marginVertical.value !== 0)
360
+ style.marginVertical = marginVertical.value;
361
+ if (padding.value !== 0)
362
+ style.padding = padding.value;
363
+ if (paddingTop.value !== 0)
364
+ style.paddingTop = paddingTop.value;
365
+ if (paddingBottom.value !== 0)
366
+ style.paddingBottom = paddingBottom.value;
367
+ if (paddingLeft.value !== 0)
368
+ style.paddingLeft = paddingLeft.value;
369
+ if (paddingRight.value !== 0)
370
+ style.paddingRight = paddingRight.value;
371
+ if (paddingHorizontal.value !== 0)
372
+ style.paddingHorizontal = paddingHorizontal.value;
373
+ if (paddingVertical.value !== 0)
374
+ style.paddingVertical = paddingVertical.value;
375
+ // Border properties
213
376
  if (borderRadius.value !== 0)
214
377
  style.borderRadius = borderRadius.value;
378
+ if (borderTopLeftRadius.value !== 0)
379
+ style.borderTopLeftRadius = borderTopLeftRadius.value;
380
+ if (borderTopRightRadius.value !== 0)
381
+ style.borderTopRightRadius = borderTopRightRadius.value;
382
+ if (borderBottomLeftRadius.value !== 0)
383
+ style.borderBottomLeftRadius = borderBottomLeftRadius.value;
384
+ if (borderBottomRightRadius.value !== 0)
385
+ style.borderBottomRightRadius = borderBottomRightRadius.value;
386
+ if (borderWidth.value !== 0)
387
+ style.borderWidth = borderWidth.value;
388
+ if (borderTopWidth.value !== 0)
389
+ style.borderTopWidth = borderTopWidth.value;
390
+ if (borderBottomWidth.value !== 0)
391
+ style.borderBottomWidth = borderBottomWidth.value;
392
+ if (borderLeftWidth.value !== 0)
393
+ style.borderLeftWidth = borderLeftWidth.value;
394
+ if (borderRightWidth.value !== 0)
395
+ style.borderRightWidth = borderRightWidth.value;
396
+ if (borderColor.value !== 0)
397
+ style.borderColor = borderColor.value;
398
+ if (borderTopColor.value !== 0)
399
+ style.borderTopColor = borderTopColor.value;
400
+ if (borderBottomColor.value !== 0)
401
+ style.borderBottomColor = borderBottomColor.value;
402
+ if (borderLeftColor.value !== 0)
403
+ style.borderLeftColor = borderLeftColor.value;
404
+ if (borderRightColor.value !== 0)
405
+ style.borderRightColor = borderRightColor.value;
406
+ // Color properties
407
+ if (backgroundColor.value !== 0)
408
+ style.backgroundColor = backgroundColor.value;
409
+ if (color.value !== 0)
410
+ style.color = color.value;
411
+ // Position properties
412
+ if (top.value !== 0)
413
+ style.top = top.value;
414
+ if (bottom.value !== 0)
415
+ style.bottom = bottom.value;
416
+ if (left.value !== 0)
417
+ style.left = left.value;
418
+ if (right.value !== 0)
419
+ style.right = right.value;
420
+ // Shadow properties
421
+ if (shadowColor.value !== 0)
422
+ style.shadowColor = shadowColor.value;
423
+ if (shadowOpacity.value !== 0)
424
+ style.shadowOpacity = shadowOpacity.value;
425
+ if (shadowRadius.value !== 0)
426
+ style.shadowRadius = shadowRadius.value;
427
+ if (elevation.value !== 0)
428
+ style.elevation = elevation.value;
215
429
  return style;
216
430
  });
217
431
  const AnimatedComponent = react_native_reanimated_1.default.createAnimatedComponent(Component);
@@ -245,8 +459,6 @@ function getDefaultValue(key) {
245
459
  case 'skewX':
246
460
  case 'skewY':
247
461
  return '0deg';
248
- case 'shadowOffset':
249
- return { width: 0, height: 0 };
250
462
  default:
251
463
  return 0;
252
464
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "motion-on-native",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
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",