@sbaiahmed1/react-native-blur 4.5.0 → 4.5.1
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 +24 -1
- package/android/src/main/java/com/sbaiahmed1/reactnativeblur/ReactNativeProgressiveBlurView.kt +72 -33
- package/ios/Views/VariableBlurView.swift +139 -13
- package/lib/module/ProgressiveBlurView.js +1 -8
- package/lib/module/ProgressiveBlurView.js.map +1 -1
- package/lib/module/ReactNativeProgressiveBlurViewNativeComponent.ts +2 -1
- package/lib/typescript/src/ProgressiveBlurView.d.ts +1 -0
- package/lib/typescript/src/ProgressiveBlurView.d.ts.map +1 -1
- package/lib/typescript/src/ReactNativeProgressiveBlurViewNativeComponent.d.ts +1 -1
- package/lib/typescript/src/ReactNativeProgressiveBlurViewNativeComponent.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/ProgressiveBlurView.tsx +2 -5
- package/src/ReactNativeProgressiveBlurViewNativeComponent.ts +2 -1
package/README.md
CHANGED
|
@@ -347,6 +347,29 @@ function GradientBlurComponent() {
|
|
|
347
347
|
}
|
|
348
348
|
```
|
|
349
349
|
|
|
350
|
+
#### Center Blur (new direction)
|
|
351
|
+
|
|
352
|
+
`direction="blurredCenterClearTopAndBottom"` creates a long blur body that peaks in the center and fades to clear at both edges.
|
|
353
|
+
|
|
354
|
+
```tsx
|
|
355
|
+
<ProgressiveBlurView
|
|
356
|
+
blurType="regular"
|
|
357
|
+
blurAmount={35}
|
|
358
|
+
direction="blurredCenterClearTopAndBottom"
|
|
359
|
+
startOffset={0} // keep 0 for longest blur body; raise toward 0.3 to shorten
|
|
360
|
+
style={{ height: 220, borderRadius: 16 }}
|
|
361
|
+
>
|
|
362
|
+
<Text>Clear at top</Text>
|
|
363
|
+
<Text>Blurred at center</Text>
|
|
364
|
+
<Text>Clear at bottom</Text>
|
|
365
|
+
</ProgressiveBlurView>
|
|
366
|
+
```
|
|
367
|
+
|
|
368
|
+
Tips:
|
|
369
|
+
- `startOffset` shifts where the blur plateau begins; 0 = longest body, higher = shorter.
|
|
370
|
+
- `blurAmount` controls peak intensity; center direction balances strength per platform.
|
|
371
|
+
- Works on iOS and Android with matching props.
|
|
372
|
+
|
|
350
373
|
#### Locked Content Example
|
|
351
374
|
|
|
352
375
|
Perfect for paywall/premium content:
|
|
@@ -613,7 +636,7 @@ All props are optional and have sensible defaults.
|
|
|
613
636
|
| ---------------------------------- | ---------------------------------------------------- | ------------------------- | ---------------------------------------------------- |
|
|
614
637
|
| `blurType` | `BlurType` | `'regular'` | The type of blur effect to apply |
|
|
615
638
|
| `blurAmount` | `number` | `20.0` | Maximum blur radius in pixels |
|
|
616
|
-
| `direction` | `'blurredTopClearBottom' \| 'blurredBottomClearTop'` | `'blurredTopClearBottom'` | Direction of the blur gradient |
|
|
639
|
+
| `direction` | `'blurredTopClearBottom' \| 'blurredBottomClearTop' \| 'blurredCenterClearTopAndBottom'` | `'blurredTopClearBottom'` | Direction of the blur gradient |
|
|
617
640
|
| `startOffset` | `number` | `0.0` | Where the gradient starts (0.0 to 1.0) |
|
|
618
641
|
| `reducedTransparencyFallbackColor` | `string` | `'#FFFFFF'` | Fallback color when reduced transparency is enabled |
|
|
619
642
|
| `overlayColor` | `ColorValue` | `undefined` | The overlay color to apply on top of the blur effect |
|
package/android/src/main/java/com/sbaiahmed1/reactnativeblur/ReactNativeProgressiveBlurView.kt
CHANGED
|
@@ -14,6 +14,7 @@ import android.widget.FrameLayout
|
|
|
14
14
|
import android.view.View.MeasureSpec
|
|
15
15
|
import com.qmdeve.blurview.widget.BlurView
|
|
16
16
|
import androidx.core.graphics.toColorInt
|
|
17
|
+
import kotlin.math.max
|
|
17
18
|
|
|
18
19
|
/**
|
|
19
20
|
* Android implementation of React Native ProgressiveBlurView component.
|
|
@@ -146,42 +147,74 @@ class ReactNativeProgressiveBlurView : FrameLayout {
|
|
|
146
147
|
}
|
|
147
148
|
|
|
148
149
|
try {
|
|
149
|
-
val
|
|
150
|
-
"
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
val
|
|
154
|
-
|
|
150
|
+
val gradient = when (currentDirection) {
|
|
151
|
+
"center" -> {
|
|
152
|
+
val startEdge = max(currentStartOffset, 0.01f)
|
|
153
|
+
val endEdge = 1f - startEdge
|
|
154
|
+
val centerLow = 0.2f + startEdge
|
|
155
|
+
val centerHigh = 0.8f - startEdge
|
|
156
|
+
|
|
157
|
+
LinearGradient(
|
|
158
|
+
0f,
|
|
159
|
+
0f,
|
|
160
|
+
0f,
|
|
161
|
+
height.toFloat(),
|
|
162
|
+
intArrayOf(
|
|
163
|
+
Color.TRANSPARENT,
|
|
164
|
+
Color.TRANSPARENT,
|
|
165
|
+
Color.WHITE,
|
|
166
|
+
Color.WHITE,
|
|
167
|
+
Color.TRANSPARENT,
|
|
168
|
+
Color.TRANSPARENT
|
|
169
|
+
),
|
|
170
|
+
floatArrayOf(
|
|
171
|
+
0f,
|
|
172
|
+
startEdge,
|
|
173
|
+
centerLow,
|
|
174
|
+
centerHigh,
|
|
175
|
+
endEdge,
|
|
176
|
+
1f
|
|
177
|
+
),
|
|
178
|
+
Shader.TileMode.CLAMP
|
|
179
|
+
)
|
|
155
180
|
}
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
181
|
+
else -> {
|
|
182
|
+
val (x0, y0, x1, y1) = when (currentDirection) {
|
|
183
|
+
"bottomToTop" -> {
|
|
184
|
+
// Blur at bottom, clear at top
|
|
185
|
+
// point0 (TRANSPARENT/clear) at top, point1 (WHITE/blur) at bottom adjusted by offset
|
|
186
|
+
val offsetPixels = height * currentStartOffset
|
|
187
|
+
floatArrayOf(0f, 0f, 0f, height - offsetPixels)
|
|
188
|
+
}
|
|
189
|
+
"topToBottom" -> {
|
|
190
|
+
// Blur at top, clear at bottom (default)
|
|
191
|
+
// point0 (TRANSPARENT/clear) at bottom, point1 (WHITE/blur) at top adjusted by offset
|
|
192
|
+
val offsetPixels = height * currentStartOffset
|
|
193
|
+
floatArrayOf(0f, height.toFloat(), 0f, offsetPixels)
|
|
194
|
+
}
|
|
195
|
+
"leftToRight" -> {
|
|
196
|
+
val offsetPixels = width * currentStartOffset
|
|
197
|
+
floatArrayOf(offsetPixels, 0f, width.toFloat(), 0f)
|
|
198
|
+
}
|
|
199
|
+
"rightToLeft" -> {
|
|
200
|
+
val offsetPixels = width * currentStartOffset
|
|
201
|
+
floatArrayOf(width.toFloat(), 0f, offsetPixels, 0f)
|
|
202
|
+
}
|
|
203
|
+
else -> floatArrayOf(0f, 0f, 0f, height.toFloat())
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
LinearGradient(
|
|
207
|
+
x0, y0, x1, y1,
|
|
208
|
+
intArrayOf(Color.TRANSPARENT, Color.WHITE),
|
|
209
|
+
floatArrayOf(0f, 1f),
|
|
210
|
+
Shader.TileMode.CLAMP
|
|
211
|
+
)
|
|
161
212
|
}
|
|
162
|
-
"leftToRight" -> {
|
|
163
|
-
val offsetPixels = width * currentStartOffset
|
|
164
|
-
floatArrayOf(offsetPixels, 0f, width.toFloat(), 0f)
|
|
165
|
-
}
|
|
166
|
-
"rightToLeft" -> {
|
|
167
|
-
val offsetPixels = width * currentStartOffset
|
|
168
|
-
floatArrayOf(width.toFloat(), 0f, offsetPixels, 0f)
|
|
169
|
-
}
|
|
170
|
-
else -> floatArrayOf(0f, 0f, 0f, height.toFloat())
|
|
171
213
|
}
|
|
172
214
|
|
|
173
|
-
// Create gradient: fully transparent -> fully opaque
|
|
174
|
-
// This masks the blur: opaque = blur visible, transparent = blur hidden (clear)
|
|
175
|
-
val gradient = LinearGradient(
|
|
176
|
-
x0, y0, x1, y1,
|
|
177
|
-
intArrayOf(Color.TRANSPARENT, Color.WHITE),
|
|
178
|
-
floatArrayOf(0f, 1f),
|
|
179
|
-
Shader.TileMode.CLAMP
|
|
180
|
-
)
|
|
181
|
-
|
|
182
215
|
gradientPaint.shader = gradient
|
|
183
216
|
|
|
184
|
-
logDebug("Updated gradient: direction=$currentDirection,
|
|
217
|
+
logDebug("Updated gradient: direction=$currentDirection, offset=$currentStartOffset")
|
|
185
218
|
invalidate()
|
|
186
219
|
|
|
187
220
|
} catch (e: Exception) {
|
|
@@ -232,8 +265,13 @@ class ReactNativeProgressiveBlurView : FrameLayout {
|
|
|
232
265
|
* @param amount The blur amount value (0-100), will be mapped to Android's 0-25 radius range
|
|
233
266
|
*/
|
|
234
267
|
fun setBlurAmount(amount: Float) {
|
|
235
|
-
|
|
236
|
-
|
|
268
|
+
var radius = mapBlurAmountToRadius(amount)
|
|
269
|
+
if (currentDirection == "center") {
|
|
270
|
+
// Center direction tends to look stronger; scale it down for parity with iOS
|
|
271
|
+
radius *= 0.35f
|
|
272
|
+
}
|
|
273
|
+
currentBlurRadius = radius
|
|
274
|
+
logDebug("setBlurAmount: $amount -> $currentBlurRadius (direction=$currentDirection)")
|
|
237
275
|
|
|
238
276
|
try {
|
|
239
277
|
blurView?.setBlurRadius(currentBlurRadius)
|
|
@@ -251,8 +289,9 @@ class ReactNativeProgressiveBlurView : FrameLayout {
|
|
|
251
289
|
currentDirection = when (direction.lowercase()) {
|
|
252
290
|
"blurredbottomcleartop", "bottomtotop", "bottom" -> "bottomToTop"
|
|
253
291
|
"blurredtopclearbottom", "toptobottom", "top" -> "topToBottom"
|
|
292
|
+
"blurredcentercleartopandbottom", "center" -> "center"
|
|
254
293
|
"blurredlefttoclearright", "lefttoright", "left" -> "leftToRight"
|
|
255
|
-
"
|
|
294
|
+
"blurredrighttoclearleft", "righttoleft", "right" -> "rightToLeft"
|
|
256
295
|
else -> {
|
|
257
296
|
logWarning("Unknown direction: $direction, defaulting to topToBottom")
|
|
258
297
|
"topToBottom"
|
|
@@ -9,11 +9,14 @@ import QuartzCore
|
|
|
9
9
|
public enum VariableBlurDirection: String {
|
|
10
10
|
case blurredTopClearBottom
|
|
11
11
|
case blurredBottomClearTop
|
|
12
|
+
case blurredCenterClearTopAndBottom
|
|
12
13
|
|
|
13
14
|
init(fromString string: String) {
|
|
14
15
|
switch string.lowercased() {
|
|
15
16
|
case "blurredbottomcleartop", "bottomtotop", "bottom":
|
|
16
17
|
self = .blurredBottomClearTop
|
|
18
|
+
case "blurredcentercleartopandbottom", "center":
|
|
19
|
+
self = .blurredCenterClearTopAndBottom
|
|
17
20
|
default:
|
|
18
21
|
self = .blurredTopClearBottom
|
|
19
22
|
}
|
|
@@ -122,21 +125,144 @@ open class VariableBlurView: UIVisualEffectView {
|
|
|
122
125
|
startOffset: CGFloat,
|
|
123
126
|
direction: VariableBlurDirection
|
|
124
127
|
) -> CGImage {
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
ciGradientFilter
|
|
128
|
+
switch direction {
|
|
129
|
+
case .blurredCenterClearTopAndBottom:
|
|
130
|
+
return makeCenterGradientImage(
|
|
131
|
+
width: width,
|
|
132
|
+
height: height,
|
|
133
|
+
edgeOffset: startOffset
|
|
134
|
+
)
|
|
135
|
+
case .blurredTopClearBottom, .blurredBottomClearTop:
|
|
136
|
+
// Try smoothLinearGradient for smoother transitions
|
|
137
|
+
let ciGradientFilter = CIFilter.smoothLinearGradient()
|
|
138
|
+
ciGradientFilter.color0 = CIColor.black
|
|
139
|
+
ciGradientFilter.color1 = CIColor.clear
|
|
140
|
+
ciGradientFilter.point0 = CGPoint(x: 0, y: height)
|
|
141
|
+
ciGradientFilter.point1 = CGPoint(x: 0, y: startOffset * height)
|
|
142
|
+
|
|
143
|
+
if case .blurredBottomClearTop = direction {
|
|
144
|
+
ciGradientFilter.point0.y = 0
|
|
145
|
+
ciGradientFilter.point1.y = height - ciGradientFilter.point1.y
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
guard let output = ciGradientFilter.outputImage else {
|
|
149
|
+
return makeFallbackMask(width: width, height: height)
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
guard let cg = CIContext().createCGImage(
|
|
153
|
+
output,
|
|
154
|
+
from: CGRect(x: 0, y: 0, width: width, height: height)
|
|
155
|
+
) else {
|
|
156
|
+
return makeFallbackMask(width: width, height: height)
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
return cg
|
|
135
160
|
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
private func makeCenterGradientImage(
|
|
164
|
+
width: CGFloat = 100,
|
|
165
|
+
height: CGFloat = 100,
|
|
166
|
+
edgeOffset: CGFloat
|
|
167
|
+
) -> CGImage {
|
|
168
|
+
let startEdge = max(min(edgeOffset, 0.2), 0.01)
|
|
169
|
+
let endEdge = 1 - startEdge
|
|
170
|
+
let colorSpace = CGColorSpaceCreateDeviceRGB()
|
|
136
171
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
172
|
+
let centerLow: CGFloat = 0.5
|
|
173
|
+
let centerHigh: CGFloat = 0.5
|
|
174
|
+
let locations: [CGFloat] = [
|
|
175
|
+
0.0,
|
|
176
|
+
startEdge,
|
|
177
|
+
centerLow,
|
|
178
|
+
centerHigh,
|
|
179
|
+
endEdge,
|
|
180
|
+
1.0
|
|
181
|
+
]
|
|
182
|
+
|
|
183
|
+
let colorComponents: [CGFloat] = [
|
|
184
|
+
0, 0, 0, 0, // top clear
|
|
185
|
+
0, 0, 0, 0, // clear until offset
|
|
186
|
+
0, 0, 0, 1, // ramp up to opaque
|
|
187
|
+
0, 0, 0, 1, // hold opaque plateau
|
|
188
|
+
0, 0, 0, 0, // back to clear
|
|
189
|
+
0, 0, 0, 0 // bottom clear
|
|
190
|
+
]
|
|
191
|
+
|
|
192
|
+
let context = CGContext(
|
|
193
|
+
data: nil,
|
|
194
|
+
width: Int(width),
|
|
195
|
+
height: Int(height),
|
|
196
|
+
bitsPerComponent: 8,
|
|
197
|
+
bytesPerRow: 0,
|
|
198
|
+
space: colorSpace,
|
|
199
|
+
bitmapInfo: CGImageAlphaInfo.premultipliedLast.rawValue
|
|
140
200
|
)!
|
|
201
|
+
|
|
202
|
+
guard let gradient = CGGradient(
|
|
203
|
+
colorSpace: colorSpace,
|
|
204
|
+
colorComponents: colorComponents,
|
|
205
|
+
locations: locations,
|
|
206
|
+
count: locations.count
|
|
207
|
+
) else {
|
|
208
|
+
return makeFallbackMask(width: width, height: height)
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
context.drawLinearGradient(
|
|
212
|
+
gradient,
|
|
213
|
+
start: CGPoint(x: 0, y: 0),
|
|
214
|
+
end: CGPoint(x: 0, y: height),
|
|
215
|
+
options: []
|
|
216
|
+
)
|
|
217
|
+
|
|
218
|
+
return context.makeImage() ?? makeFallbackMask(width: width, height: height)
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
private func makeFallbackMask(width: CGFloat, height: CGFloat) -> CGImage {
|
|
222
|
+
let fallback = CIFilter.smoothLinearGradient()
|
|
223
|
+
fallback.color0 = CIColor.black
|
|
224
|
+
fallback.color1 = CIColor.clear
|
|
225
|
+
fallback.point0 = CGPoint(x: 0, y: height)
|
|
226
|
+
fallback.point1 = CGPoint(x: 0, y: height / 2)
|
|
227
|
+
|
|
228
|
+
if let output = fallback.outputImage,
|
|
229
|
+
let cg = CIContext().createCGImage(
|
|
230
|
+
output,
|
|
231
|
+
from: CGRect(x: 0, y: 0, width: width, height: height)
|
|
232
|
+
) {
|
|
233
|
+
return cg
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
// Last-resort solid mask (fully opaque) to avoid crash loops
|
|
237
|
+
let colorSpace = CGColorSpaceCreateDeviceGray()
|
|
238
|
+
let bitmapInfo = CGImageAlphaInfo.none.rawValue
|
|
239
|
+
guard let context = CGContext(
|
|
240
|
+
data: nil,
|
|
241
|
+
width: Int(max(width, 1)),
|
|
242
|
+
height: Int(max(height, 1)),
|
|
243
|
+
bitsPerComponent: 8,
|
|
244
|
+
bytesPerRow: 0,
|
|
245
|
+
space: colorSpace,
|
|
246
|
+
bitmapInfo: bitmapInfo
|
|
247
|
+
) else {
|
|
248
|
+
// Should never happen; return a 1x1 opaque pixel
|
|
249
|
+
return CGImage(
|
|
250
|
+
width: 1,
|
|
251
|
+
height: 1,
|
|
252
|
+
bitsPerComponent: 8,
|
|
253
|
+
bitsPerPixel: 8,
|
|
254
|
+
bytesPerRow: 1,
|
|
255
|
+
space: colorSpace,
|
|
256
|
+
bitmapInfo: CGBitmapInfo(rawValue: bitmapInfo),
|
|
257
|
+
provider: CGDataProvider(data: Data([0xFF]) as CFData)!,
|
|
258
|
+
decode: nil,
|
|
259
|
+
shouldInterpolate: false,
|
|
260
|
+
intent: .defaultIntent
|
|
261
|
+
)!
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
context.setFillColor(CGColor(gray: 0, alpha: 1))
|
|
265
|
+
context.fill(CGRect(x: 0, y: 0, width: width, height: height))
|
|
266
|
+
return context.makeImage()!
|
|
141
267
|
}
|
|
142
268
|
}
|
|
@@ -83,10 +83,7 @@ export const ProgressiveBlurView = ({
|
|
|
83
83
|
reducedTransparencyFallbackColor: reducedTransparencyFallbackColor,
|
|
84
84
|
style: StyleSheet.absoluteFill,
|
|
85
85
|
...props
|
|
86
|
-
}),
|
|
87
|
-
style: styles.children,
|
|
88
|
-
children: children
|
|
89
|
-
})]
|
|
86
|
+
}), children]
|
|
90
87
|
});
|
|
91
88
|
};
|
|
92
89
|
export default ProgressiveBlurView;
|
|
@@ -94,10 +91,6 @@ const styles = StyleSheet.create({
|
|
|
94
91
|
container: {
|
|
95
92
|
position: 'relative',
|
|
96
93
|
overflow: 'hidden'
|
|
97
|
-
},
|
|
98
|
-
children: {
|
|
99
|
-
position: 'relative',
|
|
100
|
-
zIndex: 1
|
|
101
94
|
}
|
|
102
95
|
});
|
|
103
96
|
//# sourceMappingURL=ProgressiveBlurView.js.map
|
|
@@ -1 +1 @@
|
|
|
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"
|
|
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"],"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;AAoEzD;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,EAEDD,QAAQ;EAAA,CACL,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;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -30,7 +30,8 @@ export type BlurType =
|
|
|
30
30
|
|
|
31
31
|
export type ProgressiveBlurDirection =
|
|
32
32
|
| 'blurredTopClearBottom'
|
|
33
|
-
| 'blurredBottomClearTop'
|
|
33
|
+
| 'blurredBottomClearTop'
|
|
34
|
+
| 'blurredCenterClearTopAndBottom';
|
|
34
35
|
|
|
35
36
|
interface NativeProps extends ViewProps {
|
|
36
37
|
blurAmount?: WithDefault<Double, 20.0>;
|
|
@@ -19,6 +19,7 @@ export interface ProgressiveBlurViewProps {
|
|
|
19
19
|
* @description The direction of the progressive blur gradient
|
|
20
20
|
* - 'blurredTopClearBottom': Blur starts at top, clear at bottom
|
|
21
21
|
* - 'blurredBottomClearTop': Blur starts at bottom, clear at top
|
|
22
|
+
* - 'blurredCenterClearTopAndBottom': Blur peaks at center, clear at both edges
|
|
22
23
|
*
|
|
23
24
|
* @default 'blurredTopClearBottom'
|
|
24
25
|
*/
|
|
@@ -1 +1 @@
|
|
|
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
|
|
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;;;;;;;OAOG;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"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ViewProps } from 'react-native';
|
|
2
2
|
import type { WithDefault, Double } from 'react-native/Libraries/Types/CodegenTypes';
|
|
3
3
|
export type BlurType = 'xlight' | 'light' | 'dark' | 'extraDark' | 'regular' | 'prominent' | 'systemUltraThinMaterial' | 'systemThinMaterial' | 'systemMaterial' | 'systemThickMaterial' | 'systemChromeMaterial' | 'systemUltraThinMaterialLight' | 'systemThinMaterialLight' | 'systemMaterialLight' | 'systemThickMaterialLight' | 'systemChromeMaterialLight' | 'systemUltraThinMaterialDark' | 'systemThinMaterialDark' | 'systemMaterialDark' | 'systemThickMaterialDark' | 'systemChromeMaterialDark';
|
|
4
|
-
export type ProgressiveBlurDirection = 'blurredTopClearBottom' | 'blurredBottomClearTop';
|
|
4
|
+
export type ProgressiveBlurDirection = 'blurredTopClearBottom' | 'blurredBottomClearTop' | 'blurredCenterClearTopAndBottom';
|
|
5
5
|
interface NativeProps extends ViewProps {
|
|
6
6
|
blurAmount?: WithDefault<Double, 20.0>;
|
|
7
7
|
blurType?: WithDefault<BlurType, 'regular'>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReactNativeProgressiveBlurViewNativeComponent.d.ts","sourceRoot":"","sources":["../../../src/ReactNativeProgressiveBlurViewNativeComponent.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EACV,WAAW,EACX,MAAM,EACP,MAAM,2CAA2C,CAAC;AAEnD,MAAM,MAAM,QAAQ,GAChB,QAAQ,GACR,OAAO,GACP,MAAM,GACN,WAAW,GACX,SAAS,GACT,WAAW,GACX,yBAAyB,GACzB,oBAAoB,GACpB,gBAAgB,GAChB,qBAAqB,GACrB,sBAAsB,GACtB,8BAA8B,GAC9B,yBAAyB,GACzB,qBAAqB,GACrB,0BAA0B,GAC1B,2BAA2B,GAC3B,6BAA6B,GAC7B,wBAAwB,GACxB,oBAAoB,GACpB,yBAAyB,GACzB,0BAA0B,CAAC;AAE/B,MAAM,MAAM,wBAAwB,GAChC,uBAAuB,GACvB,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"ReactNativeProgressiveBlurViewNativeComponent.d.ts","sourceRoot":"","sources":["../../../src/ReactNativeProgressiveBlurViewNativeComponent.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EACV,WAAW,EACX,MAAM,EACP,MAAM,2CAA2C,CAAC;AAEnD,MAAM,MAAM,QAAQ,GAChB,QAAQ,GACR,OAAO,GACP,MAAM,GACN,WAAW,GACX,SAAS,GACT,WAAW,GACX,yBAAyB,GACzB,oBAAoB,GACpB,gBAAgB,GAChB,qBAAqB,GACrB,sBAAsB,GACtB,8BAA8B,GAC9B,yBAAyB,GACzB,qBAAqB,GACrB,0BAA0B,GAC1B,2BAA2B,GAC3B,6BAA6B,GAC7B,wBAAwB,GACxB,oBAAoB,GACpB,yBAAyB,GACzB,0BAA0B,CAAC;AAE/B,MAAM,MAAM,wBAAwB,GAChC,uBAAuB,GACvB,uBAAuB,GACvB,gCAAgC,CAAC;AAErC,UAAU,WAAY,SAAQ,SAAS;IACrC,UAAU,CAAC,EAAE,WAAW,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IACvC,QAAQ,CAAC,EAAE,WAAW,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;IAC5C,SAAS,CAAC,EAAE,WAAW,CAAC,wBAAwB,EAAE,uBAAuB,CAAC,CAAC;IAC3E,WAAW,CAAC,EAAE,WAAW,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACvC,gCAAgC,CAAC,EAAE,WAAW,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;CACnE;;AAED,wBAEE"}
|
package/package.json
CHANGED
|
@@ -26,6 +26,7 @@ export interface ProgressiveBlurViewProps {
|
|
|
26
26
|
* @description The direction of the progressive blur gradient
|
|
27
27
|
* - 'blurredTopClearBottom': Blur starts at top, clear at bottom
|
|
28
28
|
* - 'blurredBottomClearTop': Blur starts at bottom, clear at top
|
|
29
|
+
* - 'blurredCenterClearTopAndBottom': Blur peaks at center, clear at both edges
|
|
29
30
|
*
|
|
30
31
|
* @default 'blurredTopClearBottom'
|
|
31
32
|
*/
|
|
@@ -153,7 +154,7 @@ export const ProgressiveBlurView: React.FC<ProgressiveBlurViewProps> = ({
|
|
|
153
154
|
{...props}
|
|
154
155
|
/>
|
|
155
156
|
|
|
156
|
-
|
|
157
|
+
{children}
|
|
157
158
|
</View>
|
|
158
159
|
);
|
|
159
160
|
};
|
|
@@ -165,8 +166,4 @@ const styles = StyleSheet.create({
|
|
|
165
166
|
position: 'relative',
|
|
166
167
|
overflow: 'hidden',
|
|
167
168
|
},
|
|
168
|
-
children: {
|
|
169
|
-
position: 'relative',
|
|
170
|
-
zIndex: 1,
|
|
171
|
-
},
|
|
172
169
|
});
|
|
@@ -30,7 +30,8 @@ export type BlurType =
|
|
|
30
30
|
|
|
31
31
|
export type ProgressiveBlurDirection =
|
|
32
32
|
| 'blurredTopClearBottom'
|
|
33
|
-
| 'blurredBottomClearTop'
|
|
33
|
+
| 'blurredBottomClearTop'
|
|
34
|
+
| 'blurredCenterClearTopAndBottom';
|
|
34
35
|
|
|
35
36
|
interface NativeProps extends ViewProps {
|
|
36
37
|
blurAmount?: WithDefault<Double, 20.0>;
|