@sbaiahmed1/react-native-blur 4.6.3-beta.0 → 4.6.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.
|
@@ -251,6 +251,9 @@ class ReactNativeBlurView : BlurViewGroup {
|
|
|
251
251
|
|
|
252
252
|
/**
|
|
253
253
|
* Set the glass tint color for liquid glass effect.
|
|
254
|
+
* @param color The color string in hex format (e.g., "#FF0000") or null to clear
|
|
255
|
+
*/
|
|
256
|
+
fun setGlassTintColor(color: String?) {
|
|
254
257
|
color?.let {
|
|
255
258
|
try {
|
|
256
259
|
glassTintColor = it.toColorInt()
|
|
@@ -9,6 +9,7 @@ class BlurEffectView: UIVisualEffectView {
|
|
|
9
9
|
private var animator: UIViewPropertyAnimator?
|
|
10
10
|
private var blurStyle: UIBlurEffect.Style = .systemMaterial
|
|
11
11
|
private var intensity: Double = 1.0
|
|
12
|
+
private var currentEffectStyle: UIBlurEffect.Style?
|
|
12
13
|
|
|
13
14
|
override init(effect: UIVisualEffect?) {
|
|
14
15
|
super.init(effect: effect)
|
|
@@ -26,19 +27,19 @@ class BlurEffectView: UIVisualEffectView {
|
|
|
26
27
|
self.intensity = intensity
|
|
27
28
|
|
|
28
29
|
if intensity == 1.0 {
|
|
29
|
-
// Fast path: full blur, skip animator entirely
|
|
30
30
|
animator?.stopAnimation(true)
|
|
31
31
|
animator = nil
|
|
32
|
+
currentEffectStyle = style
|
|
32
33
|
effect = UIBlurEffect(style: style)
|
|
33
34
|
} else if intensity == 0.0 {
|
|
34
|
-
// Fast path: no blur
|
|
35
35
|
animator?.stopAnimation(true)
|
|
36
36
|
animator = nil
|
|
37
|
+
currentEffectStyle = nil
|
|
37
38
|
effect = nil
|
|
38
39
|
} else {
|
|
39
|
-
// Reuse existing animator if possible, only recreate if style changed
|
|
40
40
|
if let existing = animator,
|
|
41
|
-
existing.state == .active || existing.state == .inactive
|
|
41
|
+
(existing.state == .active || existing.state == .inactive),
|
|
42
|
+
currentEffectStyle == style {
|
|
42
43
|
existing.fractionComplete = intensity
|
|
43
44
|
} else {
|
|
44
45
|
setupBlur()
|
|
@@ -53,6 +54,7 @@ class BlurEffectView: UIVisualEffectView {
|
|
|
53
54
|
animator = nil
|
|
54
55
|
|
|
55
56
|
effect = nil
|
|
57
|
+
currentEffectStyle = blurStyle
|
|
56
58
|
|
|
57
59
|
let newAnimator = UIViewPropertyAnimator(duration: 1, curve: .linear)
|
|
58
60
|
newAnimator.addAnimations { [weak self] in
|