react-native-ease 0.1.0-alpha.0 → 0.2.0
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/README.md +20 -0
- package/android/src/main/java/com/ease/EaseView.kt +92 -15
- package/android/src/main/java/com/ease/EaseViewManager.kt +13 -0
- package/ios/EaseView.mm +94 -2
- package/lib/module/EaseView.js +10 -1
- package/lib/module/EaseView.js.map +1 -1
- package/lib/module/EaseViewNativeComponent.ts +3 -0
- package/lib/module/types.js +2 -0
- package/lib/typescript/src/EaseView.d.ts.map +1 -1
- package/lib/typescript/src/EaseViewNativeComponent.d.ts +3 -1
- package/lib/typescript/src/EaseViewNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/types.d.ts +3 -0
- package/lib/typescript/src/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/EaseView.tsx +10 -0
- package/src/EaseViewNativeComponent.ts +3 -0
- package/src/types.ts +4 -0
package/README.md
CHANGED
|
@@ -164,6 +164,24 @@ Use `{ type: 'none' }` to apply values immediately without animation. Useful for
|
|
|
164
164
|
|
|
165
165
|
When `borderRadius` is in `animate`, any `borderRadius` in `style` is automatically stripped to avoid conflicts.
|
|
166
166
|
|
|
167
|
+
### Background Color
|
|
168
|
+
|
|
169
|
+
`backgroundColor` can be animated using any React Native color value. Colors are converted to native ARGB integers via `processColor()`.
|
|
170
|
+
|
|
171
|
+
```tsx
|
|
172
|
+
<EaseView
|
|
173
|
+
animate={{ backgroundColor: isActive ? '#3B82F6' : '#E5E7EB' }}
|
|
174
|
+
transition={{ type: 'timing', duration: 300 }}
|
|
175
|
+
style={styles.card}
|
|
176
|
+
>
|
|
177
|
+
<Text>Tap to change color</Text>
|
|
178
|
+
</EaseView>
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
On Android, background color uses `ValueAnimator.ofArgb()` (timing only — spring is not supported for colors). On iOS, it uses `CAAnimation` on the `backgroundColor` layer key path and supports both timing and spring transitions.
|
|
182
|
+
|
|
183
|
+
When `backgroundColor` is in `animate`, any `backgroundColor` in `style` is automatically stripped to avoid conflicts.
|
|
184
|
+
|
|
167
185
|
### Animatable Properties
|
|
168
186
|
|
|
169
187
|
All properties are set in the `animate` prop as flat values (no transform array).
|
|
@@ -181,6 +199,7 @@ All properties are set in the `animate` prop as flat values (no transform array)
|
|
|
181
199
|
rotateX: 0, // X-axis rotation in degrees (3D)
|
|
182
200
|
rotateY: 0, // Y-axis rotation in degrees (3D)
|
|
183
201
|
borderRadius: 0, // pixels (hardware-accelerated, clips children)
|
|
202
|
+
backgroundColor: 'transparent', // any RN color value
|
|
184
203
|
}}
|
|
185
204
|
/>
|
|
186
205
|
```
|
|
@@ -325,6 +344,7 @@ A `View` that animates property changes using native platform APIs.
|
|
|
325
344
|
| `rotateX` | `number` | `0` | X-axis rotation in degrees (3D) |
|
|
326
345
|
| `rotateY` | `number` | `0` | Y-axis rotation in degrees (3D) |
|
|
327
346
|
| `borderRadius` | `number` | `0` | Border radius in pixels (hardware-accelerated, clips children) |
|
|
347
|
+
| `backgroundColor` | `ColorValue` | `'transparent'` | Background color (any RN color value). Timing-only on Android, spring+timing on iOS. |
|
|
328
348
|
|
|
329
349
|
Properties not specified in `animate` default to their identity values.
|
|
330
350
|
|
|
@@ -3,7 +3,9 @@ package com.ease
|
|
|
3
3
|
import android.animation.Animator
|
|
4
4
|
import android.animation.AnimatorListenerAdapter
|
|
5
5
|
import android.animation.ObjectAnimator
|
|
6
|
+
import android.animation.ValueAnimator
|
|
6
7
|
import android.content.Context
|
|
8
|
+
import android.graphics.Color
|
|
7
9
|
import android.graphics.Outline
|
|
8
10
|
import android.view.View
|
|
9
11
|
import android.view.ViewOutlineProvider
|
|
@@ -26,6 +28,8 @@ class EaseView(context: Context) : ReactViewGroup(context) {
|
|
|
26
28
|
private var prevRotateX: Float? = null
|
|
27
29
|
private var prevRotateY: Float? = null
|
|
28
30
|
private var prevBorderRadius: Float? = null
|
|
31
|
+
private var prevBackgroundColor: Int? = null
|
|
32
|
+
private var currentBackgroundColor: Int = Color.TRANSPARENT
|
|
29
33
|
|
|
30
34
|
// --- First mount tracking ---
|
|
31
35
|
private var isFirstMount: Boolean = true
|
|
@@ -52,11 +56,13 @@ class EaseView(context: Context) : ReactViewGroup(context) {
|
|
|
52
56
|
}
|
|
53
57
|
|
|
54
58
|
// --- Border radius (hardware-accelerated via outline clipping) ---
|
|
55
|
-
// Animated via ObjectAnimator("
|
|
59
|
+
// Animated via ObjectAnimator("animateBorderRadius") — setter invalidates outline each frame.
|
|
56
60
|
private var _borderRadius: Float = 0f
|
|
57
61
|
|
|
58
|
-
|
|
59
|
-
fun
|
|
62
|
+
@Suppress("unused") // Used by ObjectAnimator via reflection
|
|
63
|
+
fun getAnimateBorderRadius(): Float = _borderRadius
|
|
64
|
+
@Suppress("unused") // Used by ObjectAnimator via reflection
|
|
65
|
+
fun setAnimateBorderRadius(value: Float) {
|
|
60
66
|
if (_borderRadius != value) {
|
|
61
67
|
_borderRadius = value
|
|
62
68
|
if (value > 0f) {
|
|
@@ -89,6 +95,7 @@ class EaseView(context: Context) : ReactViewGroup(context) {
|
|
|
89
95
|
var initialAnimateRotateX: Float = 0.0f
|
|
90
96
|
var initialAnimateRotateY: Float = 0.0f
|
|
91
97
|
var initialAnimateBorderRadius: Float = 0.0f
|
|
98
|
+
var initialAnimateBackgroundColor: Int = Color.TRANSPARENT
|
|
92
99
|
|
|
93
100
|
// --- Pending animate values (buffered per-view, applied in onAfterUpdateTransaction) ---
|
|
94
101
|
var pendingOpacity: Float = 1.0f
|
|
@@ -100,9 +107,10 @@ class EaseView(context: Context) : ReactViewGroup(context) {
|
|
|
100
107
|
var pendingRotateX: Float = 0.0f
|
|
101
108
|
var pendingRotateY: Float = 0.0f
|
|
102
109
|
var pendingBorderRadius: Float = 0.0f
|
|
110
|
+
var pendingBackgroundColor: Int = Color.TRANSPARENT
|
|
103
111
|
|
|
104
112
|
// --- Running animations ---
|
|
105
|
-
private val runningAnimators = mutableMapOf<String,
|
|
113
|
+
private val runningAnimators = mutableMapOf<String, Animator>()
|
|
106
114
|
private val runningSpringAnimations = mutableMapOf<DynamicAnimation.ViewProperty, SpringAnimation>()
|
|
107
115
|
|
|
108
116
|
// --- Animated properties bitmask (set by ViewManager) ---
|
|
@@ -120,6 +128,7 @@ class EaseView(context: Context) : ReactViewGroup(context) {
|
|
|
120
128
|
const val MASK_ROTATE_X = 1 shl 6
|
|
121
129
|
const val MASK_ROTATE_Y = 1 shl 7
|
|
122
130
|
const val MASK_BORDER_RADIUS = 1 shl 8
|
|
131
|
+
const val MASK_BACKGROUND_COLOR = 1 shl 9
|
|
123
132
|
}
|
|
124
133
|
|
|
125
134
|
init {
|
|
@@ -169,7 +178,7 @@ class EaseView(context: Context) : ReactViewGroup(context) {
|
|
|
169
178
|
}
|
|
170
179
|
|
|
171
180
|
fun applyPendingAnimateValues() {
|
|
172
|
-
applyAnimateValues(pendingOpacity, pendingTranslateX, pendingTranslateY, pendingScaleX, pendingScaleY, pendingRotate, pendingRotateX, pendingRotateY, pendingBorderRadius)
|
|
181
|
+
applyAnimateValues(pendingOpacity, pendingTranslateX, pendingTranslateY, pendingScaleX, pendingScaleY, pendingRotate, pendingRotateX, pendingRotateY, pendingBorderRadius, pendingBackgroundColor)
|
|
173
182
|
}
|
|
174
183
|
|
|
175
184
|
private fun applyAnimateValues(
|
|
@@ -181,7 +190,8 @@ class EaseView(context: Context) : ReactViewGroup(context) {
|
|
|
181
190
|
rotate: Float,
|
|
182
191
|
rotateX: Float,
|
|
183
192
|
rotateY: Float,
|
|
184
|
-
borderRadius: Float
|
|
193
|
+
borderRadius: Float,
|
|
194
|
+
backgroundColor: Int
|
|
185
195
|
) {
|
|
186
196
|
if (pendingBatchAnimationCount > 0) {
|
|
187
197
|
onTransitionEnd?.invoke(false)
|
|
@@ -206,7 +216,8 @@ class EaseView(context: Context) : ReactViewGroup(context) {
|
|
|
206
216
|
(mask and MASK_ROTATE != 0 && initialAnimateRotate != rotate) ||
|
|
207
217
|
(mask and MASK_ROTATE_X != 0 && initialAnimateRotateX != rotateX) ||
|
|
208
218
|
(mask and MASK_ROTATE_Y != 0 && initialAnimateRotateY != rotateY) ||
|
|
209
|
-
(mask and MASK_BORDER_RADIUS != 0 && initialAnimateBorderRadius != borderRadius)
|
|
219
|
+
(mask and MASK_BORDER_RADIUS != 0 && initialAnimateBorderRadius != borderRadius) ||
|
|
220
|
+
(mask and MASK_BACKGROUND_COLOR != 0 && initialAnimateBackgroundColor != backgroundColor)
|
|
210
221
|
|
|
211
222
|
if (hasInitialAnimation) {
|
|
212
223
|
// Set initial values for animated properties
|
|
@@ -218,7 +229,8 @@ class EaseView(context: Context) : ReactViewGroup(context) {
|
|
|
218
229
|
if (mask and MASK_ROTATE != 0) this.rotation = initialAnimateRotate
|
|
219
230
|
if (mask and MASK_ROTATE_X != 0) this.rotationX = initialAnimateRotateX
|
|
220
231
|
if (mask and MASK_ROTATE_Y != 0) this.rotationY = initialAnimateRotateY
|
|
221
|
-
if (mask and MASK_BORDER_RADIUS != 0)
|
|
232
|
+
if (mask and MASK_BORDER_RADIUS != 0) setAnimateBorderRadius(initialAnimateBorderRadius)
|
|
233
|
+
if (mask and MASK_BACKGROUND_COLOR != 0) applyBackgroundColor(initialAnimateBackgroundColor)
|
|
222
234
|
|
|
223
235
|
// Animate properties that differ from initial to target
|
|
224
236
|
if (mask and MASK_OPACITY != 0 && initialAnimateOpacity != opacity) {
|
|
@@ -246,7 +258,10 @@ class EaseView(context: Context) : ReactViewGroup(context) {
|
|
|
246
258
|
animateProperty("rotationY", DynamicAnimation.ROTATION_Y, initialAnimateRotateY, rotateY, loop = true)
|
|
247
259
|
}
|
|
248
260
|
if (mask and MASK_BORDER_RADIUS != 0 && initialAnimateBorderRadius != borderRadius) {
|
|
249
|
-
animateProperty("
|
|
261
|
+
animateProperty("animateBorderRadius", null, initialAnimateBorderRadius, borderRadius, loop = true)
|
|
262
|
+
}
|
|
263
|
+
if (mask and MASK_BACKGROUND_COLOR != 0 && initialAnimateBackgroundColor != backgroundColor) {
|
|
264
|
+
animateBackgroundColor(initialAnimateBackgroundColor, backgroundColor, loop = true)
|
|
250
265
|
}
|
|
251
266
|
} else {
|
|
252
267
|
// No initial animation — set target values directly (skip non-animated)
|
|
@@ -258,7 +273,8 @@ class EaseView(context: Context) : ReactViewGroup(context) {
|
|
|
258
273
|
if (mask and MASK_ROTATE != 0) this.rotation = rotate
|
|
259
274
|
if (mask and MASK_ROTATE_X != 0) this.rotationX = rotateX
|
|
260
275
|
if (mask and MASK_ROTATE_Y != 0) this.rotationY = rotateY
|
|
261
|
-
if (mask and MASK_BORDER_RADIUS != 0)
|
|
276
|
+
if (mask and MASK_BORDER_RADIUS != 0) setAnimateBorderRadius(borderRadius)
|
|
277
|
+
if (mask and MASK_BACKGROUND_COLOR != 0) applyBackgroundColor(backgroundColor)
|
|
262
278
|
}
|
|
263
279
|
} else if (transitionType == "none") {
|
|
264
280
|
// No transition — set values immediately, cancel running animations
|
|
@@ -271,7 +287,8 @@ class EaseView(context: Context) : ReactViewGroup(context) {
|
|
|
271
287
|
if (mask and MASK_ROTATE != 0) this.rotation = rotate
|
|
272
288
|
if (mask and MASK_ROTATE_X != 0) this.rotationX = rotateX
|
|
273
289
|
if (mask and MASK_ROTATE_Y != 0) this.rotationY = rotateY
|
|
274
|
-
if (mask and MASK_BORDER_RADIUS != 0)
|
|
290
|
+
if (mask and MASK_BORDER_RADIUS != 0) setAnimateBorderRadius(borderRadius)
|
|
291
|
+
if (mask and MASK_BACKGROUND_COLOR != 0) applyBackgroundColor(backgroundColor)
|
|
275
292
|
onTransitionEnd?.invoke(true)
|
|
276
293
|
} else {
|
|
277
294
|
// Subsequent updates: animate changed properties (skip non-animated)
|
|
@@ -316,8 +333,12 @@ class EaseView(context: Context) : ReactViewGroup(context) {
|
|
|
316
333
|
}
|
|
317
334
|
|
|
318
335
|
if (prevBorderRadius != null && mask and MASK_BORDER_RADIUS != 0 && prevBorderRadius != borderRadius) {
|
|
319
|
-
val from = getCurrentValue("
|
|
320
|
-
animateProperty("
|
|
336
|
+
val from = getCurrentValue("animateBorderRadius")
|
|
337
|
+
animateProperty("animateBorderRadius", null, from, borderRadius)
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
if (prevBackgroundColor != null && mask and MASK_BACKGROUND_COLOR != 0 && prevBackgroundColor != backgroundColor) {
|
|
341
|
+
animateBackgroundColor(getCurrentBackgroundColor(), backgroundColor)
|
|
321
342
|
}
|
|
322
343
|
}
|
|
323
344
|
|
|
@@ -330,6 +351,7 @@ class EaseView(context: Context) : ReactViewGroup(context) {
|
|
|
330
351
|
prevRotateX = rotateX
|
|
331
352
|
prevRotateY = rotateY
|
|
332
353
|
prevBorderRadius = borderRadius
|
|
354
|
+
prevBackgroundColor = backgroundColor
|
|
333
355
|
}
|
|
334
356
|
|
|
335
357
|
private fun getCurrentValue(propertyName: String): Float = when (propertyName) {
|
|
@@ -341,10 +363,63 @@ class EaseView(context: Context) : ReactViewGroup(context) {
|
|
|
341
363
|
"rotation" -> this.rotation
|
|
342
364
|
"rotationX" -> this.rotationX
|
|
343
365
|
"rotationY" -> this.rotationY
|
|
344
|
-
"
|
|
366
|
+
"animateBorderRadius" -> getAnimateBorderRadius()
|
|
345
367
|
else -> 0f
|
|
346
368
|
}
|
|
347
369
|
|
|
370
|
+
private fun getCurrentBackgroundColor(): Int {
|
|
371
|
+
return currentBackgroundColor
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
private fun applyBackgroundColor(color: Int) {
|
|
375
|
+
currentBackgroundColor = color
|
|
376
|
+
setBackgroundColor(color)
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
private fun animateBackgroundColor(fromColor: Int, toColor: Int, loop: Boolean = false) {
|
|
380
|
+
runningAnimators["backgroundColor"]?.cancel()
|
|
381
|
+
|
|
382
|
+
val batchId = animationBatchId
|
|
383
|
+
pendingBatchAnimationCount++
|
|
384
|
+
|
|
385
|
+
val animator = ValueAnimator.ofArgb(fromColor, toColor).apply {
|
|
386
|
+
duration = transitionDuration.toLong()
|
|
387
|
+
interpolator = PathInterpolator(
|
|
388
|
+
transitionEasingBezier[0], transitionEasingBezier[1],
|
|
389
|
+
transitionEasingBezier[2], transitionEasingBezier[3]
|
|
390
|
+
)
|
|
391
|
+
if (loop && transitionLoop != "none") {
|
|
392
|
+
repeatCount = ValueAnimator.INFINITE
|
|
393
|
+
repeatMode = if (transitionLoop == "reverse") ValueAnimator.REVERSE else ValueAnimator.RESTART
|
|
394
|
+
}
|
|
395
|
+
addUpdateListener { animation ->
|
|
396
|
+
val color = animation.animatedValue as Int
|
|
397
|
+
this@EaseView.currentBackgroundColor = color
|
|
398
|
+
this@EaseView.setBackgroundColor(color)
|
|
399
|
+
}
|
|
400
|
+
addListener(object : AnimatorListenerAdapter() {
|
|
401
|
+
private var cancelled = false
|
|
402
|
+
override fun onAnimationStart(animation: Animator) {
|
|
403
|
+
this@EaseView.onEaseAnimationStart()
|
|
404
|
+
}
|
|
405
|
+
override fun onAnimationCancel(animation: Animator) { cancelled = true }
|
|
406
|
+
override fun onAnimationEnd(animation: Animator) {
|
|
407
|
+
this@EaseView.onEaseAnimationEnd()
|
|
408
|
+
if (batchId == animationBatchId) {
|
|
409
|
+
if (cancelled) anyInterrupted = true
|
|
410
|
+
pendingBatchAnimationCount--
|
|
411
|
+
if (pendingBatchAnimationCount <= 0) {
|
|
412
|
+
onTransitionEnd?.invoke(!anyInterrupted)
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
})
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
runningAnimators["backgroundColor"] = animator
|
|
420
|
+
animator.start()
|
|
421
|
+
}
|
|
422
|
+
|
|
348
423
|
private fun animateProperty(
|
|
349
424
|
propertyName: String,
|
|
350
425
|
viewProperty: DynamicAnimation.ViewProperty?,
|
|
@@ -524,6 +599,7 @@ class EaseView(context: Context) : ReactViewGroup(context) {
|
|
|
524
599
|
prevRotateX = null
|
|
525
600
|
prevRotateY = null
|
|
526
601
|
prevBorderRadius = null
|
|
602
|
+
prevBackgroundColor = null
|
|
527
603
|
|
|
528
604
|
this.alpha = 1f
|
|
529
605
|
this.translationX = 0f
|
|
@@ -533,7 +609,8 @@ class EaseView(context: Context) : ReactViewGroup(context) {
|
|
|
533
609
|
this.rotation = 0f
|
|
534
610
|
this.rotationX = 0f
|
|
535
611
|
this.rotationY = 0f
|
|
536
|
-
|
|
612
|
+
setAnimateBorderRadius(0f)
|
|
613
|
+
applyBackgroundColor(Color.TRANSPARENT)
|
|
537
614
|
|
|
538
615
|
isFirstMount = true
|
|
539
616
|
transitionLoop = "none"
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
package com.ease
|
|
2
2
|
|
|
3
|
+
import android.graphics.Color
|
|
3
4
|
import com.facebook.react.bridge.Arguments
|
|
4
5
|
import com.facebook.react.bridge.ReadableArray
|
|
5
6
|
import com.facebook.react.bridge.WritableMap
|
|
@@ -179,6 +180,18 @@ class EaseViewManager : ReactViewManager() {
|
|
|
179
180
|
view.pendingBorderRadius = PixelUtil.toPixelFromDIP(value)
|
|
180
181
|
}
|
|
181
182
|
|
|
183
|
+
// --- Background color ---
|
|
184
|
+
|
|
185
|
+
@ReactProp(name = "animateBackgroundColor", customType = "Color")
|
|
186
|
+
fun setAnimateBackgroundColor(view: EaseView, value: Int?) {
|
|
187
|
+
view.pendingBackgroundColor = value ?: Color.TRANSPARENT
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
@ReactProp(name = "initialAnimateBackgroundColor", customType = "Color")
|
|
191
|
+
fun setInitialAnimateBackgroundColor(view: EaseView, value: Int?) {
|
|
192
|
+
view.initialAnimateBackgroundColor = value ?: Color.TRANSPARENT
|
|
193
|
+
}
|
|
194
|
+
|
|
182
195
|
// --- Hardware layer ---
|
|
183
196
|
|
|
184
197
|
@ReactProp(name = "useHardwareLayer", defaultBoolean = false)
|
package/ios/EaseView.mm
CHANGED
|
@@ -9,12 +9,18 @@
|
|
|
9
9
|
|
|
10
10
|
#import "RCTFabricComponentsPlugins.h"
|
|
11
11
|
|
|
12
|
+
// Forward-declare private method so we can override it.
|
|
13
|
+
@interface RCTViewComponentView ()
|
|
14
|
+
- (void)invalidateLayer;
|
|
15
|
+
@end
|
|
16
|
+
|
|
12
17
|
using namespace facebook::react;
|
|
13
18
|
|
|
14
19
|
// Animation key constants
|
|
15
20
|
static NSString *const kAnimKeyOpacity = @"ease_opacity";
|
|
16
21
|
static NSString *const kAnimKeyTransform = @"ease_transform";
|
|
17
22
|
static NSString *const kAnimKeyCornerRadius = @"ease_cornerRadius";
|
|
23
|
+
static NSString *const kAnimKeyBackgroundColor = @"ease_backgroundColor";
|
|
18
24
|
|
|
19
25
|
static inline CGFloat degreesToRadians(CGFloat degrees) {
|
|
20
26
|
return degrees * M_PI / 180.0;
|
|
@@ -47,6 +53,7 @@ static const int kMaskRotate = 1 << 5;
|
|
|
47
53
|
static const int kMaskRotateX = 1 << 6;
|
|
48
54
|
static const int kMaskRotateY = 1 << 7;
|
|
49
55
|
static const int kMaskBorderRadius = 1 << 8;
|
|
56
|
+
static const int kMaskBackgroundColor = 1 << 9;
|
|
50
57
|
static const int kMaskAnyTransform = kMaskTranslateX | kMaskTranslateY |
|
|
51
58
|
kMaskScaleX | kMaskScaleY | kMaskRotate |
|
|
52
59
|
kMaskRotateX | kMaskRotateY;
|
|
@@ -217,6 +224,8 @@ static const int kMaskAnyTransform = kMaskTranslateX | kMaskTranslateY |
|
|
|
217
224
|
const auto &newViewProps =
|
|
218
225
|
*std::static_pointer_cast<const EaseViewProps>(props);
|
|
219
226
|
|
|
227
|
+
[super updateProps:props oldProps:oldProps];
|
|
228
|
+
|
|
220
229
|
[CATransaction begin];
|
|
221
230
|
[CATransaction setDisableActions:YES];
|
|
222
231
|
|
|
@@ -255,6 +264,11 @@ static const int kMaskAnyTransform = kMaskTranslateX | kMaskTranslateY |
|
|
|
255
264
|
(mask & kMaskBorderRadius) && newViewProps.initialAnimateBorderRadius !=
|
|
256
265
|
newViewProps.animateBorderRadius;
|
|
257
266
|
|
|
267
|
+
BOOL hasInitialBackgroundColor =
|
|
268
|
+
(mask & kMaskBackgroundColor) &&
|
|
269
|
+
newViewProps.initialAnimateBackgroundColor !=
|
|
270
|
+
newViewProps.animateBackgroundColor;
|
|
271
|
+
|
|
258
272
|
BOOL hasInitialTransform = NO;
|
|
259
273
|
CATransform3D initialT = CATransform3DIdentity;
|
|
260
274
|
CATransform3D targetT = CATransform3DIdentity;
|
|
@@ -265,7 +279,8 @@ static const int kMaskAnyTransform = kMaskTranslateX | kMaskTranslateY |
|
|
|
265
279
|
hasInitialTransform = !CATransform3DEqualToTransform(initialT, targetT);
|
|
266
280
|
}
|
|
267
281
|
|
|
268
|
-
if (hasInitialOpacity || hasInitialTransform || hasInitialBorderRadius
|
|
282
|
+
if (hasInitialOpacity || hasInitialTransform || hasInitialBorderRadius ||
|
|
283
|
+
hasInitialBackgroundColor) {
|
|
269
284
|
// Set initial values
|
|
270
285
|
if (mask & kMaskOpacity)
|
|
271
286
|
self.layer.opacity = newViewProps.initialAnimateOpacity;
|
|
@@ -277,6 +292,11 @@ static const int kMaskAnyTransform = kMaskTranslateX | kMaskTranslateY |
|
|
|
277
292
|
newViewProps.initialAnimateBorderRadius > 0 ||
|
|
278
293
|
newViewProps.animateBorderRadius > 0;
|
|
279
294
|
}
|
|
295
|
+
if (mask & kMaskBackgroundColor)
|
|
296
|
+
self.layer.backgroundColor =
|
|
297
|
+
RCTUIColorFromSharedColor(
|
|
298
|
+
newViewProps.initialAnimateBackgroundColor)
|
|
299
|
+
.CGColor;
|
|
280
300
|
|
|
281
301
|
// Animate from initial to target
|
|
282
302
|
if (hasInitialOpacity) {
|
|
@@ -307,6 +327,22 @@ static const int kMaskAnyTransform = kMaskTranslateX | kMaskTranslateY |
|
|
|
307
327
|
props:newViewProps
|
|
308
328
|
loop:YES];
|
|
309
329
|
}
|
|
330
|
+
if (hasInitialBackgroundColor) {
|
|
331
|
+
self.layer.backgroundColor =
|
|
332
|
+
RCTUIColorFromSharedColor(newViewProps.animateBackgroundColor)
|
|
333
|
+
.CGColor;
|
|
334
|
+
[self applyAnimationForKeyPath:@"backgroundColor"
|
|
335
|
+
animationKey:kAnimKeyBackgroundColor
|
|
336
|
+
fromValue:(__bridge id)RCTUIColorFromSharedColor(
|
|
337
|
+
newViewProps
|
|
338
|
+
.initialAnimateBackgroundColor)
|
|
339
|
+
.CGColor
|
|
340
|
+
toValue:(__bridge id)RCTUIColorFromSharedColor(
|
|
341
|
+
newViewProps.animateBackgroundColor)
|
|
342
|
+
.CGColor
|
|
343
|
+
props:newViewProps
|
|
344
|
+
loop:YES];
|
|
345
|
+
}
|
|
310
346
|
} else {
|
|
311
347
|
// No initial animation — set target values directly
|
|
312
348
|
if (mask & kMaskOpacity)
|
|
@@ -317,6 +353,10 @@ static const int kMaskAnyTransform = kMaskTranslateX | kMaskTranslateY |
|
|
|
317
353
|
self.layer.cornerRadius = newViewProps.animateBorderRadius;
|
|
318
354
|
self.layer.masksToBounds = newViewProps.animateBorderRadius > 0;
|
|
319
355
|
}
|
|
356
|
+
if (mask & kMaskBackgroundColor)
|
|
357
|
+
self.layer.backgroundColor =
|
|
358
|
+
RCTUIColorFromSharedColor(newViewProps.animateBackgroundColor)
|
|
359
|
+
.CGColor;
|
|
320
360
|
}
|
|
321
361
|
} else if (newViewProps.transitionType == EaseViewTransitionType::None) {
|
|
322
362
|
// No transition — set values immediately
|
|
@@ -329,6 +369,10 @@ static const int kMaskAnyTransform = kMaskTranslateX | kMaskTranslateY |
|
|
|
329
369
|
self.layer.cornerRadius = newViewProps.animateBorderRadius;
|
|
330
370
|
self.layer.masksToBounds = newViewProps.animateBorderRadius > 0;
|
|
331
371
|
}
|
|
372
|
+
if (mask & kMaskBackgroundColor)
|
|
373
|
+
self.layer.backgroundColor =
|
|
374
|
+
RCTUIColorFromSharedColor(newViewProps.animateBackgroundColor)
|
|
375
|
+
.CGColor;
|
|
332
376
|
if (_eventEmitter) {
|
|
333
377
|
auto emitter =
|
|
334
378
|
std::static_pointer_cast<const EaseViewEventEmitter>(_eventEmitter);
|
|
@@ -389,11 +433,58 @@ static const int kMaskAnyTransform = kMaskTranslateX | kMaskTranslateY |
|
|
|
389
433
|
props:newViewProps
|
|
390
434
|
loop:NO];
|
|
391
435
|
}
|
|
436
|
+
|
|
437
|
+
if ((mask & kMaskBackgroundColor) &&
|
|
438
|
+
oldViewProps.animateBackgroundColor !=
|
|
439
|
+
newViewProps.animateBackgroundColor) {
|
|
440
|
+
CGColorRef fromColor = (__bridge CGColorRef)
|
|
441
|
+
[self presentationValueForKeyPath:@"backgroundColor"];
|
|
442
|
+
CGColorRef toColor =
|
|
443
|
+
RCTUIColorFromSharedColor(newViewProps.animateBackgroundColor)
|
|
444
|
+
.CGColor;
|
|
445
|
+
self.layer.backgroundColor = toColor;
|
|
446
|
+
[self applyAnimationForKeyPath:@"backgroundColor"
|
|
447
|
+
animationKey:kAnimKeyBackgroundColor
|
|
448
|
+
fromValue:(__bridge id)fromColor
|
|
449
|
+
toValue:(__bridge id)toColor
|
|
450
|
+
props:newViewProps
|
|
451
|
+
loop:NO];
|
|
452
|
+
}
|
|
392
453
|
}
|
|
393
454
|
|
|
394
455
|
[CATransaction commit];
|
|
456
|
+
}
|
|
395
457
|
|
|
396
|
-
|
|
458
|
+
- (void)invalidateLayer {
|
|
459
|
+
[super invalidateLayer];
|
|
460
|
+
|
|
461
|
+
// super resets layer.opacity, layer.cornerRadius, and layer.backgroundColor
|
|
462
|
+
// from style props. Re-apply our animated values.
|
|
463
|
+
const auto &viewProps =
|
|
464
|
+
*std::static_pointer_cast<const EaseViewProps>(_props);
|
|
465
|
+
int mask = viewProps.animatedProperties;
|
|
466
|
+
|
|
467
|
+
if (!(mask & (kMaskOpacity | kMaskBorderRadius | kMaskBackgroundColor))) {
|
|
468
|
+
return;
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
[CATransaction begin];
|
|
472
|
+
[CATransaction setDisableActions:YES];
|
|
473
|
+
if (mask & kMaskOpacity) {
|
|
474
|
+
[self.layer removeAnimationForKey:@"opacity"];
|
|
475
|
+
self.layer.opacity = viewProps.animateOpacity;
|
|
476
|
+
}
|
|
477
|
+
if (mask & kMaskBorderRadius) {
|
|
478
|
+
[self.layer removeAnimationForKey:@"cornerRadius"];
|
|
479
|
+
self.layer.cornerRadius = viewProps.animateBorderRadius;
|
|
480
|
+
self.layer.masksToBounds = viewProps.animateBorderRadius > 0;
|
|
481
|
+
}
|
|
482
|
+
if (mask & kMaskBackgroundColor) {
|
|
483
|
+
[self.layer removeAnimationForKey:@"backgroundColor"];
|
|
484
|
+
self.layer.backgroundColor =
|
|
485
|
+
RCTUIColorFromSharedColor(viewProps.animateBackgroundColor).CGColor;
|
|
486
|
+
}
|
|
487
|
+
[CATransaction commit];
|
|
397
488
|
}
|
|
398
489
|
|
|
399
490
|
#pragma mark - CAAnimationDelegate
|
|
@@ -430,6 +521,7 @@ static const int kMaskAnyTransform = kMaskTranslateX | kMaskTranslateY |
|
|
|
430
521
|
self.layer.transform = CATransform3DIdentity;
|
|
431
522
|
self.layer.cornerRadius = 0;
|
|
432
523
|
self.layer.masksToBounds = NO;
|
|
524
|
+
self.layer.backgroundColor = nil;
|
|
433
525
|
}
|
|
434
526
|
|
|
435
527
|
@end
|
package/lib/module/EaseView.js
CHANGED
|
@@ -27,6 +27,7 @@ const MASK_ROTATE = 1 << 5;
|
|
|
27
27
|
const MASK_ROTATE_X = 1 << 6;
|
|
28
28
|
const MASK_ROTATE_Y = 1 << 7;
|
|
29
29
|
const MASK_BORDER_RADIUS = 1 << 8;
|
|
30
|
+
const MASK_BACKGROUND_COLOR = 1 << 9;
|
|
30
31
|
/* eslint-enable no-bitwise */
|
|
31
32
|
|
|
32
33
|
/** Maps animate prop keys to style keys that conflict. */
|
|
@@ -40,7 +41,8 @@ const ANIMATE_TO_STYLE_KEYS = {
|
|
|
40
41
|
rotate: 'transform',
|
|
41
42
|
rotateX: 'transform',
|
|
42
43
|
rotateY: 'transform',
|
|
43
|
-
borderRadius: 'borderRadius'
|
|
44
|
+
borderRadius: 'borderRadius',
|
|
45
|
+
backgroundColor: 'backgroundColor'
|
|
44
46
|
};
|
|
45
47
|
|
|
46
48
|
/** Preset easing curves as cubic bezier control points. */
|
|
@@ -73,6 +75,7 @@ export function EaseView({
|
|
|
73
75
|
if (animate?.rotateX != null) animatedProperties |= MASK_ROTATE_X;
|
|
74
76
|
if (animate?.rotateY != null) animatedProperties |= MASK_ROTATE_Y;
|
|
75
77
|
if (animate?.borderRadius != null) animatedProperties |= MASK_BORDER_RADIUS;
|
|
78
|
+
if (animate?.backgroundColor != null) animatedProperties |= MASK_BACKGROUND_COLOR;
|
|
76
79
|
/* eslint-enable no-bitwise */
|
|
77
80
|
|
|
78
81
|
// Resolve animate values (identity defaults for non-animated — safe values).
|
|
@@ -99,6 +102,10 @@ export function EaseView({
|
|
|
99
102
|
rotateY: initial?.rotateY ?? IDENTITY.rotateY
|
|
100
103
|
};
|
|
101
104
|
|
|
105
|
+
// Resolve backgroundColor — passed as ColorValue directly (codegen handles conversion)
|
|
106
|
+
const animBgColor = animate?.backgroundColor ?? 'transparent';
|
|
107
|
+
const initialBgColor = initialAnimate?.backgroundColor ?? animBgColor;
|
|
108
|
+
|
|
102
109
|
// Strip style keys that conflict with animated properties
|
|
103
110
|
let cleanStyle = style;
|
|
104
111
|
if (animate && style) {
|
|
@@ -161,6 +168,7 @@ export function EaseView({
|
|
|
161
168
|
animateRotateX: resolved.rotateX,
|
|
162
169
|
animateRotateY: resolved.rotateY,
|
|
163
170
|
animateBorderRadius: resolved.borderRadius,
|
|
171
|
+
animateBackgroundColor: animBgColor,
|
|
164
172
|
initialAnimateOpacity: resolvedInitial.opacity,
|
|
165
173
|
initialAnimateTranslateX: resolvedInitial.translateX,
|
|
166
174
|
initialAnimateTranslateY: resolvedInitial.translateY,
|
|
@@ -170,6 +178,7 @@ export function EaseView({
|
|
|
170
178
|
initialAnimateRotateX: resolvedInitial.rotateX,
|
|
171
179
|
initialAnimateRotateY: resolvedInitial.rotateY,
|
|
172
180
|
initialAnimateBorderRadius: resolvedInitial.borderRadius,
|
|
181
|
+
initialAnimateBackgroundColor: initialBgColor,
|
|
173
182
|
transitionType: transitionType,
|
|
174
183
|
transitionDuration: transitionDuration,
|
|
175
184
|
transitionEasingBezier: bezier,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["StyleSheet","NativeEaseView","jsx","_jsx","IDENTITY","opacity","translateX","translateY","scaleX","scaleY","rotate","rotateX","rotateY","borderRadius","MASK_OPACITY","MASK_TRANSLATE_X","MASK_TRANSLATE_Y","MASK_SCALE_X","MASK_SCALE_Y","MASK_ROTATE","MASK_ROTATE_X","MASK_ROTATE_Y","MASK_BORDER_RADIUS","ANIMATE_TO_STYLE_KEYS","scale","EASING_PRESETS","linear","easeIn","easeOut","easeInOut","EaseView","animate","initialAnimate","transition","onTransitionEnd","useHardwareLayer","transformOrigin","style","rest","animatedProperties","resolved","initial","resolvedInitial","cleanStyle","flat","flatten","conflicting","Set","key","Object","keys","styleKey","add","size","__DEV__","console","warn","join","cleaned","k","v","entries","has","transitionType","type","transitionDuration","duration","rawEasing","easing","Array","isArray","length","bezier","transitionDamping","damping","transitionStiffness","stiffness","transitionMass","mass","transitionLoop","loop","handleTransitionEnd","event","nativeEvent","undefined","animateOpacity","animateTranslateX","animateTranslateY","animateScaleX","animateScaleY","animateRotate","animateRotateX","animateRotateY","animateBorderRadius","initialAnimateOpacity","initialAnimateTranslateX","initialAnimateTranslateY","initialAnimateScaleX","initialAnimateScaleY","initialAnimateRotate","initialAnimateRotateX","initialAnimateRotateY","initialAnimateBorderRadius","transitionEasingBezier","transformOriginX","x","transformOriginY","y"],"sourceRoot":"../../src","sources":["EaseView.tsx"],"mappings":";;AAAA,SAASA,UAAU,QAAwC,cAAc;AACzE,OAAOC,cAAc,MAAM,2BAA2B;AAAC,SAAAC,GAAA,IAAAC,IAAA;AASvD;AACA,MAAMC,QAAQ,GAAG;EACfC,OAAO,EAAE,CAAC;EACVC,UAAU,EAAE,CAAC;EACbC,UAAU,EAAE,CAAC;EACbC,MAAM,EAAE,CAAC;EACTC,MAAM,EAAE,CAAC;EACTC,MAAM,EAAE,CAAC;EACTC,OAAO,EAAE,CAAC;EACVC,OAAO,EAAE,CAAC;EACVC,YAAY,EAAE;AAChB,CAAC;;AAED;AACA;AACA,MAAMC,YAAY,GAAG,CAAC,IAAI,CAAC;AAC3B,MAAMC,gBAAgB,GAAG,CAAC,IAAI,CAAC;AAC/B,MAAMC,gBAAgB,GAAG,CAAC,IAAI,CAAC;AAC/B,MAAMC,YAAY,GAAG,CAAC,IAAI,CAAC;AAC3B,MAAMC,YAAY,GAAG,CAAC,IAAI,CAAC;AAC3B,MAAMC,WAAW,GAAG,CAAC,IAAI,CAAC;AAC1B,MAAMC,aAAa,GAAG,CAAC,IAAI,CAAC;AAC5B,MAAMC,aAAa,GAAG,CAAC,IAAI,CAAC;AAC5B,MAAMC,kBAAkB,GAAG,CAAC,IAAI,CAAC;AACjC;;AAEA;AACA,MAAMC,qBAAyD,GAAG;
|
|
1
|
+
{"version":3,"names":["StyleSheet","NativeEaseView","jsx","_jsx","IDENTITY","opacity","translateX","translateY","scaleX","scaleY","rotate","rotateX","rotateY","borderRadius","MASK_OPACITY","MASK_TRANSLATE_X","MASK_TRANSLATE_Y","MASK_SCALE_X","MASK_SCALE_Y","MASK_ROTATE","MASK_ROTATE_X","MASK_ROTATE_Y","MASK_BORDER_RADIUS","MASK_BACKGROUND_COLOR","ANIMATE_TO_STYLE_KEYS","scale","backgroundColor","EASING_PRESETS","linear","easeIn","easeOut","easeInOut","EaseView","animate","initialAnimate","transition","onTransitionEnd","useHardwareLayer","transformOrigin","style","rest","animatedProperties","resolved","initial","resolvedInitial","animBgColor","initialBgColor","cleanStyle","flat","flatten","conflicting","Set","key","Object","keys","styleKey","add","size","__DEV__","console","warn","join","cleaned","k","v","entries","has","transitionType","type","transitionDuration","duration","rawEasing","easing","Array","isArray","length","bezier","transitionDamping","damping","transitionStiffness","stiffness","transitionMass","mass","transitionLoop","loop","handleTransitionEnd","event","nativeEvent","undefined","animateOpacity","animateTranslateX","animateTranslateY","animateScaleX","animateScaleY","animateRotate","animateRotateX","animateRotateY","animateBorderRadius","animateBackgroundColor","initialAnimateOpacity","initialAnimateTranslateX","initialAnimateTranslateY","initialAnimateScaleX","initialAnimateScaleY","initialAnimateRotate","initialAnimateRotateX","initialAnimateRotateY","initialAnimateBorderRadius","initialAnimateBackgroundColor","transitionEasingBezier","transformOriginX","x","transformOriginY","y"],"sourceRoot":"../../src","sources":["EaseView.tsx"],"mappings":";;AAAA,SAASA,UAAU,QAAwC,cAAc;AACzE,OAAOC,cAAc,MAAM,2BAA2B;AAAC,SAAAC,GAAA,IAAAC,IAAA;AASvD;AACA,MAAMC,QAAQ,GAAG;EACfC,OAAO,EAAE,CAAC;EACVC,UAAU,EAAE,CAAC;EACbC,UAAU,EAAE,CAAC;EACbC,MAAM,EAAE,CAAC;EACTC,MAAM,EAAE,CAAC;EACTC,MAAM,EAAE,CAAC;EACTC,OAAO,EAAE,CAAC;EACVC,OAAO,EAAE,CAAC;EACVC,YAAY,EAAE;AAChB,CAAC;;AAED;AACA;AACA,MAAMC,YAAY,GAAG,CAAC,IAAI,CAAC;AAC3B,MAAMC,gBAAgB,GAAG,CAAC,IAAI,CAAC;AAC/B,MAAMC,gBAAgB,GAAG,CAAC,IAAI,CAAC;AAC/B,MAAMC,YAAY,GAAG,CAAC,IAAI,CAAC;AAC3B,MAAMC,YAAY,GAAG,CAAC,IAAI,CAAC;AAC3B,MAAMC,WAAW,GAAG,CAAC,IAAI,CAAC;AAC1B,MAAMC,aAAa,GAAG,CAAC,IAAI,CAAC;AAC5B,MAAMC,aAAa,GAAG,CAAC,IAAI,CAAC;AAC5B,MAAMC,kBAAkB,GAAG,CAAC,IAAI,CAAC;AACjC,MAAMC,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,OAAQ;IAC/C+F,0BAA0B,EAAE/D,eAAe,CAAC/B,YAAa;IACzD+F,6BAA6B,EAAE9D,cAAe;IAC9CqB,cAAc,EAAEA,cAAe;IAC/BE,kBAAkB,EAAEA,kBAAmB;IACvCwC,sBAAsB,EAAEjC,MAAO;IAC/BC,iBAAiB,EAAEA,iBAAkB;IACrCE,mBAAmB,EAAEA,mBAAoB;IACzCE,cAAc,EAAEA,cAAe;IAC/BE,cAAc,EAAEA,cAAe;IAC/B9C,gBAAgB,EAAEA,gBAAiB;IACnCyE,gBAAgB,EAAExE,eAAe,EAAEyE,CAAC,IAAI,GAAI;IAC5CC,gBAAgB,EAAE1E,eAAe,EAAE2E,CAAC,IAAI,GAAI;IAAA,GACxCzE;EAAI,CACT,CAAC;AAEN","ignoreList":[]}
|
|
@@ -3,6 +3,7 @@ import {
|
|
|
3
3
|
type CodegenTypes,
|
|
4
4
|
type ViewProps,
|
|
5
5
|
type HostComponent,
|
|
6
|
+
type ColorValue,
|
|
6
7
|
} from 'react-native';
|
|
7
8
|
|
|
8
9
|
export interface NativeProps extends ViewProps {
|
|
@@ -19,6 +20,7 @@ export interface NativeProps extends ViewProps {
|
|
|
19
20
|
animateRotateX?: CodegenTypes.WithDefault<CodegenTypes.Float, 0.0>;
|
|
20
21
|
animateRotateY?: CodegenTypes.WithDefault<CodegenTypes.Float, 0.0>;
|
|
21
22
|
animateBorderRadius?: CodegenTypes.WithDefault<CodegenTypes.Float, 0.0>;
|
|
23
|
+
animateBackgroundColor?: ColorValue;
|
|
22
24
|
|
|
23
25
|
// Initial values for enter animations
|
|
24
26
|
initialAnimateOpacity?: CodegenTypes.WithDefault<CodegenTypes.Float, 1.0>;
|
|
@@ -33,6 +35,7 @@ export interface NativeProps extends ViewProps {
|
|
|
33
35
|
CodegenTypes.Float,
|
|
34
36
|
0.0
|
|
35
37
|
>;
|
|
38
|
+
initialAnimateBackgroundColor?: ColorValue;
|
|
36
39
|
|
|
37
40
|
// Transition config
|
|
38
41
|
transitionType?: CodegenTypes.WithDefault<
|
package/lib/module/types.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EaseView.d.ts","sourceRoot":"","sources":["../../../src/EaseView.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,SAAS,EAAkB,MAAM,cAAc,CAAC;AAE1E,OAAO,KAAK,EACV,YAAY,EAEZ,UAAU,EACV,kBAAkB,EAClB,eAAe,EAChB,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"EaseView.d.ts","sourceRoot":"","sources":["../../../src/EaseView.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,SAAS,EAAkB,MAAM,cAAc,CAAC;AAE1E,OAAO,KAAK,EACV,YAAY,EAEZ,UAAU,EACV,kBAAkB,EAClB,eAAe,EAChB,MAAM,SAAS,CAAC;AAoDjB,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG;IACtC,6CAA6C;IAC7C,OAAO,CAAC,EAAE,YAAY,CAAC;IACvB,4EAA4E;IAC5E,cAAc,CAAC,EAAE,YAAY,CAAC;IAC9B,kDAAkD;IAClD,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,wGAAwG;IACxG,eAAe,CAAC,EAAE,CAAC,KAAK,EAAE,kBAAkB,KAAK,IAAI,CAAC;IACtD;;;;;;;;;;;;;;;OAeG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,gGAAgG;IAChG,eAAe,CAAC,EAAE,eAAe,CAAC;CACnC,CAAC;AAEF,wBAAgB,QAAQ,CAAC,EACvB,OAAO,EACP,cAAc,EACd,UAAU,EACV,eAAe,EACf,gBAAwB,EACxB,eAAe,EACf,KAAK,EACL,GAAG,IAAI,EACR,EAAE,aAAa,2CAsKf"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type CodegenTypes, type ViewProps, type HostComponent } from 'react-native';
|
|
1
|
+
import { type CodegenTypes, type ViewProps, type HostComponent, type ColorValue } from 'react-native';
|
|
2
2
|
export interface NativeProps extends ViewProps {
|
|
3
3
|
animatedProperties?: CodegenTypes.WithDefault<CodegenTypes.Int32, 0>;
|
|
4
4
|
animateOpacity?: CodegenTypes.WithDefault<CodegenTypes.Float, 1.0>;
|
|
@@ -10,6 +10,7 @@ export interface NativeProps extends ViewProps {
|
|
|
10
10
|
animateRotateX?: CodegenTypes.WithDefault<CodegenTypes.Float, 0.0>;
|
|
11
11
|
animateRotateY?: CodegenTypes.WithDefault<CodegenTypes.Float, 0.0>;
|
|
12
12
|
animateBorderRadius?: CodegenTypes.WithDefault<CodegenTypes.Float, 0.0>;
|
|
13
|
+
animateBackgroundColor?: ColorValue;
|
|
13
14
|
initialAnimateOpacity?: CodegenTypes.WithDefault<CodegenTypes.Float, 1.0>;
|
|
14
15
|
initialAnimateTranslateX?: CodegenTypes.WithDefault<CodegenTypes.Float, 0.0>;
|
|
15
16
|
initialAnimateTranslateY?: CodegenTypes.WithDefault<CodegenTypes.Float, 0.0>;
|
|
@@ -19,6 +20,7 @@ export interface NativeProps extends ViewProps {
|
|
|
19
20
|
initialAnimateRotateX?: CodegenTypes.WithDefault<CodegenTypes.Float, 0.0>;
|
|
20
21
|
initialAnimateRotateY?: CodegenTypes.WithDefault<CodegenTypes.Float, 0.0>;
|
|
21
22
|
initialAnimateBorderRadius?: CodegenTypes.WithDefault<CodegenTypes.Float, 0.0>;
|
|
23
|
+
initialAnimateBackgroundColor?: ColorValue;
|
|
22
24
|
transitionType?: CodegenTypes.WithDefault<'timing' | 'spring' | 'none', 'timing'>;
|
|
23
25
|
transitionDuration?: CodegenTypes.WithDefault<CodegenTypes.Int32, 300>;
|
|
24
26
|
transitionEasingBezier?: ReadonlyArray<CodegenTypes.Float>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EaseViewNativeComponent.d.ts","sourceRoot":"","sources":["../../../src/EaseViewNativeComponent.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,YAAY,EACjB,K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C;IACvE,mBAAmB,CAAC,EAAE,YAAY,CAAC,WAAW,CAAC,YAAY,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IAC1E,cAAc,CAAC,EAAE,YAAY,CAAC,WAAW,CAAC,YAAY,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IACnE,cAAc,CAAC,EAAE,YAAY,CAAC,WAAW,CACvC,MAAM,GAAG,QAAQ,GAAG,SAAS,EAC7B,MAAM,CACP,CAAC;IAGF,gBAAgB,CAAC,EAAE,YAAY,CAAC,WAAW,CAAC,YAAY,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IACrE,gBAAgB,CAAC,EAAE,YAAY,CAAC,WAAW,CAAC,YAAY,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IAGrE,eAAe,CAAC,EAAE,YAAY,CAAC,kBAAkB,CAC/C,QAAQ,CAAC;QAAE,QAAQ,EAAE,OAAO,CAAA;KAAE,CAAC,CAChC,CAAC;IAGF,gBAAgB,CAAC,EAAE,YAAY,CAAC,WAAW,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;CAC7D;wBAII,aAAa,CAAC,WAAW,CAAC;AAF/B,wBAEgC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ColorValue } from 'react-native';
|
|
1
2
|
/** Cubic bezier control points: [x1, y1, x2, y2]. */
|
|
2
3
|
export type CubicBezier = [number, number, number, number];
|
|
3
4
|
/** Easing curve for timing animations. */
|
|
@@ -62,5 +63,7 @@ export type AnimateProps = {
|
|
|
62
63
|
rotateY?: number;
|
|
63
64
|
/** Border radius in pixels. Uses hardware-accelerated clipping (ViewOutlineProvider on Android, layer.cornerRadius on iOS). @default 0 */
|
|
64
65
|
borderRadius?: number;
|
|
66
|
+
/** Background color. Accepts any React Native color value. @default 'transparent' */
|
|
67
|
+
backgroundColor?: ColorValue;
|
|
65
68
|
};
|
|
66
69
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-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aseView.tsx
CHANGED
|
@@ -32,6 +32,7 @@ const MASK_ROTATE = 1 << 5;
|
|
|
32
32
|
const MASK_ROTATE_X = 1 << 6;
|
|
33
33
|
const MASK_ROTATE_Y = 1 << 7;
|
|
34
34
|
const MASK_BORDER_RADIUS = 1 << 8;
|
|
35
|
+
const MASK_BACKGROUND_COLOR = 1 << 9;
|
|
35
36
|
/* eslint-enable no-bitwise */
|
|
36
37
|
|
|
37
38
|
/** Maps animate prop keys to style keys that conflict. */
|
|
@@ -46,6 +47,7 @@ const ANIMATE_TO_STYLE_KEYS: Record<keyof AnimateProps, string> = {
|
|
|
46
47
|
rotateX: 'transform',
|
|
47
48
|
rotateY: 'transform',
|
|
48
49
|
borderRadius: 'borderRadius',
|
|
50
|
+
backgroundColor: 'backgroundColor',
|
|
49
51
|
};
|
|
50
52
|
|
|
51
53
|
/** Preset easing curves as cubic bezier control points. */
|
|
@@ -111,6 +113,8 @@ export function EaseView({
|
|
|
111
113
|
if (animate?.rotateX != null) animatedProperties |= MASK_ROTATE_X;
|
|
112
114
|
if (animate?.rotateY != null) animatedProperties |= MASK_ROTATE_Y;
|
|
113
115
|
if (animate?.borderRadius != null) animatedProperties |= MASK_BORDER_RADIUS;
|
|
116
|
+
if (animate?.backgroundColor != null)
|
|
117
|
+
animatedProperties |= MASK_BACKGROUND_COLOR;
|
|
114
118
|
/* eslint-enable no-bitwise */
|
|
115
119
|
|
|
116
120
|
// Resolve animate values (identity defaults for non-animated — safe values).
|
|
@@ -137,6 +141,10 @@ export function EaseView({
|
|
|
137
141
|
rotateY: initial?.rotateY ?? IDENTITY.rotateY,
|
|
138
142
|
};
|
|
139
143
|
|
|
144
|
+
// Resolve backgroundColor — passed as ColorValue directly (codegen handles conversion)
|
|
145
|
+
const animBgColor = animate?.backgroundColor ?? 'transparent';
|
|
146
|
+
const initialBgColor = initialAnimate?.backgroundColor ?? animBgColor;
|
|
147
|
+
|
|
140
148
|
// Strip style keys that conflict with animated properties
|
|
141
149
|
let cleanStyle: ViewProps['style'] = style;
|
|
142
150
|
if (animate && style) {
|
|
@@ -231,6 +239,7 @@ export function EaseView({
|
|
|
231
239
|
animateRotateX={resolved.rotateX}
|
|
232
240
|
animateRotateY={resolved.rotateY}
|
|
233
241
|
animateBorderRadius={resolved.borderRadius}
|
|
242
|
+
animateBackgroundColor={animBgColor}
|
|
234
243
|
initialAnimateOpacity={resolvedInitial.opacity}
|
|
235
244
|
initialAnimateTranslateX={resolvedInitial.translateX}
|
|
236
245
|
initialAnimateTranslateY={resolvedInitial.translateY}
|
|
@@ -240,6 +249,7 @@ export function EaseView({
|
|
|
240
249
|
initialAnimateRotateX={resolvedInitial.rotateX}
|
|
241
250
|
initialAnimateRotateY={resolvedInitial.rotateY}
|
|
242
251
|
initialAnimateBorderRadius={resolvedInitial.borderRadius}
|
|
252
|
+
initialAnimateBackgroundColor={initialBgColor}
|
|
243
253
|
transitionType={transitionType}
|
|
244
254
|
transitionDuration={transitionDuration}
|
|
245
255
|
transitionEasingBezier={bezier}
|
|
@@ -3,6 +3,7 @@ import {
|
|
|
3
3
|
type CodegenTypes,
|
|
4
4
|
type ViewProps,
|
|
5
5
|
type HostComponent,
|
|
6
|
+
type ColorValue,
|
|
6
7
|
} from 'react-native';
|
|
7
8
|
|
|
8
9
|
export interface NativeProps extends ViewProps {
|
|
@@ -19,6 +20,7 @@ export interface NativeProps extends ViewProps {
|
|
|
19
20
|
animateRotateX?: CodegenTypes.WithDefault<CodegenTypes.Float, 0.0>;
|
|
20
21
|
animateRotateY?: CodegenTypes.WithDefault<CodegenTypes.Float, 0.0>;
|
|
21
22
|
animateBorderRadius?: CodegenTypes.WithDefault<CodegenTypes.Float, 0.0>;
|
|
23
|
+
animateBackgroundColor?: ColorValue;
|
|
22
24
|
|
|
23
25
|
// Initial values for enter animations
|
|
24
26
|
initialAnimateOpacity?: CodegenTypes.WithDefault<CodegenTypes.Float, 1.0>;
|
|
@@ -33,6 +35,7 @@ export interface NativeProps extends ViewProps {
|
|
|
33
35
|
CodegenTypes.Float,
|
|
34
36
|
0.0
|
|
35
37
|
>;
|
|
38
|
+
initialAnimateBackgroundColor?: ColorValue;
|
|
36
39
|
|
|
37
40
|
// Transition config
|
|
38
41
|
transitionType?: CodegenTypes.WithDefault<
|
package/src/types.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { ColorValue } from 'react-native';
|
|
2
|
+
|
|
1
3
|
/** Cubic bezier control points: [x1, y1, x2, y2]. */
|
|
2
4
|
export type CubicBezier = [number, number, number, number];
|
|
3
5
|
|
|
@@ -75,4 +77,6 @@ export type AnimateProps = {
|
|
|
75
77
|
rotateY?: number;
|
|
76
78
|
/** Border radius in pixels. Uses hardware-accelerated clipping (ViewOutlineProvider on Android, layer.cornerRadius on iOS). @default 0 */
|
|
77
79
|
borderRadius?: number;
|
|
80
|
+
/** Background color. Accepts any React Native color value. @default 'transparent' */
|
|
81
|
+
backgroundColor?: ColorValue;
|
|
78
82
|
};
|