@sbaiahmed1/react-native-blur 4.6.4-beta.2 → 4.6.4-beta.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.
@@ -6,6 +6,8 @@ import UIKit
6
6
 
7
7
  class BlurEffectView: UIVisualEffectView {
8
8
  private var animator: UIViewPropertyAnimator?
9
+ private var blurStyle: UIBlurEffect.Style = .systemMaterial
10
+ private var blurIntensity: Double = 1.0
9
11
 
10
12
  override init(effect: UIVisualEffect?) {
11
13
  super.init(effect: effect)
@@ -16,20 +18,30 @@ class BlurEffectView: UIVisualEffectView {
16
18
  }
17
19
 
18
20
  func updateBlur(style: UIBlurEffect.Style, intensity: Double) {
21
+ blurStyle = style
22
+ blurIntensity = intensity
23
+ setNeedsDisplay()
24
+ }
25
+
26
+ // draw(_:) is called by UIVisualEffectView whenever the effect needs to refresh —
27
+ // including when the view re-enters a window after navigation. Rebuilding the
28
+ // animator here ensures intensity is always correct on re-appearance.
29
+ override func draw(_ rect: CGRect) {
30
+ super.draw(rect)
31
+
19
32
  // Paused animators hang Detox indefinitely — use on/off blur when Detox is running
20
33
  if isDetoxPresent() {
21
- animator?.stopAnimation(true)
22
- animator = nil
23
- effect = intensity > 0 ? UIBlurEffect(style: style) : nil
34
+ effect = blurIntensity > 0 ? UIBlurEffect(style: blurStyle) : nil
24
35
  return
25
36
  }
26
37
 
27
38
  effect = nil
28
39
  animator?.stopAnimation(true)
29
40
  animator = UIViewPropertyAnimator(duration: 1, curve: .linear) { [weak self] in
30
- self?.effect = UIBlurEffect(style: style)
41
+ guard let self else { return }
42
+ self.effect = UIBlurEffect(style: self.blurStyle)
31
43
  }
32
- animator?.fractionComplete = CGFloat(intensity)
44
+ animator?.fractionComplete = CGFloat(blurIntensity)
33
45
  }
34
46
 
35
47
  deinit {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sbaiahmed1/react-native-blur",
3
- "version": "4.6.4-beta.02",
3
+ "version": "4.6.4-beta.03",
4
4
  "description": "React native modern blur view",
5
5
  "main": "./lib/module/index.js",
6
6
  "types": "./lib/typescript/src/index.d.ts",