react-native-blur-vibe 0.1.0 → 0.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/README.md CHANGED
@@ -1,9 +1,11 @@
1
- # react-native-blur-vibe
2
-
3
- A modern, actively maintained blur view for React Native. Works on **iOS** and **Android** with full New Architecture (Fabric) support.
1
+ # React Native Blur-Vibe
2
+
3
+ <img width="1500" height="500" alt="github-banner" src="https://github.com/user-attachments/assets/78b2e5ec-5b57-48c0-b984-69cb57cbcf26" />
4
+ <br></br>
5
+ A modern, actively maintained blur view for React Native. Works on <b>iOS</b> and <b>Android</b> with full New Architecture (Fabric) support.
4
6
 
5
7
  > The key difference from other blur libraries: `overlayColor` works on **both iOS and Android** — letting you control blur visibility the same way CSS `backdrop-filter` + `background-color` works on the web.
6
-
8
+ <br></br>
7
9
  [![npm version](https://img.shields.io/npm/v/react-native-blur-vibe)](https://www.npmjs.com/package/react-native-blur-vibe)
8
10
  [![Build iOS](https://github.com/I-am-Pritam-20/react-native-blur-vibe/actions/workflows/build-ios.yml/badge.svg)](https://github.com/I-am-Pritam-20/react-native-blur-vibe/actions/workflows/build-ios.yml)
9
11
  [![Build Android](https://github.com/I-am-Pritam-20/react-native-blur-vibe/actions/workflows/build-android.yml/badge.svg)](https://github.com/I-am-Pritam-20/react-native-blur-vibe/actions/workflows/build-android.yml)
@@ -46,6 +48,20 @@ The `overlayColor` alpha channel is what controls blur visibility:
46
48
  **This works on both iOS and Android.** Not just Android like other libraries.
47
49
 
48
50
  ---
51
+
52
+ <details>
53
+ <summary><h3>Screenshots (Expand to see)</h3></summary>
54
+ <table>
55
+ <tr>
56
+ <td align="center"> <h3>Android</h3>
57
+ <img width="244" height="462" alt="Android-Demo" src="https://github.com/user-attachments/assets/e1cd120e-1ce1-4bba-aef1-4182aa023fbb" />
58
+ </td>
59
+ <td align="center"> <h3>iOS</h3>
60
+ <img width="244" height="462" alt="iPhone-Demo" src="https://github.com/user-attachments/assets/4b8ad035-d2ff-471e-b3e6-a645c87ea066" />
61
+ </td>
62
+ </tr>
63
+ </table>
64
+ </details>
49
65
 
50
66
  ## Installation
51
67
 
@@ -6,7 +6,9 @@ import com.facebook.react.bridge.ReactApplicationContext
6
6
  import com.facebook.react.uimanager.ViewManager
7
7
 
8
8
  class BlurVibePackage : ReactPackage {
9
- override fun createNativeModules(reactContext: ReactApplicationContext): List<NativeModule> = emptyList()
9
+ override fun createNativeModules(reactContext: ReactApplicationContext): List<NativeModule> =
10
+ emptyList()
11
+
10
12
  override fun createViewManagers(reactContext: ReactApplicationContext): List<ViewManager<*, *>> =
11
13
  listOf(BlurVibeViewManager())
12
14
  }
@@ -17,13 +17,19 @@ import android.view.ViewGroup
17
17
  import android.widget.FrameLayout
18
18
 
19
19
  /**
20
- * BlurVibeView — Android implementation
20
+ * BlurVibeView
21
21
  *
22
- * API 31+ : RenderEffect (hardware accelerated)
23
- * API 24-30: RenderScript (built into Android SDK, no extra dep needed)
22
+ * Extends FrameLayout required because:
23
+ * 1. We host children (overlay view + React children)
24
+ * 2. ViewGroupManager (used in manager) requires a ViewGroup subclass
25
+ * 3. SimpleViewManager cast to IViewGroupManager would crash
24
26
  *
25
- * overlayColor sits on top of blur — like CSS:
26
- * backdrop-filter: blur(Xpx) + background-color: overlayColor
27
+ * Blur strategy:
28
+ * API 31+ → RenderEffect (hardware accelerated, no bitmap)
29
+ * API 24-30 → RenderScript (bitmap-based, built into Android SDK)
30
+ *
31
+ * Color props received as hex strings from JS, parsed manually.
32
+ * Supports: "transparent", "#RGB", "#RRGGBB", "#RRGGBBAA"
27
33
  */
28
34
  @SuppressLint("NewApi")
29
35
  class BlurVibeView(context: Context) : FrameLayout(context) {
@@ -31,44 +37,72 @@ class BlurVibeView(context: Context) : FrameLayout(context) {
31
37
  private val overlayView = View(context)
32
38
  private var blurAmountValue: Float = 10f
33
39
  private var overlayColorValue: Int = Color.TRANSPARENT
34
- private var reducedTransparencyFallbackColorValue: Int = Color.parseColor("#F2F2F2")
40
+ private var fallbackColorValue: Int = Color.parseColor("#F2F2F2")
35
41
  private var blurRadiusDownscale: Int = 4
36
42
 
37
43
  init {
38
- setWillNotDraw(false)
39
- overlayView.layoutParams = LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)
44
+ // overlayView fills entire frame, sits above blur, below React children
45
+ overlayView.layoutParams = LayoutParams(
46
+ LayoutParams.MATCH_PARENT,
47
+ LayoutParams.MATCH_PARENT
48
+ )
40
49
  overlayView.isClickable = false
41
50
  overlayView.isFocusable = false
42
- addView(overlayView)
43
- applyBlur()
51
+ // Add overlay as first child — React children added later will be on top
52
+ super.addView(overlayView, 0)
53
+ }
54
+
55
+ // MARK: - React child management
56
+ // Must override to ensure React children go ABOVE our overlay view
57
+
58
+ override fun addView(child: View, index: Int) {
59
+ if (child === overlayView) {
60
+ super.addView(child, index)
61
+ return
62
+ }
63
+ // React children always go on top of overlay
64
+ super.addView(child, childCount)
44
65
  }
45
66
 
67
+ override fun addView(child: View) {
68
+ if (child === overlayView) {
69
+ super.addView(child)
70
+ return
71
+ }
72
+ super.addView(child, childCount)
73
+ }
74
+
75
+ // MARK: - Setters (called by BlurVibeViewManager)
76
+
46
77
  fun setBlurAmount(amount: Float) {
47
78
  blurAmountValue = amount.coerceIn(0f, 100f)
48
79
  applyBlur()
49
80
  }
50
81
 
51
- fun setOverlayColor(color: Int) {
52
- overlayColorValue = color
53
- updateOverlay()
82
+ fun setOverlayColor(colorString: String?) {
83
+ overlayColorValue = parseHexColor(colorString ?: "transparent") ?: Color.TRANSPARENT
84
+ overlayView.setBackgroundColor(overlayColorValue)
54
85
  }
55
86
 
56
- fun setReducedTransparencyFallbackColor(color: Int) {
57
- reducedTransparencyFallbackColorValue = color
87
+ fun setReducedTransparencyFallbackColor(colorString: String?) {
88
+ fallbackColorValue = parseHexColor(colorString ?: "#F2F2F2") ?: Color.parseColor("#F2F2F2")
58
89
  }
59
90
 
60
91
  fun setBlurRadius(radius: Int) {
61
92
  blurRadiusDownscale = radius.coerceIn(1, 8)
62
- applyBlur()
93
+ if (Build.VERSION.SDK_INT < Build.VERSION_CODES.S) {
94
+ post { renderScriptBlur() }
95
+ }
63
96
  }
64
97
 
98
+ // MARK: - Blur
99
+
65
100
  private fun applyBlur() {
66
101
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
67
102
  applyRenderEffect()
68
103
  } else {
69
104
  post { renderScriptBlur() }
70
105
  }
71
- updateOverlay()
72
106
  }
73
107
 
74
108
  private fun applyRenderEffect() {
@@ -106,16 +140,7 @@ class BlurVibeView(context: Context) : FrameLayout(context) {
106
140
 
107
141
  background = android.graphics.drawable.BitmapDrawable(resources, bitmap)
108
142
  } catch (e: Exception) {
109
- setBackgroundColor(reducedTransparencyFallbackColorValue)
110
- }
111
- }
112
-
113
- private fun updateOverlay() {
114
- overlayView.setBackgroundColor(overlayColorValue)
115
- bringChildToFront(overlayView)
116
- for (i in 0 until childCount) {
117
- val child = getChildAt(i)
118
- if (child !== overlayView) bringChildToFront(child)
143
+ setBackgroundColor(fallbackColorValue)
119
144
  }
120
145
  }
121
146
 
@@ -125,4 +150,38 @@ class BlurVibeView(context: Context) : FrameLayout(context) {
125
150
  post { renderScriptBlur() }
126
151
  }
127
152
  }
153
+
154
+ // MARK: - Hex color parser
155
+ // Supports: "transparent", "#RGB", "#RRGGBB", "#RRGGBBAA"
156
+ private fun parseHexColor(colorString: String): Int? {
157
+ val s = colorString.trim()
158
+ if (s.equals("transparent", ignoreCase = true)) return Color.TRANSPARENT
159
+ if (!s.startsWith("#")) return null
160
+ val hex = s.removePrefix("#")
161
+ return try {
162
+ when (hex.length) {
163
+ 3 -> Color.argb(
164
+ 255,
165
+ hex[0].toString().repeat(2).toInt(16),
166
+ hex[1].toString().repeat(2).toInt(16),
167
+ hex[2].toString().repeat(2).toInt(16)
168
+ )
169
+ 6 -> Color.argb(
170
+ 255,
171
+ hex.substring(0, 2).toInt(16),
172
+ hex.substring(2, 4).toInt(16),
173
+ hex.substring(4, 6).toInt(16)
174
+ )
175
+ 8 -> Color.argb(
176
+ hex.substring(6, 8).toInt(16), // alpha last in #RRGGBBAA
177
+ hex.substring(0, 2).toInt(16),
178
+ hex.substring(2, 4).toInt(16),
179
+ hex.substring(4, 6).toInt(16)
180
+ )
181
+ else -> null
182
+ }
183
+ } catch (e: NumberFormatException) {
184
+ null
185
+ }
186
+ }
128
187
  }
@@ -1,35 +1,49 @@
1
1
  package com.blurvibe
2
2
 
3
- import com.facebook.react.uimanager.SimpleViewManager
4
3
  import com.facebook.react.uimanager.ThemedReactContext
4
+ import com.facebook.react.uimanager.ViewGroupManager
5
5
  import com.facebook.react.uimanager.annotations.ReactProp
6
6
 
7
- class BlurVibeViewManager : SimpleViewManager<BlurVibeView>() {
7
+ /**
8
+ * BlurVibeViewManager
9
+ *
10
+ * Extends ViewGroupManager — NOT SimpleViewManager.
11
+ * Reason: BlurVibeView hosts children (overlay + React children).
12
+ * SimpleViewManager cast to IViewGroupManager crashes at runtime.
13
+ * ViewGroupManager correctly implements IViewGroupManager interface.
14
+ */
15
+ class BlurVibeViewManager : ViewGroupManager<BlurVibeView>() {
8
16
 
9
17
  override fun getName() = "BlurVibeView"
10
18
 
11
19
  override fun createViewInstance(context: ThemedReactContext) = BlurVibeView(context)
12
20
 
21
+ // Float — matches TS NativeComponent Float
13
22
  @ReactProp(name = "blurAmount", defaultFloat = 10f)
14
23
  fun setBlurAmount(view: BlurVibeView, amount: Float) {
15
24
  view.setBlurAmount(amount)
16
25
  }
17
26
 
27
+ // String — matches TS NativeComponent string (no-op on Android)
18
28
  @ReactProp(name = "blurType")
19
29
  fun setBlurType(view: BlurVibeView, type: String?) {
20
- // No-op on Android — blurType is iOS UIBlurEffectStyle only
30
+ // No-op — blurType maps to iOS UIBlurEffectStyle only
21
31
  }
22
32
 
33
+ // String — matches TS NativeComponent string
34
+ // Parsed as hex in BlurVibeView — no customType="Color" needed
23
35
  @ReactProp(name = "overlayColor")
24
- fun setOverlayColor(view: BlurVibeView, color: Int) {
36
+ fun setOverlayColor(view: BlurVibeView, color: String?) {
25
37
  view.setOverlayColor(color)
26
38
  }
27
39
 
40
+ // String — matches TS NativeComponent string
28
41
  @ReactProp(name = "reducedTransparencyFallbackColor")
29
- fun setReducedTransparencyFallbackColor(view: BlurVibeView, color: Int) {
42
+ fun setReducedTransparencyFallbackColor(view: BlurVibeView, color: String?) {
30
43
  view.setReducedTransparencyFallbackColor(color)
31
44
  }
32
45
 
46
+ // Int — matches TS NativeComponent Int32
33
47
  @ReactProp(name = "blurRadius", defaultInt = 4)
34
48
  fun setBlurRadius(view: BlurVibeView, radius: Int) {
35
49
  view.setBlurRadius(radius)
@@ -7,18 +7,25 @@ class BlurVibeView: UIView {
7
7
  private var blurEffectView: UIVisualEffectView?
8
8
  private let overlayView = UIView()
9
9
 
10
- // MARK: - Properties
10
+ // MARK: - Props
11
11
 
12
+ /// Blur intensity 0–100. Maps to UIBlurEffect intensity via animator.
12
13
  @objc var blurAmount: NSNumber = 10 { didSet { updateBlur() } }
14
+
15
+ /// iOS blur style — maps to UIBlurEffectStyle
13
16
  @objc var blurType: NSString = "light" { didSet { updateBlur() } }
14
17
 
15
- /// Overlay color ON TOP of blur layer — works on iOS AND Android.
16
- /// Alpha channel controls visibility, just like CSS:
17
- /// backdrop-filter: blur(Xpx) + background-color: overlayColor
18
- /// "#00000000" = pure blur, "#00000080" = tinted blur, "#000000FF" = hidden blur
18
+ /// Overlay color on top of blur. Works on iOS AND Android.
19
+ /// Alpha controls blur visibility like CSS backdrop-filter + background-color.
20
+ /// Supports: "transparent", "#RGB", "#RRGGBB", "#RRGGBBAA"
19
21
  @objc var overlayColor: NSString = "transparent" { didSet { updateOverlay() } }
22
+
23
+ /// Fallback color when Reduce Transparency is enabled.
20
24
  @objc var reducedTransparencyFallbackColor: NSString = "#F2F2F2" { didSet { updateBlur() } }
21
25
 
26
+ /// Android-only downscale factor. Accepted on iOS to avoid prop warning — no-op.
27
+ @objc var blurRadius: NSNumber = 4
28
+
22
29
  // MARK: - Init
23
30
  override init(frame: CGRect) { super.init(frame: frame); commonInit() }
24
31
  required init?(coder: NSCoder) { super.init(coder: coder); commonInit() }
@@ -47,7 +54,8 @@ class BlurVibeView: UIView {
47
54
  if UIAccessibility.isReduceTransparencyEnabled {
48
55
  blurEffectView?.removeFromSuperview()
49
56
  blurEffectView = nil
50
- backgroundColor = parseColor(reducedTransparencyFallbackColor as String) ?? UIColor(white: 0.95, alpha: 1)
57
+ backgroundColor = parseColor(reducedTransparencyFallbackColor as String)
58
+ ?? UIColor(white: 0.95, alpha: 1)
51
59
  return
52
60
  }
53
61
  backgroundColor = .clear
@@ -102,7 +110,8 @@ class BlurVibeView: UIView {
102
110
  }
103
111
  }
104
112
 
105
- // MARK: - Color Parser — supports #RGB, #RRGGBB, #RRGGBBAA
113
+ // MARK: - Color Parser
114
+ // Supports: "transparent", "#RGB", "#RRGGBB", "#RRGGBBAA"
106
115
  private func parseColor(_ colorString: String) -> UIColor? {
107
116
  var hex = colorString.trimmingCharacters(in: .whitespacesAndNewlines)
108
117
  guard hex.hasPrefix("#") else { return nil }
@@ -110,23 +119,26 @@ class BlurVibeView: UIView {
110
119
  var rgbValue: UInt64 = 0
111
120
  Scanner(string: hex).scanHexInt64(&rgbValue)
112
121
  switch hex.count {
113
- case 3:
122
+ case 3: // #RGB
114
123
  return UIColor(
115
- red: CGFloat((rgbValue & 0xF00) >> 8) / 15,
124
+ red: CGFloat((rgbValue & 0xF00) >> 8) / 15,
116
125
  green: CGFloat((rgbValue & 0x0F0) >> 4) / 15,
117
- blue: CGFloat(rgbValue & 0x00F) / 15, alpha: 1)
118
- case 6:
126
+ blue: CGFloat( rgbValue & 0x00F ) / 15,
127
+ alpha: 1)
128
+ case 6: // #RRGGBB
119
129
  return UIColor(
120
- red: CGFloat((rgbValue & 0xFF0000) >> 16) / 255,
121
- green: CGFloat((rgbValue & 0x00FF00) >> 8) / 255,
122
- blue: CGFloat(rgbValue & 0x0000FF) / 255, alpha: 1)
130
+ red: CGFloat((rgbValue & 0xFF0000) >> 16) / 255,
131
+ green: CGFloat((rgbValue & 0x00FF00) >> 8) / 255,
132
+ blue: CGFloat( rgbValue & 0x0000FF ) / 255,
133
+ alpha: 1)
123
134
  case 8: // #RRGGBBAA
124
135
  return UIColor(
125
- red: CGFloat((rgbValue & 0xFF000000) >> 24) / 255,
136
+ red: CGFloat((rgbValue & 0xFF000000) >> 24) / 255,
126
137
  green: CGFloat((rgbValue & 0x00FF0000) >> 16) / 255,
127
- blue: CGFloat((rgbValue & 0x0000FF00) >> 8) / 255,
128
- alpha: CGFloat(rgbValue & 0x000000FF) / 255)
129
- default: return nil
138
+ blue: CGFloat((rgbValue & 0x0000FF00) >> 8) / 255,
139
+ alpha: CGFloat( rgbValue & 0x000000FF ) / 255)
140
+ default:
141
+ return nil
130
142
  }
131
143
  }
132
144
  }
@@ -3,7 +3,17 @@
3
3
 
4
4
  RCT_EXTERN_MODULE(BlurVibeViewManager, RCTViewManager)
5
5
 
6
+ // Float → NSNumber matches TS Float
6
7
  RCT_EXPORT_VIEW_PROPERTY(blurAmount, NSNumber)
8
+
9
+ // String → NSString matches TS string
7
10
  RCT_EXPORT_VIEW_PROPERTY(blurType, NSString)
11
+
12
+ // String → NSString matches TS string
8
13
  RCT_EXPORT_VIEW_PROPERTY(overlayColor, NSString)
9
- RCT_EXPORT_VIEW_PROPERTY(reducedTransparencyFallbackColor, NSString)
14
+
15
+ // String → NSString matches TS string
16
+ RCT_EXPORT_VIEW_PROPERTY(reducedTransparencyFallbackColor, NSString)
17
+
18
+ // Int32 → NSNumber matches TS Int32 (no-op in Swift)
19
+ RCT_EXPORT_VIEW_PROPERTY(blurRadius, NSNumber)
@@ -1,5 +1,11 @@
1
1
  import Foundation
2
2
 
3
+ /**
4
+ * BlurVibeViewManager
5
+ *
6
+ * RCTViewManager subclass — registers BlurVibeView with React Native.
7
+ * requiresMainQueueSetup = true because we create UIKit views.
8
+ */
3
9
  @objc(BlurVibeViewManager)
4
10
  class BlurVibeViewManager: RCTViewManager {
5
11
 
@@ -10,8 +16,4 @@ class BlurVibeViewManager: RCTViewManager {
10
16
  override static func requiresMainQueueSetup() -> Bool {
11
17
  return true
12
18
  }
13
-
14
- @objc override func constantsToExport() -> [AnyHashable: Any]! {
15
- return [:]
16
- }
17
19
  }
@@ -1,14 +1,37 @@
1
- // @ts-ignore - codegenNativeComponent is available at runtime in RN 0.71+
1
+ // @ts-ignore - internal RN path, exists at runtime
2
2
  import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
3
3
  import type { HostComponent, ViewProps } from 'react-native';
4
- // @ts-ignore - CodegenTypes available at runtime
4
+ // @ts-ignore - internal RN path, exists at runtime
5
5
  import type { Float, Int32 } from 'react-native/Libraries/Types/CodegenTypes';
6
6
 
7
+ /**
8
+ * NativeComponent codegen spec for BlurVibeView.
9
+ *
10
+ * Type mapping (JS → Native):
11
+ * Float → NSNumber (iOS) / Float (Android)
12
+ * string → NSString (iOS) / String (Android)
13
+ * Int32 → NSNumber (iOS) / Int (Android)
14
+ *
15
+ * Color props (overlayColor, reducedTransparencyFallbackColor) use
16
+ * plain `string` — NOT the RN `ColorValue` type — because we parse
17
+ * hex manually on both platforms for full alpha channel control.
18
+ * Using ColorValue would trigger RN's color normalization which
19
+ * reorders alpha bytes and breaks #RRGGBBAA format.
20
+ */
7
21
  export interface NativeBlurVibeViewProps extends ViewProps {
22
+ // 0–100 blur intensity
8
23
  blurAmount?: Float;
24
+
25
+ // iOS UIBlurEffectStyle name — no-op on Android
9
26
  blurType?: string;
27
+
28
+ // Hex color string with alpha — "transparent", "#RGB", "#RRGGBB", "#RRGGBBAA"
10
29
  overlayColor?: string;
30
+
31
+ // Fallback when blur unavailable (Reduce Transparency / old API)
11
32
  reducedTransparencyFallbackColor?: string;
33
+
34
+ // Android downscale factor 1–8 — no-op on iOS
12
35
  blurRadius?: Int32;
13
36
  }
14
37
 
@@ -1,14 +1,37 @@
1
- // @ts-ignore - codegenNativeComponent is available at runtime in RN 0.71+
1
+ // @ts-ignore - internal RN path, exists at runtime
2
2
  import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
3
3
  import type { HostComponent, ViewProps } from 'react-native';
4
- // @ts-ignore - CodegenTypes available at runtime
4
+ // @ts-ignore - internal RN path, exists at runtime
5
5
  import type { Float, Int32 } from 'react-native/Libraries/Types/CodegenTypes';
6
6
 
7
+ /**
8
+ * NativeComponent codegen spec for BlurVibeView.
9
+ *
10
+ * Type mapping (JS → Native):
11
+ * Float → NSNumber (iOS) / Float (Android)
12
+ * string → NSString (iOS) / String (Android)
13
+ * Int32 → NSNumber (iOS) / Int (Android)
14
+ *
15
+ * Color props (overlayColor, reducedTransparencyFallbackColor) use
16
+ * plain `string` — NOT the RN `ColorValue` type — because we parse
17
+ * hex manually on both platforms for full alpha channel control.
18
+ * Using ColorValue would trigger RN's color normalization which
19
+ * reorders alpha bytes and breaks #RRGGBBAA format.
20
+ */
7
21
  export interface NativeBlurVibeViewProps extends ViewProps {
22
+ // 0–100 blur intensity
8
23
  blurAmount?: Float;
24
+
25
+ // iOS UIBlurEffectStyle name — no-op on Android
9
26
  blurType?: string;
27
+
28
+ // Hex color string with alpha — "transparent", "#RGB", "#RRGGBB", "#RRGGBBAA"
10
29
  overlayColor?: string;
30
+
31
+ // Fallback when blur unavailable (Reduce Transparency / old API)
11
32
  reducedTransparencyFallbackColor?: string;
33
+
34
+ // Android downscale factor 1–8 — no-op on iOS
12
35
  blurRadius?: Int32;
13
36
  }
14
37
 
@@ -1,5 +1,19 @@
1
1
  import type { HostComponent, ViewProps } from 'react-native';
2
2
  import type { Float, Int32 } from 'react-native/Libraries/Types/CodegenTypes';
3
+ /**
4
+ * NativeComponent codegen spec for BlurVibeView.
5
+ *
6
+ * Type mapping (JS → Native):
7
+ * Float → NSNumber (iOS) / Float (Android)
8
+ * string → NSString (iOS) / String (Android)
9
+ * Int32 → NSNumber (iOS) / Int (Android)
10
+ *
11
+ * Color props (overlayColor, reducedTransparencyFallbackColor) use
12
+ * plain `string` — NOT the RN `ColorValue` type — because we parse
13
+ * hex manually on both platforms for full alpha channel control.
14
+ * Using ColorValue would trigger RN's color normalization which
15
+ * reorders alpha bytes and breaks #RRGGBBAA format.
16
+ */
3
17
  export interface NativeBlurVibeViewProps extends ViewProps {
4
18
  blurAmount?: Float;
5
19
  blurType?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"BlurVibeViewNativeComponent.d.ts","sourceRoot":"","sources":["../../../../src/BlurVibeViewNativeComponent.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE7D,OAAO,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,2CAA2C,CAAC;AAE9E,MAAM,WAAW,uBAAwB,SAAQ,SAAS;IACxD,UAAU,CAAC,EAAE,KAAK,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,gCAAgC,CAAC,EAAE,MAAM,CAAC;IAC1C,UAAU,CAAC,EAAE,KAAK,CAAC;CACpB;wBAII,aAAa,CAAC,uBAAuB,CAAC;AAF3C,wBAE4C"}
1
+ {"version":3,"file":"BlurVibeViewNativeComponent.d.ts","sourceRoot":"","sources":["../../../../src/BlurVibeViewNativeComponent.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE7D,OAAO,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,2CAA2C,CAAC;AAE9E;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,uBAAwB,SAAQ,SAAS;IAExD,UAAU,CAAC,EAAE,KAAK,CAAC;IAGnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAGlB,YAAY,CAAC,EAAE,MAAM,CAAC;IAGtB,gCAAgC,CAAC,EAAE,MAAM,CAAC;IAG1C,UAAU,CAAC,EAAE,KAAK,CAAC;CACpB;wBAII,aAAa,CAAC,uBAAuB,CAAC;AAF3C,wBAE4C"}
@@ -1,5 +1,19 @@
1
1
  import type { HostComponent, ViewProps } from 'react-native';
2
2
  import type { Float, Int32 } from 'react-native/Libraries/Types/CodegenTypes';
3
+ /**
4
+ * NativeComponent codegen spec for BlurVibeView.
5
+ *
6
+ * Type mapping (JS → Native):
7
+ * Float → NSNumber (iOS) / Float (Android)
8
+ * string → NSString (iOS) / String (Android)
9
+ * Int32 → NSNumber (iOS) / Int (Android)
10
+ *
11
+ * Color props (overlayColor, reducedTransparencyFallbackColor) use
12
+ * plain `string` — NOT the RN `ColorValue` type — because we parse
13
+ * hex manually on both platforms for full alpha channel control.
14
+ * Using ColorValue would trigger RN's color normalization which
15
+ * reorders alpha bytes and breaks #RRGGBBAA format.
16
+ */
3
17
  export interface NativeBlurVibeViewProps extends ViewProps {
4
18
  blurAmount?: Float;
5
19
  blurType?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"BlurVibeViewNativeComponent.d.ts","sourceRoot":"","sources":["../../../../src/BlurVibeViewNativeComponent.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE7D,OAAO,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,2CAA2C,CAAC;AAE9E,MAAM,WAAW,uBAAwB,SAAQ,SAAS;IACxD,UAAU,CAAC,EAAE,KAAK,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,gCAAgC,CAAC,EAAE,MAAM,CAAC;IAC1C,UAAU,CAAC,EAAE,KAAK,CAAC;CACpB;wBAII,aAAa,CAAC,uBAAuB,CAAC;AAF3C,wBAE4C"}
1
+ {"version":3,"file":"BlurVibeViewNativeComponent.d.ts","sourceRoot":"","sources":["../../../../src/BlurVibeViewNativeComponent.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE7D,OAAO,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,2CAA2C,CAAC;AAE9E;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,uBAAwB,SAAQ,SAAS;IAExD,UAAU,CAAC,EAAE,KAAK,CAAC;IAGnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAGlB,YAAY,CAAC,EAAE,MAAM,CAAC;IAGtB,gCAAgC,CAAC,EAAE,MAAM,CAAC;IAG1C,UAAU,CAAC,EAAE,KAAK,CAAC;CACpB;wBAII,aAAa,CAAC,uBAAuB,CAAC;AAF3C,wBAE4C"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-blur-vibe",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "React Native package implementing Blur View in iOS and Android",
5
5
  "main": "./lib/commonjs/index.js",
6
6
  "module": "./lib/module/index.js",
@@ -1,14 +1,37 @@
1
- // @ts-ignore - codegenNativeComponent is available at runtime in RN 0.71+
1
+ // @ts-ignore - internal RN path, exists at runtime
2
2
  import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
3
3
  import type { HostComponent, ViewProps } from 'react-native';
4
- // @ts-ignore - CodegenTypes available at runtime
4
+ // @ts-ignore - internal RN path, exists at runtime
5
5
  import type { Float, Int32 } from 'react-native/Libraries/Types/CodegenTypes';
6
6
 
7
+ /**
8
+ * NativeComponent codegen spec for BlurVibeView.
9
+ *
10
+ * Type mapping (JS → Native):
11
+ * Float → NSNumber (iOS) / Float (Android)
12
+ * string → NSString (iOS) / String (Android)
13
+ * Int32 → NSNumber (iOS) / Int (Android)
14
+ *
15
+ * Color props (overlayColor, reducedTransparencyFallbackColor) use
16
+ * plain `string` — NOT the RN `ColorValue` type — because we parse
17
+ * hex manually on both platforms for full alpha channel control.
18
+ * Using ColorValue would trigger RN's color normalization which
19
+ * reorders alpha bytes and breaks #RRGGBBAA format.
20
+ */
7
21
  export interface NativeBlurVibeViewProps extends ViewProps {
22
+ // 0–100 blur intensity
8
23
  blurAmount?: Float;
24
+
25
+ // iOS UIBlurEffectStyle name — no-op on Android
9
26
  blurType?: string;
27
+
28
+ // Hex color string with alpha — "transparent", "#RGB", "#RRGGBB", "#RRGGBBAA"
10
29
  overlayColor?: string;
30
+
31
+ // Fallback when blur unavailable (Reduce Transparency / old API)
11
32
  reducedTransparencyFallbackColor?: string;
33
+
34
+ // Android downscale factor 1–8 — no-op on iOS
12
35
  blurRadius?: Int32;
13
36
  }
14
37