@sbaiahmed1/react-native-blur 4.2.1 → 4.3.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 +34 -25
- package/android/build.gradle +1 -1
- package/android/src/main/java/com/sbaiahmed1/reactnativeblur/ReactNativeBlurView.kt +38 -60
- package/android/src/main/java/com/sbaiahmed1/reactnativeblur/ReactNativeBlurViewManager.kt +5 -5
- package/android/src/main/java/com/sbaiahmed1/reactnativeblur/ReactNativeProgressiveBlurView.kt +16 -55
- package/android/src/main/java/com/sbaiahmed1/reactnativeblur/ReactNativeProgressiveBlurViewManager.kt +1 -1
- package/lib/module/BlurView.js +10 -4
- package/lib/module/BlurView.js.map +1 -1
- package/lib/module/LiquidGlassContainer.js +2 -0
- package/lib/module/LiquidGlassContainer.js.map +1 -1
- package/lib/module/LiquidGlassView.js +6 -0
- package/lib/module/LiquidGlassView.js.map +1 -1
- package/lib/module/ProgressiveBlurView.js +9 -4
- package/lib/module/ProgressiveBlurView.js.map +1 -1
- package/lib/typescript/src/BlurView.d.ts +7 -1
- package/lib/typescript/src/BlurView.d.ts.map +1 -1
- package/lib/typescript/src/LiquidGlassContainer.d.ts +3 -0
- package/lib/typescript/src/LiquidGlassContainer.d.ts.map +1 -1
- package/lib/typescript/src/LiquidGlassView.d.ts +9 -2
- package/lib/typescript/src/LiquidGlassView.d.ts.map +1 -1
- package/lib/typescript/src/ProgressiveBlurView.d.ts +7 -1
- package/lib/typescript/src/ProgressiveBlurView.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/BlurView.tsx +20 -3
- package/src/LiquidGlassContainer.tsx +3 -0
- package/src/LiquidGlassView.tsx +25 -3
- package/src/ProgressiveBlurView.tsx +16 -5
package/README.md
CHANGED
|
@@ -246,7 +246,7 @@ The library uses native Android blur with automatic platform detection. No addit
|
|
|
246
246
|
> 📦 **Dependency**: The library uses [QmBlurView](https://github.com/QmDeve/QmBlurView) from Maven Central:
|
|
247
247
|
>
|
|
248
248
|
> ```gradle
|
|
249
|
-
> implementation 'com.qmdeve:
|
|
249
|
+
> implementation 'com.qmdeve.blurview:core:1.0.5'
|
|
250
250
|
> ```
|
|
251
251
|
|
|
252
252
|
The implementation automatically handles different Android versions:
|
|
@@ -428,7 +428,10 @@ Use `LiquidGlassContainer` to create a glass container with configurable spacing
|
|
|
428
428
|
|
|
429
429
|
```tsx
|
|
430
430
|
import React from 'react';
|
|
431
|
-
import {
|
|
431
|
+
import {
|
|
432
|
+
LiquidGlassContainer,
|
|
433
|
+
LiquidGlassView,
|
|
434
|
+
} from '@sbaiahmed1/react-native-blur';
|
|
432
435
|
|
|
433
436
|
function GlassContainerExample() {
|
|
434
437
|
return (
|
|
@@ -459,7 +462,10 @@ function GlassContainerExample() {
|
|
|
459
462
|
```tsx
|
|
460
463
|
import React, { useRef } from 'react';
|
|
461
464
|
import { Animated } from 'react-native';
|
|
462
|
-
import {
|
|
465
|
+
import {
|
|
466
|
+
LiquidGlassContainer,
|
|
467
|
+
LiquidGlassView,
|
|
468
|
+
} from '@sbaiahmed1/react-native-blur';
|
|
463
469
|
|
|
464
470
|
function AnimatedGlassContainer() {
|
|
465
471
|
const translateX = useRef(new Animated.Value(0)).current;
|
|
@@ -508,28 +514,30 @@ The library now provides four separate components with their own props:
|
|
|
508
514
|
|
|
509
515
|
All props are optional and have sensible defaults.
|
|
510
516
|
|
|
511
|
-
| Prop | Type
|
|
512
|
-
| ---------------------------------- |
|
|
513
|
-
| `blurType` | `BlurType`
|
|
514
|
-
| `blurAmount` | `number`
|
|
515
|
-
| `ignoreSafeArea` | `boolean`
|
|
516
|
-
| `reducedTransparencyFallbackColor` | `string`
|
|
517
|
-
| `
|
|
518
|
-
| `
|
|
517
|
+
| Prop | Type | Default | Description |
|
|
518
|
+
| ---------------------------------- | ------------ | ----------- | ----------------------------------------------------------------------------- |
|
|
519
|
+
| `blurType` | `BlurType` | `'xlight'` | The type of blur effect to apply |
|
|
520
|
+
| `blurAmount` | `number` | `10.0` | The intensity of the blur effect (0-100) |
|
|
521
|
+
| `ignoreSafeArea` | `boolean` | `false` | (iOS only) Controls whether the blur effect should ignore all safe area edges |
|
|
522
|
+
| `reducedTransparencyFallbackColor` | `string` | `'#FFFFFF'` | Fallback color when reduced transparency is enabled |
|
|
523
|
+
| `overlayColor` | `ColorValue` | `undefined` | The overlay color to apply on top of the blur effect |
|
|
524
|
+
| `style` | `ViewStyle` | `undefined` | Style object for the blur view |
|
|
525
|
+
| `children` | `ReactNode` | `undefined` | Child components to render inside the blur view |
|
|
519
526
|
|
|
520
527
|
### ProgressiveBlurView Props
|
|
521
528
|
|
|
522
529
|
All props are optional and have sensible defaults.
|
|
523
530
|
|
|
524
|
-
| Prop | Type | Default | Description
|
|
525
|
-
| ---------------------------------- | ---------------------------------------------------- | ------------------------- |
|
|
526
|
-
| `blurType` | `BlurType` | `'regular'` | The type of blur effect to apply
|
|
527
|
-
| `blurAmount` | `number` | `20.0` | Maximum blur radius in pixels
|
|
528
|
-
| `direction` | `'blurredTopClearBottom' \| 'blurredBottomClearTop'` | `'blurredTopClearBottom'` | Direction of the blur gradient
|
|
529
|
-
| `startOffset` | `number` | `0.0` | Where the gradient starts (0.0 to 1.0)
|
|
530
|
-
| `reducedTransparencyFallbackColor` | `string` | `'#FFFFFF'` | Fallback color when reduced transparency is enabled
|
|
531
|
-
| `
|
|
532
|
-
| `
|
|
531
|
+
| Prop | Type | Default | Description |
|
|
532
|
+
| ---------------------------------- | ---------------------------------------------------- | ------------------------- | ---------------------------------------------------- |
|
|
533
|
+
| `blurType` | `BlurType` | `'regular'` | The type of blur effect to apply |
|
|
534
|
+
| `blurAmount` | `number` | `20.0` | Maximum blur radius in pixels |
|
|
535
|
+
| `direction` | `'blurredTopClearBottom' \| 'blurredBottomClearTop'` | `'blurredTopClearBottom'` | Direction of the blur gradient |
|
|
536
|
+
| `startOffset` | `number` | `0.0` | Where the gradient starts (0.0 to 1.0) |
|
|
537
|
+
| `reducedTransparencyFallbackColor` | `string` | `'#FFFFFF'` | Fallback color when reduced transparency is enabled |
|
|
538
|
+
| `overlayColor` | `ColorValue` | `undefined` | The overlay color to apply on top of the blur effect |
|
|
539
|
+
| `style` | `ViewStyle` | `undefined` | Style object for the blur view |
|
|
540
|
+
| `children` | `ReactNode` | `undefined` | Child components to render inside the blur view |
|
|
533
541
|
|
|
534
542
|
> **Platform Note**: `ProgressiveBlurView` works on both **iOS** and **Android**.
|
|
535
543
|
>
|
|
@@ -555,11 +563,11 @@ All props are optional and have sensible defaults.
|
|
|
555
563
|
|
|
556
564
|
All props are optional and have sensible defaults.
|
|
557
565
|
|
|
558
|
-
| Prop | Type | Default | Description
|
|
559
|
-
| ---------- | ----------- | ----------- |
|
|
560
|
-
| `spacing` | `number` | `0` | (iOS 26+ only) The spacing value between glass elements in the container
|
|
561
|
-
| `style` | `ViewStyle` | `undefined` | Style object for the glass container
|
|
562
|
-
| `children` | `ReactNode` | `undefined` | Child components to render inside the glass container (typically `LiquidGlassView` components)
|
|
566
|
+
| Prop | Type | Default | Description |
|
|
567
|
+
| ---------- | ----------- | ----------- | ---------------------------------------------------------------------------------------------- |
|
|
568
|
+
| `spacing` | `number` | `0` | (iOS 26+ only) The spacing value between glass elements in the container |
|
|
569
|
+
| `style` | `ViewStyle` | `undefined` | Style object for the glass container |
|
|
570
|
+
| `children` | `ReactNode` | `undefined` | Child components to render inside the glass container (typically `LiquidGlassView` components) |
|
|
563
571
|
|
|
564
572
|
> **Note**: The `BlurType` and `GlassType` are exported types from the library. See [Blur Types](#blur-types) and [Glass Types](#glass-types) sections below for all available values.
|
|
565
573
|
|
|
@@ -695,6 +703,7 @@ const blurProps: BlurViewProps = {
|
|
|
695
703
|
blurType: 'systemMaterial',
|
|
696
704
|
blurAmount: 50,
|
|
697
705
|
reducedTransparencyFallbackColor: '#FFFFFF',
|
|
706
|
+
overlayColor: '#FF000040',
|
|
698
707
|
};
|
|
699
708
|
|
|
700
709
|
// Example with LiquidGlassView properties
|
package/android/build.gradle
CHANGED
|
@@ -74,7 +74,7 @@ def kotlin_version = getExtOrDefault("kotlinVersion")
|
|
|
74
74
|
dependencies {
|
|
75
75
|
implementation "com.facebook.react:react-android"
|
|
76
76
|
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
77
|
-
implementation 'com.qmdeve:
|
|
77
|
+
implementation 'com.qmdeve.blurview:core:1.0.6'
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
react {
|
|
@@ -2,10 +2,15 @@ package com.sbaiahmed1.reactnativeblur
|
|
|
2
2
|
|
|
3
3
|
import android.content.Context
|
|
4
4
|
import android.graphics.Color
|
|
5
|
+
import android.graphics.Outline
|
|
6
|
+
import android.os.Build
|
|
5
7
|
import android.util.AttributeSet
|
|
6
8
|
import android.util.Log
|
|
7
9
|
import android.util.TypedValue
|
|
10
|
+
import android.view.View
|
|
8
11
|
import android.view.ViewGroup
|
|
12
|
+
import android.view.ViewOutlineProvider
|
|
13
|
+
import androidx.annotation.RequiresApi
|
|
9
14
|
import com.qmdeve.blurview.widget.BlurViewGroup
|
|
10
15
|
import androidx.core.graphics.toColorInt
|
|
11
16
|
|
|
@@ -22,8 +27,6 @@ class ReactNativeBlurView : BlurViewGroup {
|
|
|
22
27
|
private var currentBlurRadius = DEFAULT_BLUR_RADIUS
|
|
23
28
|
private var currentOverlayColor = Color.TRANSPARENT
|
|
24
29
|
private var currentCornerRadius = 0f
|
|
25
|
-
private var originalBackgroundColor: Int? = null
|
|
26
|
-
private var hasExplicitBackground: Boolean = false
|
|
27
30
|
private var glassTintColor: Int = Color.TRANSPARENT
|
|
28
31
|
private var glassOpacity: Float = 1.0f
|
|
29
32
|
private var viewType: String = "blur"
|
|
@@ -31,7 +34,7 @@ class ReactNativeBlurView : BlurViewGroup {
|
|
|
31
34
|
|
|
32
35
|
companion object {
|
|
33
36
|
private const val TAG = "ReactNativeBlurView"
|
|
34
|
-
private const val MAX_BLUR_RADIUS =
|
|
37
|
+
private const val MAX_BLUR_RADIUS = 100f
|
|
35
38
|
private const val DEFAULT_BLUR_RADIUS = 10f
|
|
36
39
|
private const val DEBUG = false // Set to true for debug builds
|
|
37
40
|
|
|
@@ -83,11 +86,15 @@ class ReactNativeBlurView : BlurViewGroup {
|
|
|
83
86
|
// setBlurRadius takes Float, setOverlayColor takes Int, setCornerRadius takes Float (in dp)
|
|
84
87
|
super.setBlurRadius(currentBlurRadius)
|
|
85
88
|
super.setOverlayColor(currentOverlayColor)
|
|
86
|
-
super.setDownsampleFactor(
|
|
87
|
-
|
|
89
|
+
super.setDownsampleFactor(6.0F)
|
|
90
|
+
|
|
91
|
+
super.clipChildren = true
|
|
88
92
|
|
|
89
|
-
|
|
90
|
-
|
|
93
|
+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
|
94
|
+
super.setBackgroundColor(currentOverlayColor)
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
updateCornerRadius()
|
|
91
98
|
|
|
92
99
|
logDebug("QmBlurView initialized with blurRadius: $currentBlurRadius, overlayColor: $currentOverlayColor")
|
|
93
100
|
} catch (e: Exception) {
|
|
@@ -95,30 +102,6 @@ class ReactNativeBlurView : BlurViewGroup {
|
|
|
95
102
|
}
|
|
96
103
|
}
|
|
97
104
|
|
|
98
|
-
/**
|
|
99
|
-
* Override setBackgroundColor to handle background preservation.
|
|
100
|
-
* @param color The background color to apply
|
|
101
|
-
*/
|
|
102
|
-
override fun setBackgroundColor(color: Int) {
|
|
103
|
-
logDebug("setBackgroundColor called: $color")
|
|
104
|
-
|
|
105
|
-
// Store the original background color if it's not transparent
|
|
106
|
-
if (color != Color.TRANSPARENT) {
|
|
107
|
-
originalBackgroundColor = color
|
|
108
|
-
hasExplicitBackground = true
|
|
109
|
-
logDebug("Stored explicit background color: $color")
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
// Apply background color over blur if explicitly set
|
|
113
|
-
if (hasExplicitBackground && color != Color.TRANSPARENT) {
|
|
114
|
-
logDebug("Applying background color over blur: $color")
|
|
115
|
-
super.setBackgroundColor(color)
|
|
116
|
-
} else {
|
|
117
|
-
logDebug("Keeping transparent background for blur effect")
|
|
118
|
-
super.setBackgroundColor(Color.TRANSPARENT)
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
|
|
122
105
|
/**
|
|
123
106
|
* Called when the view is detached from a window.
|
|
124
107
|
* Performs cleanup to prevent memory leaks.
|
|
@@ -133,8 +116,6 @@ class ReactNativeBlurView : BlurViewGroup {
|
|
|
133
116
|
* Helps prevent memory leaks and ensures clean state.
|
|
134
117
|
*/
|
|
135
118
|
fun cleanup() {
|
|
136
|
-
hasExplicitBackground = false
|
|
137
|
-
originalBackgroundColor = null
|
|
138
119
|
removeCallbacks(null)
|
|
139
120
|
logDebug("View cleaned up")
|
|
140
121
|
}
|
|
@@ -167,31 +148,12 @@ class ReactNativeBlurView : BlurViewGroup {
|
|
|
167
148
|
try {
|
|
168
149
|
// QmBlurView uses setOverlayColor() to set the tint/overlay color
|
|
169
150
|
super.setOverlayColor(currentOverlayColor)
|
|
170
|
-
} catch (e: Exception) {
|
|
171
|
-
logError("Failed to set overlay color: ${e.message}", e)
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
151
|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
* @param color The color string in hex format (e.g., "#FF0000") or null to clear
|
|
178
|
-
*/
|
|
179
|
-
fun setReducedTransparencyFallbackColor(color: String?) {
|
|
180
|
-
color?.let {
|
|
181
|
-
try {
|
|
182
|
-
val fallbackColor = it.toColorInt()
|
|
183
|
-
logDebug("setReducedTransparencyFallbackColor: $color -> $fallbackColor (stored but not applied unless accessibility requires it)")
|
|
184
|
-
|
|
185
|
-
// Store the fallback color but don't apply it unless accessibility settings require it
|
|
186
|
-
// For now, we'll just log it since Android doesn't have a direct equivalent to iOS's
|
|
187
|
-
// "Reduce Transparency" setting that we can easily check
|
|
188
|
-
// The blur effect should remain the primary visual
|
|
189
|
-
|
|
190
|
-
} catch (e: Exception) {
|
|
191
|
-
logWarning("Invalid color format for reduced transparency fallback: $color")
|
|
152
|
+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
|
153
|
+
super.setBackgroundColor(currentOverlayColor)
|
|
192
154
|
}
|
|
193
|
-
}
|
|
194
|
-
|
|
155
|
+
} catch (e: Exception) {
|
|
156
|
+
logError("Failed to set overlay color: ${e.message}", e)
|
|
195
157
|
}
|
|
196
158
|
}
|
|
197
159
|
|
|
@@ -288,6 +250,10 @@ class ReactNativeBlurView : BlurViewGroup {
|
|
|
288
250
|
// Restore original blur overlay color
|
|
289
251
|
try {
|
|
290
252
|
super.setOverlayColor(currentOverlayColor)
|
|
253
|
+
|
|
254
|
+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
|
255
|
+
super.setBackgroundColor(currentOverlayColor)
|
|
256
|
+
}
|
|
291
257
|
} catch (e: Exception) {
|
|
292
258
|
logError("Failed to restore blur overlay: ${e.message}", e)
|
|
293
259
|
}
|
|
@@ -319,6 +285,18 @@ class ReactNativeBlurView : BlurViewGroup {
|
|
|
319
285
|
currentCornerRadius,
|
|
320
286
|
context.resources.displayMetrics
|
|
321
287
|
)
|
|
288
|
+
|
|
289
|
+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
|
290
|
+
super.rootView.outlineProvider = object : ViewOutlineProvider() {
|
|
291
|
+
@RequiresApi(Build.VERSION_CODES.LOLLIPOP)
|
|
292
|
+
override fun getOutline(view: View, outline: Outline?) {
|
|
293
|
+
outline?.setRoundRect(0, 0, view.width, view.height, radiusInPixels)
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
super.clipToOutline = true
|
|
298
|
+
}
|
|
299
|
+
|
|
322
300
|
super.setCornerRadius(radiusInPixels)
|
|
323
301
|
logDebug("Updated corner radius: ${currentCornerRadius}dp -> ${radiusInPixels}px")
|
|
324
302
|
} catch (e: Exception) {
|
|
@@ -326,12 +304,12 @@ class ReactNativeBlurView : BlurViewGroup {
|
|
|
326
304
|
}
|
|
327
305
|
}
|
|
328
306
|
|
|
329
|
-
override fun generateDefaultLayoutParams():
|
|
330
|
-
return
|
|
307
|
+
override fun generateDefaultLayoutParams(): BlurViewGroup.LayoutParams {
|
|
308
|
+
return BlurViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)
|
|
331
309
|
}
|
|
332
310
|
|
|
333
|
-
override fun generateLayoutParams(attrs: AttributeSet?):
|
|
334
|
-
return
|
|
311
|
+
override fun generateLayoutParams(attrs: AttributeSet?): BlurViewGroup.LayoutParams {
|
|
312
|
+
return BlurViewGroup.LayoutParams(context, attrs)
|
|
335
313
|
}
|
|
336
314
|
|
|
337
315
|
override fun generateLayoutParams(p: ViewGroup.LayoutParams?): ViewGroup.LayoutParams {
|
|
@@ -39,16 +39,16 @@ class ReactNativeBlurViewManager : ViewGroupManager<ReactNativeBlurView>(),
|
|
|
39
39
|
view?.setBlurAmount(blurAmount.toFloat())
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
@ReactProp(name = "reducedTransparencyFallbackColor")
|
|
43
|
-
override fun setReducedTransparencyFallbackColor(view: ReactNativeBlurView?, reducedTransparencyFallbackColor: String?) {
|
|
44
|
-
view?.setReducedTransparencyFallbackColor(reducedTransparencyFallbackColor)
|
|
45
|
-
}
|
|
46
|
-
|
|
47
42
|
@ReactProp(name = "borderRadius")
|
|
48
43
|
override fun setBorderRadius(view: ReactNativeBlurView?, borderRadius: Float) {
|
|
49
44
|
view?.setBorderRadius(borderRadius)
|
|
50
45
|
}
|
|
51
46
|
|
|
47
|
+
@ReactProp(name = "reducedTransparencyFallbackColor")
|
|
48
|
+
override fun setReducedTransparencyFallbackColor(view: ReactNativeBlurView?, reducedTransparencyFallbackColor: String?) {
|
|
49
|
+
// no-op
|
|
50
|
+
}
|
|
51
|
+
|
|
52
52
|
@ReactProp(name = "ignoreSafeArea")
|
|
53
53
|
override fun setIgnoreSafeArea(view: ReactNativeBlurView?, ignoreSafeArea: Boolean) {
|
|
54
54
|
// no-op
|
package/android/src/main/java/com/sbaiahmed1/reactnativeblur/ReactNativeProgressiveBlurView.kt
CHANGED
|
@@ -19,14 +19,14 @@ import androidx.core.graphics.toColorInt
|
|
|
19
19
|
* Android implementation of React Native ProgressiveBlurView component.
|
|
20
20
|
* Uses a combination of normal blur (BlurView) + linear gradient mask to create
|
|
21
21
|
* a progressive blur effect that transitions from blurred to clear.
|
|
22
|
-
*
|
|
22
|
+
*
|
|
23
23
|
* This approach is more reliable than using the library's ProgressiveBlurView,
|
|
24
24
|
* which has limited control over gradient direction and appearance.
|
|
25
25
|
*/
|
|
26
26
|
class ReactNativeProgressiveBlurView : FrameLayout {
|
|
27
27
|
private var blurView: BlurView? = null
|
|
28
28
|
private val gradientPaint = Paint(Paint.ANTI_ALIAS_FLAG)
|
|
29
|
-
|
|
29
|
+
|
|
30
30
|
private var currentBlurRadius = DEFAULT_BLUR_RADIUS
|
|
31
31
|
private var currentOverlayColor = Color.TRANSPARENT
|
|
32
32
|
private var currentDirection = "topToBottom"
|
|
@@ -35,7 +35,7 @@ class ReactNativeProgressiveBlurView : FrameLayout {
|
|
|
35
35
|
|
|
36
36
|
companion object {
|
|
37
37
|
private const val TAG = "ReactNativeProgressiveBlur"
|
|
38
|
-
private const val MAX_BLUR_RADIUS =
|
|
38
|
+
private const val MAX_BLUR_RADIUS = 100f
|
|
39
39
|
private const val DEFAULT_BLUR_RADIUS = 10f
|
|
40
40
|
private const val DEBUG = true
|
|
41
41
|
|
|
@@ -87,15 +87,17 @@ class ReactNativeProgressiveBlurView : FrameLayout {
|
|
|
87
87
|
blurView = BlurView(context, null).apply {
|
|
88
88
|
layoutParams = LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)
|
|
89
89
|
setBlurRadius(currentBlurRadius)
|
|
90
|
-
|
|
91
|
-
|
|
90
|
+
setDownsampleFactor(6.0F)
|
|
91
|
+
blurRounds = 3
|
|
92
|
+
overlayColor = currentOverlayColor
|
|
93
|
+
setBackgroundColor(currentOverlayColor)
|
|
92
94
|
}
|
|
93
95
|
addView(blurView)
|
|
94
96
|
|
|
95
97
|
// Set up the gradient paint
|
|
96
98
|
gradientPaint.style = Paint.Style.FILL
|
|
97
99
|
setWillNotDraw(false) // Enable onDraw for gradient overlay
|
|
98
|
-
|
|
100
|
+
|
|
99
101
|
// Set transparent background for the container
|
|
100
102
|
super.setBackgroundColor(Color.TRANSPARENT)
|
|
101
103
|
|
|
@@ -176,12 +178,12 @@ class ReactNativeProgressiveBlurView : FrameLayout {
|
|
|
176
178
|
floatArrayOf(0f, 1f),
|
|
177
179
|
Shader.TileMode.CLAMP
|
|
178
180
|
)
|
|
179
|
-
|
|
181
|
+
|
|
180
182
|
gradientPaint.shader = gradient
|
|
181
|
-
|
|
183
|
+
|
|
182
184
|
logDebug("Updated gradient: direction=$currentDirection, start=($x0,$y0), end=($x1,$y1), offset=$currentStartOffset")
|
|
183
185
|
invalidate()
|
|
184
|
-
|
|
186
|
+
|
|
185
187
|
} catch (e: Exception) {
|
|
186
188
|
logError("Failed to update gradient: ${e.message}", e)
|
|
187
189
|
}
|
|
@@ -195,36 +197,16 @@ class ReactNativeProgressiveBlurView : FrameLayout {
|
|
|
195
197
|
|
|
196
198
|
// Use a layer to apply the gradient mask
|
|
197
199
|
val saveCount = canvas.saveLayer(0f, 0f, width.toFloat(), height.toFloat(), null)
|
|
198
|
-
|
|
200
|
+
|
|
199
201
|
// Draw the blur view
|
|
200
202
|
super.dispatchDraw(canvas)
|
|
201
|
-
|
|
203
|
+
|
|
202
204
|
// Apply gradient mask using DST_IN to make the blur gradually transparent
|
|
203
205
|
gradientPaint.xfermode = PorterDuffXfermode(PorterDuff.Mode.DST_IN)
|
|
204
206
|
canvas.drawRect(0f, 0f, width.toFloat(), height.toFloat(), gradientPaint)
|
|
205
207
|
gradientPaint.xfermode = null
|
|
206
|
-
|
|
207
|
-
canvas.restoreToCount(saveCount)
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
/**
|
|
211
|
-
* Override setBackgroundColor to handle background preservation.
|
|
212
|
-
*/
|
|
213
|
-
override fun setBackgroundColor(color: Int) {
|
|
214
|
-
logDebug("setBackgroundColor called: $color")
|
|
215
|
-
|
|
216
|
-
if (color != Color.TRANSPARENT) {
|
|
217
|
-
hasExplicitBackground = true
|
|
218
|
-
logDebug("Stored explicit background color: $color")
|
|
219
|
-
}
|
|
220
208
|
|
|
221
|
-
|
|
222
|
-
logDebug("Applying background color: $color")
|
|
223
|
-
super.setBackgroundColor(color)
|
|
224
|
-
} else {
|
|
225
|
-
logDebug("Keeping transparent background for blur effect")
|
|
226
|
-
super.setBackgroundColor(Color.TRANSPARENT)
|
|
227
|
-
}
|
|
209
|
+
canvas.restoreToCount(saveCount)
|
|
228
210
|
}
|
|
229
211
|
|
|
230
212
|
/**
|
|
@@ -288,13 +270,13 @@ class ReactNativeProgressiveBlurView : FrameLayout {
|
|
|
288
270
|
/**
|
|
289
271
|
* Set the start offset for the progressive blur.
|
|
290
272
|
* Controls where the gradient transition begins.
|
|
291
|
-
*
|
|
273
|
+
*
|
|
292
274
|
* @param offset The offset value (0.0 to 1.0) - where 0 starts immediately, 1 delays to the end
|
|
293
275
|
*/
|
|
294
276
|
fun setStartOffset(offset: Float) {
|
|
295
277
|
currentStartOffset = offset.coerceIn(0.0f, 1.0f)
|
|
296
278
|
logDebug("setStartOffset: $offset -> clamped to $currentStartOffset")
|
|
297
|
-
|
|
279
|
+
|
|
298
280
|
try {
|
|
299
281
|
updateGradient()
|
|
300
282
|
} catch (e: Exception) {
|
|
@@ -318,25 +300,4 @@ class ReactNativeProgressiveBlurView : FrameLayout {
|
|
|
318
300
|
logError("Failed to set overlay color: ${e.message}", e)
|
|
319
301
|
}
|
|
320
302
|
}
|
|
321
|
-
|
|
322
|
-
/**
|
|
323
|
-
* Set the fallback color for reduced transparency accessibility mode.
|
|
324
|
-
* @param color The color string in hex format (e.g., "#FF0000") or null to clear
|
|
325
|
-
*/
|
|
326
|
-
fun setReducedTransparencyFallbackColor(color: String?) {
|
|
327
|
-
if (color.isNullOrBlank()) {
|
|
328
|
-
logDebug("Cleared reduced transparency fallback color")
|
|
329
|
-
return
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
try {
|
|
333
|
-
val fallbackColor = color.toColorInt()
|
|
334
|
-
logDebug("setReducedTransparencyFallbackColor: $color -> ${Integer.toHexString(fallbackColor)}")
|
|
335
|
-
// Android doesn't have a direct equivalent to iOS's "Reduce Transparency" setting
|
|
336
|
-
} catch (e: IllegalArgumentException) {
|
|
337
|
-
logWarning("Invalid color format for reduced transparency fallback: $color - ${e.message}")
|
|
338
|
-
} catch (e: Exception) {
|
|
339
|
-
logError("Error parsing reduced transparency fallback color: $color", e)
|
|
340
|
-
}
|
|
341
|
-
}
|
|
342
303
|
}
|
|
@@ -62,7 +62,7 @@ class ReactNativeProgressiveBlurViewManager : SimpleViewManager<ReactNativeProgr
|
|
|
62
62
|
view: ReactNativeProgressiveBlurView?,
|
|
63
63
|
reducedTransparencyFallbackColor: String?
|
|
64
64
|
) {
|
|
65
|
-
|
|
65
|
+
// no-op
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
/**
|
package/lib/module/BlurView.js
CHANGED
|
@@ -30,11 +30,15 @@ export const BlurView = ({
|
|
|
30
30
|
blurType = 'xlight',
|
|
31
31
|
blurAmount = 10,
|
|
32
32
|
reducedTransparencyFallbackColor = '#FFFFFF',
|
|
33
|
+
overlayColor,
|
|
33
34
|
style,
|
|
34
35
|
children,
|
|
35
36
|
ignoreSafeArea = false,
|
|
36
37
|
...props
|
|
37
38
|
}) => {
|
|
39
|
+
const overlay = {
|
|
40
|
+
backgroundColor: overlayColor
|
|
41
|
+
};
|
|
38
42
|
const commonProps = {
|
|
39
43
|
blurType,
|
|
40
44
|
blurAmount,
|
|
@@ -45,7 +49,7 @@ export const BlurView = ({
|
|
|
45
49
|
// If no children, render the blur view directly (for background use)
|
|
46
50
|
if (!Children.count(children)) {
|
|
47
51
|
return /*#__PURE__*/_jsx(ReactNativeBlurView, {
|
|
48
|
-
style: style,
|
|
52
|
+
style: [style, overlay],
|
|
49
53
|
...commonProps,
|
|
50
54
|
...props
|
|
51
55
|
});
|
|
@@ -53,17 +57,19 @@ export const BlurView = ({
|
|
|
53
57
|
|
|
54
58
|
// If children exist, use the style default for Android
|
|
55
59
|
if (Platform.OS === 'android') {
|
|
56
|
-
return /*#__PURE__*/
|
|
60
|
+
return /*#__PURE__*/_jsxs(ReactNativeBlurView, {
|
|
57
61
|
style: style,
|
|
58
62
|
...commonProps,
|
|
59
63
|
...props,
|
|
60
|
-
children:
|
|
64
|
+
children: [/*#__PURE__*/_jsx(View, {
|
|
65
|
+
style: [StyleSheet.absoluteFill, overlay]
|
|
66
|
+
}), children]
|
|
61
67
|
});
|
|
62
68
|
}
|
|
63
69
|
|
|
64
70
|
// If children exist, use the absolute positioning pattern for iOS and others
|
|
65
71
|
return /*#__PURE__*/_jsxs(View, {
|
|
66
|
-
style: [styles.container, style],
|
|
72
|
+
style: [styles.container, style, overlay],
|
|
67
73
|
children: [/*#__PURE__*/_jsx(ReactNativeBlurView, {
|
|
68
74
|
style: StyleSheet.absoluteFill,
|
|
69
75
|
...commonProps,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","Children","Platform","StyleSheet","View","ReactNativeBlurView","jsx","_jsx","jsxs","_jsxs","BlurView","blurType","blurAmount","reducedTransparencyFallbackColor","style","children","ignoreSafeArea","props","commonProps","count","OS","
|
|
1
|
+
{"version":3,"names":["React","Children","Platform","StyleSheet","View","ReactNativeBlurView","jsx","_jsx","jsxs","_jsxs","BlurView","blurType","blurAmount","reducedTransparencyFallbackColor","overlayColor","style","children","ignoreSafeArea","props","overlay","backgroundColor","commonProps","count","OS","absoluteFill","styles","container","create","position","overflow","zIndex"],"sourceRoot":"../../src","sources":["BlurView.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,QAAQ,QAAQ,OAAO;AACvC,SAASC,QAAQ,EAAEC,UAAU,EAAEC,IAAI,QAAQ,cAAc;AAEzD,OAAOC,mBAAmB,MAEnB,sCAAsC;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAuD9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,QAAiC,GAAGA,CAAC;EAChDC,QAAQ,GAAG,QAAQ;EACnBC,UAAU,GAAG,EAAE;EACfC,gCAAgC,GAAG,SAAS;EAC5CC,YAAY;EACZC,KAAK;EACLC,QAAQ;EACRC,cAAc,GAAG,KAAK;EACtB,GAAGC;AACL,CAAC,KAAK;EACJ,MAAMC,OAAO,GAAG;IAAEC,eAAe,EAAEN;EAAa,CAAC;EACjD,MAAMO,WAA0B,GAAG;IACjCV,QAAQ;IACRC,UAAU;IACVK,cAAc;IACdJ;EACF,CAAC;;EAED;EACA,IAAI,CAACZ,QAAQ,CAACqB,KAAK,CAACN,QAAQ,CAAC,EAAE;IAC7B,oBACET,IAAA,CAACF,mBAAmB;MAClBU,KAAK,EAAE,CAACA,KAAK,EAAEI,OAAO,CAAE;MAAA,GACpBE,WAAW;MAAA,GACXH;IAAK,CACV,CAAC;EAEN;;EAEA;EACA,IAAIhB,QAAQ,CAACqB,EAAE,KAAK,SAAS,EAAE;IAC7B,oBACEd,KAAA,CAACJ,mBAAmB;MAACU,KAAK,EAAEA,KAAM;MAAA,GAAKM,WAAW;MAAA,GAAMH,KAAK;MAAAF,QAAA,gBAC3DT,IAAA,CAACH,IAAI;QAACW,KAAK,EAAE,CAACZ,UAAU,CAACqB,YAAY,EAAEL,OAAO;MAAE,CAAE,CAAC,EAElDH,QAAQ;IAAA,CACU,CAAC;EAE1B;;EAEA;EACA,oBACEP,KAAA,CAACL,IAAI;IAACW,KAAK,EAAE,CAACU,MAAM,CAACC,SAAS,EAAEX,KAAK,EAAEI,OAAO,CAAE;IAAAH,QAAA,gBAE9CT,IAAA,CAACF,mBAAmB;MAClBU,KAAK,EAAEZ,UAAU,CAACqB,YAAa;MAAA,GAC3BH,WAAW;MAAA,GACXH;IAAK,CACV,CAAC,eAEFX,IAAA,CAACH,IAAI;MAACW,KAAK,EAAEU,MAAM,CAACT,QAAS;MAAAA,QAAA,EAAEA;IAAQ,CAAO,CAAC;EAAA,CAC3C,CAAC;AAEX,CAAC;AAED,eAAeN,QAAQ;AAEvB,MAAMe,MAAM,GAAGtB,UAAU,CAACwB,MAAM,CAAC;EAC/BD,SAAS,EAAE;IACTE,QAAQ,EAAE,UAAU;IACpBC,QAAQ,EAAE;EACZ,CAAC;EACDb,QAAQ,EAAE;IACRY,QAAQ,EAAE,UAAU;IACpBE,MAAM,EAAE;EACV;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","Platform","View","ReactNativeLiquidGlassContainer","jsx","_jsx","LiquidGlassContainer","spacing","style","children","rest","isCompatibleIOS","OS","parseInt","Version"],"sourceRoot":"../../src","sources":["LiquidGlassContainer.tsx"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,QAAQ,EAAEC,IAAI,QAAwB,cAAc;AAC7D,OAAOC,+BAA+B,MAAM,kDAAkD;AAAC,SAAAC,GAAA,IAAAC,IAAA;
|
|
1
|
+
{"version":3,"names":["React","Platform","View","ReactNativeLiquidGlassContainer","jsx","_jsx","LiquidGlassContainer","spacing","style","children","rest","isCompatibleIOS","OS","parseInt","Version"],"sourceRoot":"../../src","sources":["LiquidGlassContainer.tsx"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,QAAQ,EAAEC,IAAI,QAAwB,cAAc;AAC7D,OAAOC,+BAA+B,MAAM,kDAAkD;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAY/F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,oBAAyD,GAAGA,CAAC;EACxEC,OAAO,GAAG,CAAC;EACXC,KAAK;EACLC,QAAQ;EACR,GAAGC;AACL,CAAC,KAAK;EACJ,MAAMC,eAAe,GACnBV,QAAQ,CAACW,EAAE,KAAK,KAAK,IAAIC,QAAQ,CAACZ,QAAQ,CAACa,OAAO,EAAY,EAAE,CAAC,IAAI,EAAE;EAEzE,IAAI,CAACH,eAAe,EAAE;IACpB;IACA,oBACEN,IAAA,CAACH,IAAI;MAACM,KAAK,EAAEA,KAAM;MAAA,GAAKE,IAAI;MAAAD,QAAA,EACzBA;IAAQ,CACL,CAAC;EAEX;EAEA,oBACEJ,IAAA,CAACF,+BAA+B;IAACI,OAAO,EAAEA,OAAQ;IAACC,KAAK,EAAEA,KAAM;IAAA,GAAKE,IAAI;IAAAD,QAAA,EACtEA;EAAQ,CACsB,CAAC;AAEtC,CAAC","ignoreList":[]}
|
|
@@ -53,8 +53,14 @@ export const LiquidGlassView = ({
|
|
|
53
53
|
// Only render on iOS 26+ (fallback otherwise)
|
|
54
54
|
if (!isIos || isIos && Number.parseInt(String(Platform.Version), 10) < 26) {
|
|
55
55
|
console.warn('LiquidGlassView is only supported on iOS. Rendering children without glass effect.');
|
|
56
|
+
|
|
57
|
+
// Compute overlay color with opacity for Android native handling
|
|
58
|
+
const overlayColorWithAlpha = glassTintColor + Math.floor(glassOpacity * 255).toString(16).padStart(2, '0');
|
|
56
59
|
return /*#__PURE__*/_jsx(BlurView, {
|
|
57
60
|
blurAmount: 70,
|
|
61
|
+
overlayColor: overlayColorWithAlpha,
|
|
62
|
+
reducedTransparencyFallbackColor: reducedTransparencyFallbackColor,
|
|
63
|
+
ignoreSafeArea: ignoreSafeArea,
|
|
58
64
|
style: style,
|
|
59
65
|
children: children
|
|
60
66
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","Platform","ReactNativeLiquidGlassView","BlurView","jsx","_jsx","LiquidGlassView","glassType","glassTintColor","glassOpacity","reducedTransparencyFallbackColor","isInteractive","ignoreSafeArea","style","children","props","isIos","OS","Number","parseInt","String","Version","console","warn","blurAmount"],"sourceRoot":"../../src","sources":["LiquidGlassView.tsx"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,QAAQ,QAAQ,cAAc;AAEvC,OAAOC,0BAA0B,MAE1B,6CAA6C;AACpD,OAAOC,QAAQ,MAAM,eAAY;AAAC,SAAAC,GAAA,IAAAC,IAAA;
|
|
1
|
+
{"version":3,"names":["React","Platform","ReactNativeLiquidGlassView","BlurView","jsx","_jsx","LiquidGlassView","glassType","glassTintColor","glassOpacity","reducedTransparencyFallbackColor","isInteractive","ignoreSafeArea","style","children","props","isIos","OS","Number","parseInt","String","Version","console","warn","overlayColorWithAlpha","Math","floor","toString","padStart","blurAmount","overlayColor"],"sourceRoot":"../../src","sources":["LiquidGlassView.tsx"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,QAAQ,QAAQ,cAAc;AAEvC,OAAOC,0BAA0B,MAE1B,6CAA6C;AACpD,OAAOC,QAAQ,MAAM,eAAY;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAgElC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,eAA+C,GAAGA,CAAC;EAC9DC,SAAS,GAAG,OAAO;EACnBC,cAAc,GAAG,OAAO;EACxBC,YAAY,GAAG,GAAG;EAClBC,gCAAgC,GAAG,SAAS;EAC5CC,aAAa,GAAG,IAAI;EACpBC,cAAc,GAAG,KAAK;EACtBC,KAAK;EACLC,QAAQ;EACR,GAAGC;AACL,CAAC,KAAK;EACJ,MAAMC,KAAK,GAAGf,QAAQ,CAACgB,EAAE,KAAK,KAAK;;EAEnC;EACA,IAAI,CAACD,KAAK,IAAKA,KAAK,IAAIE,MAAM,CAACC,QAAQ,CAACC,MAAM,CAACnB,QAAQ,CAACoB,OAAO,CAAC,EAAE,EAAE,CAAC,GAAG,EAAG,EAAE;IAC3EC,OAAO,CAACC,IAAI,CACV,oFACF,CAAC;;IAED;IACA,MAAMC,qBAAqB,GACzBhB,cAAc,GACdiB,IAAI,CAACC,KAAK,CAACjB,YAAY,GAAG,GAAG,CAAC,CAC3BkB,QAAQ,CAAC,EAAE,CAAC,CACZC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC;IAErB,oBACEvB,IAAA,CAACF,QAAQ;MACP0B,UAAU,EAAE,EAAG;MACfC,YAAY,EAAEN,qBAAsB;MACpCd,gCAAgC,EAAEA,gCAAiC;MACnEE,cAAc,EAAEA,cAAe;MAC/BC,KAAK,EAAEA,KAAM;MAAAC,QAAA,EAEZA;IAAQ,CACD,CAAC;EAEf;;EAEA;EACA,oBACET,IAAA,CAACH,0BAA0B;IACzBK,SAAS,EAAEA,SAAU;IACrBC,cAAc,EAAEA,cAAe;IAC/BC,YAAY,EAAEA,YAAa;IAC3BC,gCAAgC,EAAEA,gCAAiC;IACnEC,aAAa,EAAEA,aAAc;IAC7BC,cAAc,EAAEA,cAAe;IAC/BC,KAAK,EAAEA,KAAM;IAAA,GACTE,KAAK;IAAAD,QAAA,EAERA;EAAQ,CACiB,CAAC;AAEjC,CAAC;AAED,eAAeR,eAAe","ignoreList":[]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import React from 'react';
|
|
3
|
+
import React, { Children } from 'react';
|
|
4
4
|
import { StyleSheet, View } from 'react-native';
|
|
5
5
|
import ReactNativeProgressiveBlurView from './ReactNativeProgressiveBlurViewNativeComponent';
|
|
6
6
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -50,26 +50,31 @@ export const ProgressiveBlurView = ({
|
|
|
50
50
|
direction = 'blurredTopClearBottom',
|
|
51
51
|
startOffset = 0.0,
|
|
52
52
|
reducedTransparencyFallbackColor = '#FFFFFF',
|
|
53
|
+
overlayColor,
|
|
53
54
|
style,
|
|
54
55
|
children,
|
|
55
56
|
...props
|
|
56
57
|
}) => {
|
|
58
|
+
const overlay = {
|
|
59
|
+
backgroundColor: overlayColor
|
|
60
|
+
};
|
|
61
|
+
|
|
57
62
|
// If no children, render the blur view directly (for background use)
|
|
58
|
-
if (
|
|
63
|
+
if (!Children.count(children)) {
|
|
59
64
|
return /*#__PURE__*/_jsx(ReactNativeProgressiveBlurView, {
|
|
60
65
|
blurType: blurType,
|
|
61
66
|
blurAmount: blurAmount,
|
|
62
67
|
direction: direction,
|
|
63
68
|
startOffset: startOffset,
|
|
64
69
|
reducedTransparencyFallbackColor: reducedTransparencyFallbackColor,
|
|
65
|
-
style: style,
|
|
70
|
+
style: [style, overlay],
|
|
66
71
|
...props
|
|
67
72
|
});
|
|
68
73
|
}
|
|
69
74
|
|
|
70
75
|
// If children exist, use the absolute positioning pattern
|
|
71
76
|
return /*#__PURE__*/_jsxs(View, {
|
|
72
|
-
style: [styles.container, style],
|
|
77
|
+
style: [styles.container, style, overlay],
|
|
73
78
|
children: [/*#__PURE__*/_jsx(ReactNativeProgressiveBlurView, {
|
|
74
79
|
blurType: blurType,
|
|
75
80
|
blurAmount: blurAmount,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","StyleSheet","View","ReactNativeProgressiveBlurView","jsx","_jsx","jsxs","_jsxs","ProgressiveBlurView","blurType","blurAmount","direction","startOffset","reducedTransparencyFallbackColor","style","children","props","
|
|
1
|
+
{"version":3,"names":["React","Children","StyleSheet","View","ReactNativeProgressiveBlurView","jsx","_jsx","jsxs","_jsxs","ProgressiveBlurView","blurType","blurAmount","direction","startOffset","reducedTransparencyFallbackColor","overlayColor","style","children","props","overlay","backgroundColor","count","styles","container","absoluteFill","create","position","overflow","zIndex"],"sourceRoot":"../../src","sources":["ProgressiveBlurView.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,QAAQ,QAAQ,OAAO;AACvC,SAASC,UAAU,EAAEC,IAAI,QAAQ,cAAc;AAE/C,OAAOC,8BAA8B,MAG9B,iDAAiD;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAmEzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,mBAAuD,GAAGA,CAAC;EACtEC,QAAQ,GAAG,SAAS;EACpBC,UAAU,GAAG,EAAE;EACfC,SAAS,GAAG,uBAAuB;EACnCC,WAAW,GAAG,GAAG;EACjBC,gCAAgC,GAAG,SAAS;EAC5CC,YAAY;EACZC,KAAK;EACLC,QAAQ;EACR,GAAGC;AACL,CAAC,KAAK;EACJ,MAAMC,OAAO,GAAG;IAAEC,eAAe,EAAEL;EAAa,CAAC;;EAEjD;EACA,IAAI,CAACd,QAAQ,CAACoB,KAAK,CAACJ,QAAQ,CAAC,EAAE;IAC7B,oBACEX,IAAA,CAACF,8BAA8B;MAC7BM,QAAQ,EAAEA,QAAS;MACnBC,UAAU,EAAEA,UAAW;MACvBC,SAAS,EAAEA,SAAU;MACrBC,WAAW,EAAEA,WAAY;MACzBC,gCAAgC,EAAEA,gCAAiC;MACnEE,KAAK,EAAE,CAACA,KAAK,EAAEG,OAAO,CAAE;MAAA,GACpBD;IAAK,CACV,CAAC;EAEN;;EAEA;EACA,oBACEV,KAAA,CAACL,IAAI;IAACa,KAAK,EAAE,CAACM,MAAM,CAACC,SAAS,EAAEP,KAAK,EAAEG,OAAO,CAAE;IAAAF,QAAA,gBAE9CX,IAAA,CAACF,8BAA8B;MAC7BM,QAAQ,EAAEA,QAAS;MACnBC,UAAU,EAAEA,UAAW;MACvBC,SAAS,EAAEA,SAAU;MACrBC,WAAW,EAAEA,WAAY;MACzBC,gCAAgC,EAAEA,gCAAiC;MACnEE,KAAK,EAAEd,UAAU,CAACsB,YAAa;MAAA,GAC3BN;IAAK,CACV,CAAC,eAEFZ,IAAA,CAACH,IAAI;MAACa,KAAK,EAAEM,MAAM,CAACL,QAAS;MAAAA,QAAA,EAAEA;IAAQ,CAAO,CAAC;EAAA,CAC3C,CAAC;AAEX,CAAC;AAED,eAAeR,mBAAmB;AAElC,MAAMa,MAAM,GAAGpB,UAAU,CAACuB,MAAM,CAAC;EAC/BF,SAAS,EAAE;IACTG,QAAQ,EAAE,UAAU;IACpBC,QAAQ,EAAE;EACZ,CAAC;EACDV,QAAQ,EAAE;IACRS,QAAQ,EAAE,UAAU;IACpBE,MAAM,EAAE;EACV;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { ViewStyle, StyleProp } from 'react-native';
|
|
2
|
+
import type { ViewStyle, StyleProp, ColorValue } from 'react-native';
|
|
3
3
|
import { type BlurType } from './ReactNativeBlurViewNativeComponent';
|
|
4
4
|
export interface BlurViewProps {
|
|
5
5
|
/**
|
|
@@ -22,6 +22,12 @@ export interface BlurViewProps {
|
|
|
22
22
|
* @default '#FFFFFF'
|
|
23
23
|
*/
|
|
24
24
|
reducedTransparencyFallbackColor?: string;
|
|
25
|
+
/**
|
|
26
|
+
* @description The overlay color to apply on top of the blur effect
|
|
27
|
+
*
|
|
28
|
+
* @default undefined
|
|
29
|
+
*/
|
|
30
|
+
overlayColor?: ColorValue;
|
|
25
31
|
/**
|
|
26
32
|
* @description style object for the blur view
|
|
27
33
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BlurView.d.ts","sourceRoot":"","sources":["../../../src/BlurView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"BlurView.d.ts","sourceRoot":"","sources":["../../../src/BlurView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AACrE,OAA4B,EAC1B,KAAK,QAAQ,EACd,MAAM,sCAAsC,CAAC;AAE9C,MAAM,WAAW,aAAa;IAC5B;;;;OAIG;IACH,QAAQ,CAAC,EAAE,QAAQ,CAAC;IAEpB;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;;;;;OAMG;IACH,gCAAgC,CAAC,EAAE,MAAM,CAAC;IAE1C;;;;OAIG;IACH,YAAY,CAAC,EAAE,UAAU,CAAC;IAE1B;;;;OAIG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAE7B;;;;OAIG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IAEzB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,aAAa,CAqD5C,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
|
@@ -4,6 +4,7 @@ export interface LiquidGlassContainerProps extends ViewProps {
|
|
|
4
4
|
/**
|
|
5
5
|
* The spacing value for the glass container effect
|
|
6
6
|
* Platform: iOS only (iOS 26+)
|
|
7
|
+
*
|
|
7
8
|
* @default 0
|
|
8
9
|
*/
|
|
9
10
|
spacing?: number;
|
|
@@ -16,6 +17,8 @@ export interface LiquidGlassContainerProps extends ViewProps {
|
|
|
16
17
|
*
|
|
17
18
|
* Platform: iOS only (iOS 26+)
|
|
18
19
|
*
|
|
20
|
+
* @platform ios
|
|
21
|
+
*
|
|
19
22
|
* @example
|
|
20
23
|
* ```tsx
|
|
21
24
|
* <LiquidGlassContainer spacing={20} style={{ flex: 1 }}>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LiquidGlassContainer.d.ts","sourceRoot":"","sources":["../../../src/LiquidGlassContainer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAkB,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAG9D,MAAM,WAAW,yBAA0B,SAAQ,SAAS;IAC1D
|
|
1
|
+
{"version":3,"file":"LiquidGlassContainer.d.ts","sourceRoot":"","sources":["../../../src/LiquidGlassContainer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAkB,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAG9D,MAAM,WAAW,yBAA0B,SAAQ,SAAS;IAC1D;;;;;OAKG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,oBAAoB,EAAE,KAAK,CAAC,EAAE,CAAC,yBAAyB,CAuBpE,CAAC"}
|
|
@@ -5,18 +5,22 @@ export interface LiquidGlassViewProps {
|
|
|
5
5
|
/**
|
|
6
6
|
* The type of glass effect to apply
|
|
7
7
|
* Platform: iOS 26+ only
|
|
8
|
+
*
|
|
8
9
|
* @default 'clear'
|
|
9
10
|
*/
|
|
10
|
-
glassType?: GlassType
|
|
11
|
+
glassType?: GlassType;
|
|
12
|
+
/**
|
|
11
13
|
* The tint color of the glass effect
|
|
12
14
|
* Accepts hex color strings like '#FFFFFF' or color names
|
|
13
15
|
* Platform: iOS 26+ only
|
|
16
|
+
*
|
|
14
17
|
* @default 'clear'
|
|
15
|
-
|
|
18
|
+
*/
|
|
16
19
|
glassTintColor?: string;
|
|
17
20
|
/**
|
|
18
21
|
* The opacity of the glass effect (0-1)
|
|
19
22
|
* Platform: iOS 26+ only
|
|
23
|
+
*
|
|
20
24
|
* @default 1.0
|
|
21
25
|
*/
|
|
22
26
|
glassOpacity?: number;
|
|
@@ -24,18 +28,21 @@ export interface LiquidGlassViewProps {
|
|
|
24
28
|
* Fallback color when reduced transparency is enabled or on older iOS versions
|
|
25
29
|
* Accepts hex color strings like '#FFFFFF'
|
|
26
30
|
* Platform: iOS only
|
|
31
|
+
*
|
|
27
32
|
* @default '#FFFFFF'
|
|
28
33
|
*/
|
|
29
34
|
reducedTransparencyFallbackColor?: string;
|
|
30
35
|
/**
|
|
31
36
|
* Whether the glass view should be interactive
|
|
32
37
|
* Platform: iOS 26+ only
|
|
38
|
+
*
|
|
33
39
|
* @default true
|
|
34
40
|
*/
|
|
35
41
|
isInteractive?: boolean;
|
|
36
42
|
/**
|
|
37
43
|
* Whether the glass view should ignore safe area insets
|
|
38
44
|
* Platform: iOS 26+ only
|
|
45
|
+
*
|
|
39
46
|
* @default false
|
|
40
47
|
*/
|
|
41
48
|
ignoreSafeArea?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LiquidGlassView.d.ts","sourceRoot":"","sources":["../../../src/LiquidGlassView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzD,OAAmC,EACjC,KAAK,SAAS,EACf,MAAM,6CAA6C,CAAC;AAGrD,MAAM,WAAW,oBAAoB;IACnC
|
|
1
|
+
{"version":3,"file":"LiquidGlassView.d.ts","sourceRoot":"","sources":["../../../src/LiquidGlassView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzD,OAAmC,EACjC,KAAK,SAAS,EACf,MAAM,6CAA6C,CAAC;AAGrD,MAAM,WAAW,oBAAoB;IACnC;;;;;OAKG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC;IAEtB;;;;;;OAMG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;;;;OAKG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;;;;;OAMG;IACH,gCAAgC,CAAC,EAAE,MAAM,CAAC;IAE1C;;;;;OAKG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IAExB;;;;;OAKG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IAEzB;;OAEG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAE7B;;OAEG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CAsD1D,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { ViewStyle, StyleProp } from 'react-native';
|
|
2
|
+
import type { ViewStyle, StyleProp, ColorValue } from 'react-native';
|
|
3
3
|
import { type BlurType, type ProgressiveBlurDirection } from './ReactNativeProgressiveBlurViewNativeComponent';
|
|
4
4
|
export interface ProgressiveBlurViewProps {
|
|
5
5
|
/**
|
|
@@ -39,6 +39,12 @@ export interface ProgressiveBlurViewProps {
|
|
|
39
39
|
* @default '#FFFFFF'
|
|
40
40
|
*/
|
|
41
41
|
reducedTransparencyFallbackColor?: string;
|
|
42
|
+
/**
|
|
43
|
+
* @description The overlay color to apply on top of the blur effect
|
|
44
|
+
*
|
|
45
|
+
* @default undefined
|
|
46
|
+
*/
|
|
47
|
+
overlayColor?: ColorValue;
|
|
42
48
|
/**
|
|
43
49
|
* @description style object for the progressive blur view
|
|
44
50
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProgressiveBlurView.d.ts","sourceRoot":"","sources":["../../../src/ProgressiveBlurView.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"ProgressiveBlurView.d.ts","sourceRoot":"","sources":["../../../src/ProgressiveBlurView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AACrE,OAAuC,EACrC,KAAK,QAAQ,EACb,KAAK,wBAAwB,EAC9B,MAAM,iDAAiD,CAAC;AAEzD,MAAM,WAAW,wBAAwB;IACvC;;;;OAIG;IACH,QAAQ,CAAC,EAAE,QAAQ,CAAC;IAEpB;;;;;OAKG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;;;;;OAMG;IACH,SAAS,CAAC,EAAE,wBAAwB,CAAC;IAErC;;;;;;OAMG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;;;;OAMG;IACH,gCAAgC,CAAC,EAAE,MAAM,CAAC;IAE1C;;;;OAIG;IACH,YAAY,CAAC,EAAE,UAAU,CAAC;IAE1B;;;;OAIG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAE7B;;;;OAIG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,eAAO,MAAM,mBAAmB,EAAE,KAAK,CAAC,EAAE,CAAC,wBAAwB,CA6ClE,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sbaiahmed1/react-native-blur",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.3.0",
|
|
4
4
|
"description": "React native modern blur view",
|
|
5
5
|
"main": "./lib/module/index.js",
|
|
6
6
|
"types": "./lib/typescript/src/index.d.ts",
|
|
@@ -116,7 +116,7 @@
|
|
|
116
116
|
"tagName": "v${version}"
|
|
117
117
|
},
|
|
118
118
|
"npm": {
|
|
119
|
-
"publish":
|
|
119
|
+
"publish": false
|
|
120
120
|
},
|
|
121
121
|
"github": {
|
|
122
122
|
"release": true
|
package/src/BlurView.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { Children } from 'react';
|
|
2
2
|
import { Platform, StyleSheet, View } from 'react-native';
|
|
3
|
-
import type { ViewStyle, StyleProp } from 'react-native';
|
|
3
|
+
import type { ViewStyle, StyleProp, ColorValue } from 'react-native';
|
|
4
4
|
import ReactNativeBlurView, {
|
|
5
5
|
type BlurType,
|
|
6
6
|
} from './ReactNativeBlurViewNativeComponent';
|
|
@@ -29,6 +29,13 @@ export interface BlurViewProps {
|
|
|
29
29
|
*/
|
|
30
30
|
reducedTransparencyFallbackColor?: string;
|
|
31
31
|
|
|
32
|
+
/**
|
|
33
|
+
* @description The overlay color to apply on top of the blur effect
|
|
34
|
+
*
|
|
35
|
+
* @default undefined
|
|
36
|
+
*/
|
|
37
|
+
overlayColor?: ColorValue;
|
|
38
|
+
|
|
32
39
|
/**
|
|
33
40
|
* @description style object for the blur view
|
|
34
41
|
*
|
|
@@ -77,11 +84,13 @@ export const BlurView: React.FC<BlurViewProps> = ({
|
|
|
77
84
|
blurType = 'xlight',
|
|
78
85
|
blurAmount = 10,
|
|
79
86
|
reducedTransparencyFallbackColor = '#FFFFFF',
|
|
87
|
+
overlayColor,
|
|
80
88
|
style,
|
|
81
89
|
children,
|
|
82
90
|
ignoreSafeArea = false,
|
|
83
91
|
...props
|
|
84
92
|
}) => {
|
|
93
|
+
const overlay = { backgroundColor: overlayColor };
|
|
85
94
|
const commonProps: BlurViewProps = {
|
|
86
95
|
blurType,
|
|
87
96
|
blurAmount,
|
|
@@ -91,13 +100,21 @@ export const BlurView: React.FC<BlurViewProps> = ({
|
|
|
91
100
|
|
|
92
101
|
// If no children, render the blur view directly (for background use)
|
|
93
102
|
if (!Children.count(children)) {
|
|
94
|
-
return
|
|
103
|
+
return (
|
|
104
|
+
<ReactNativeBlurView
|
|
105
|
+
style={[style, overlay]}
|
|
106
|
+
{...commonProps}
|
|
107
|
+
{...props}
|
|
108
|
+
/>
|
|
109
|
+
);
|
|
95
110
|
}
|
|
96
111
|
|
|
97
112
|
// If children exist, use the style default for Android
|
|
98
113
|
if (Platform.OS === 'android') {
|
|
99
114
|
return (
|
|
100
115
|
<ReactNativeBlurView style={style} {...commonProps} {...props}>
|
|
116
|
+
<View style={[StyleSheet.absoluteFill, overlay]} />
|
|
117
|
+
|
|
101
118
|
{children}
|
|
102
119
|
</ReactNativeBlurView>
|
|
103
120
|
);
|
|
@@ -105,7 +122,7 @@ export const BlurView: React.FC<BlurViewProps> = ({
|
|
|
105
122
|
|
|
106
123
|
// If children exist, use the absolute positioning pattern for iOS and others
|
|
107
124
|
return (
|
|
108
|
-
<View style={[styles.container, style]}>
|
|
125
|
+
<View style={[styles.container, style, overlay]}>
|
|
109
126
|
{/* Blur effect positioned absolutely behind content */}
|
|
110
127
|
<ReactNativeBlurView
|
|
111
128
|
style={StyleSheet.absoluteFill}
|
|
@@ -6,6 +6,7 @@ export interface LiquidGlassContainerProps extends ViewProps {
|
|
|
6
6
|
/**
|
|
7
7
|
* The spacing value for the glass container effect
|
|
8
8
|
* Platform: iOS only (iOS 26+)
|
|
9
|
+
*
|
|
9
10
|
* @default 0
|
|
10
11
|
*/
|
|
11
12
|
spacing?: number;
|
|
@@ -19,6 +20,8 @@ export interface LiquidGlassContainerProps extends ViewProps {
|
|
|
19
20
|
*
|
|
20
21
|
* Platform: iOS only (iOS 26+)
|
|
21
22
|
*
|
|
23
|
+
* @platform ios
|
|
24
|
+
*
|
|
22
25
|
* @example
|
|
23
26
|
* ```tsx
|
|
24
27
|
* <LiquidGlassContainer spacing={20} style={{ flex: 1 }}>
|
package/src/LiquidGlassView.tsx
CHANGED
|
@@ -10,19 +10,24 @@ export interface LiquidGlassViewProps {
|
|
|
10
10
|
/**
|
|
11
11
|
* The type of glass effect to apply
|
|
12
12
|
* Platform: iOS 26+ only
|
|
13
|
+
*
|
|
13
14
|
* @default 'clear'
|
|
14
15
|
*/
|
|
15
|
-
glassType?: GlassType
|
|
16
|
+
glassType?: GlassType;
|
|
17
|
+
|
|
18
|
+
/**
|
|
16
19
|
* The tint color of the glass effect
|
|
17
20
|
* Accepts hex color strings like '#FFFFFF' or color names
|
|
18
21
|
* Platform: iOS 26+ only
|
|
22
|
+
*
|
|
19
23
|
* @default 'clear'
|
|
20
|
-
|
|
24
|
+
*/
|
|
21
25
|
glassTintColor?: string;
|
|
22
26
|
|
|
23
27
|
/**
|
|
24
28
|
* The opacity of the glass effect (0-1)
|
|
25
29
|
* Platform: iOS 26+ only
|
|
30
|
+
*
|
|
26
31
|
* @default 1.0
|
|
27
32
|
*/
|
|
28
33
|
glassOpacity?: number;
|
|
@@ -31,6 +36,7 @@ export interface LiquidGlassViewProps {
|
|
|
31
36
|
* Fallback color when reduced transparency is enabled or on older iOS versions
|
|
32
37
|
* Accepts hex color strings like '#FFFFFF'
|
|
33
38
|
* Platform: iOS only
|
|
39
|
+
*
|
|
34
40
|
* @default '#FFFFFF'
|
|
35
41
|
*/
|
|
36
42
|
reducedTransparencyFallbackColor?: string;
|
|
@@ -38,6 +44,7 @@ export interface LiquidGlassViewProps {
|
|
|
38
44
|
/**
|
|
39
45
|
* Whether the glass view should be interactive
|
|
40
46
|
* Platform: iOS 26+ only
|
|
47
|
+
*
|
|
41
48
|
* @default true
|
|
42
49
|
*/
|
|
43
50
|
isInteractive?: boolean;
|
|
@@ -45,6 +52,7 @@ export interface LiquidGlassViewProps {
|
|
|
45
52
|
/**
|
|
46
53
|
* Whether the glass view should ignore safe area insets
|
|
47
54
|
* Platform: iOS 26+ only
|
|
55
|
+
*
|
|
48
56
|
* @default false
|
|
49
57
|
*/
|
|
50
58
|
ignoreSafeArea?: boolean;
|
|
@@ -110,8 +118,22 @@ export const LiquidGlassView: React.FC<LiquidGlassViewProps> = ({
|
|
|
110
118
|
console.warn(
|
|
111
119
|
'LiquidGlassView is only supported on iOS. Rendering children without glass effect.'
|
|
112
120
|
);
|
|
121
|
+
|
|
122
|
+
// Compute overlay color with opacity for Android native handling
|
|
123
|
+
const overlayColorWithAlpha =
|
|
124
|
+
glassTintColor +
|
|
125
|
+
Math.floor(glassOpacity * 255)
|
|
126
|
+
.toString(16)
|
|
127
|
+
.padStart(2, '0');
|
|
128
|
+
|
|
113
129
|
return (
|
|
114
|
-
<BlurView
|
|
130
|
+
<BlurView
|
|
131
|
+
blurAmount={70}
|
|
132
|
+
overlayColor={overlayColorWithAlpha}
|
|
133
|
+
reducedTransparencyFallbackColor={reducedTransparencyFallbackColor}
|
|
134
|
+
ignoreSafeArea={ignoreSafeArea}
|
|
135
|
+
style={style}
|
|
136
|
+
>
|
|
115
137
|
{children}
|
|
116
138
|
</BlurView>
|
|
117
139
|
);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { Children } from 'react';
|
|
2
2
|
import { StyleSheet, View } from 'react-native';
|
|
3
|
-
import type { ViewStyle, StyleProp } from 'react-native';
|
|
3
|
+
import type { ViewStyle, StyleProp, ColorValue } from 'react-native';
|
|
4
4
|
import ReactNativeProgressiveBlurView, {
|
|
5
5
|
type BlurType,
|
|
6
6
|
type ProgressiveBlurDirection,
|
|
@@ -49,6 +49,13 @@ export interface ProgressiveBlurViewProps {
|
|
|
49
49
|
*/
|
|
50
50
|
reducedTransparencyFallbackColor?: string;
|
|
51
51
|
|
|
52
|
+
/**
|
|
53
|
+
* @description The overlay color to apply on top of the blur effect
|
|
54
|
+
*
|
|
55
|
+
* @default undefined
|
|
56
|
+
*/
|
|
57
|
+
overlayColor?: ColorValue;
|
|
58
|
+
|
|
52
59
|
/**
|
|
53
60
|
* @description style object for the progressive blur view
|
|
54
61
|
*
|
|
@@ -110,12 +117,15 @@ export const ProgressiveBlurView: React.FC<ProgressiveBlurViewProps> = ({
|
|
|
110
117
|
direction = 'blurredTopClearBottom',
|
|
111
118
|
startOffset = 0.0,
|
|
112
119
|
reducedTransparencyFallbackColor = '#FFFFFF',
|
|
120
|
+
overlayColor,
|
|
113
121
|
style,
|
|
114
122
|
children,
|
|
115
123
|
...props
|
|
116
124
|
}) => {
|
|
125
|
+
const overlay = { backgroundColor: overlayColor };
|
|
126
|
+
|
|
117
127
|
// If no children, render the blur view directly (for background use)
|
|
118
|
-
if (
|
|
128
|
+
if (!Children.count(children)) {
|
|
119
129
|
return (
|
|
120
130
|
<ReactNativeProgressiveBlurView
|
|
121
131
|
blurType={blurType}
|
|
@@ -123,7 +133,7 @@ export const ProgressiveBlurView: React.FC<ProgressiveBlurViewProps> = ({
|
|
|
123
133
|
direction={direction}
|
|
124
134
|
startOffset={startOffset}
|
|
125
135
|
reducedTransparencyFallbackColor={reducedTransparencyFallbackColor}
|
|
126
|
-
style={style}
|
|
136
|
+
style={[style, overlay]}
|
|
127
137
|
{...props}
|
|
128
138
|
/>
|
|
129
139
|
);
|
|
@@ -131,7 +141,7 @@ export const ProgressiveBlurView: React.FC<ProgressiveBlurViewProps> = ({
|
|
|
131
141
|
|
|
132
142
|
// If children exist, use the absolute positioning pattern
|
|
133
143
|
return (
|
|
134
|
-
<View style={[styles.container, style]}>
|
|
144
|
+
<View style={[styles.container, style, overlay]}>
|
|
135
145
|
{/* Blur effect positioned absolutely behind content */}
|
|
136
146
|
<ReactNativeProgressiveBlurView
|
|
137
147
|
blurType={blurType}
|
|
@@ -142,6 +152,7 @@ export const ProgressiveBlurView: React.FC<ProgressiveBlurViewProps> = ({
|
|
|
142
152
|
style={StyleSheet.absoluteFill}
|
|
143
153
|
{...props}
|
|
144
154
|
/>
|
|
155
|
+
|
|
145
156
|
<View style={styles.children}>{children}</View>
|
|
146
157
|
</View>
|
|
147
158
|
);
|