@sbaiahmed1/react-native-blur 4.0.0 → 4.1.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 +155 -47
- package/android/build.gradle +1 -1
- package/android/src/main/java/com/sbaiahmed1/reactnativeblur/BlurType.kt +63 -0
- package/android/src/main/java/com/sbaiahmed1/reactnativeblur/ReactNativeBlurPackage.kt +1 -0
- package/android/src/main/java/com/sbaiahmed1/reactnativeblur/ReactNativeBlurView.kt +63 -43
- package/android/src/main/java/com/sbaiahmed1/reactnativeblur/ReactNativeBlurViewManager.kt +14 -26
- package/android/src/main/java/com/sbaiahmed1/reactnativeblur/ReactNativeProgressiveBlurView.kt +320 -0
- package/android/src/main/java/com/sbaiahmed1/reactnativeblur/ReactNativeProgressiveBlurViewManager.kt +81 -0
- package/ios/Helpers/BlurStyleHelpers.swift +20 -0
- package/ios/Helpers/ReactNativeProgressiveBlurViewHelper.swift +39 -0
- package/ios/ReactNativeLiquidGlassView.mm +8 -1
- package/ios/ReactNativeProgressiveBlurView.h +14 -0
- package/ios/ReactNativeProgressiveBlurView.mm +213 -0
- package/ios/ReactNativeProgressiveBlurViewManager.h +4 -0
- package/ios/ReactNativeProgressiveBlurViewManager.mm +137 -0
- package/ios/Views/LiquidGlassContainerView.swift +8 -30
- package/ios/Views/ProgressiveBlurView.swift +124 -0
- package/ios/Views/VariableBlurView.swift +142 -0
- package/lib/module/BlurView.js +23 -12
- package/lib/module/BlurView.js.map +1 -1
- package/lib/module/LiquidGlassView.js +3 -1
- package/lib/module/LiquidGlassView.js.map +1 -1
- package/lib/module/ProgressiveBlurView.js +98 -0
- package/lib/module/ProgressiveBlurView.js.map +1 -0
- package/lib/module/ReactNativeBlurViewNativeComponent.ts +11 -1
- package/lib/module/ReactNativeProgressiveBlurViewNativeComponent.ts +45 -0
- package/lib/module/index.js +2 -0
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/src/BlurView.d.ts.map +1 -1
- package/lib/typescript/src/LiquidGlassView.d.ts.map +1 -1
- package/lib/typescript/src/ProgressiveBlurView.d.ts +97 -0
- package/lib/typescript/src/ProgressiveBlurView.d.ts.map +1 -0
- package/lib/typescript/src/ReactNativeBlurViewNativeComponent.d.ts +1 -1
- package/lib/typescript/src/ReactNativeBlurViewNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/ReactNativeProgressiveBlurViewNativeComponent.d.ts +14 -0
- package/lib/typescript/src/ReactNativeProgressiveBlurViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +4 -0
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/package.json +5 -5
- package/src/BlurView.tsx +21 -17
- package/src/LiquidGlassView.tsx +3 -4
- package/src/ProgressiveBlurView.tsx +161 -0
- package/src/ReactNativeBlurViewNativeComponent.ts +11 -1
- package/src/ReactNativeProgressiveBlurViewNativeComponent.ts +45 -0
- package/src/index.tsx +6 -0
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { StyleSheet, View } from 'react-native';
|
|
3
|
+
import type { ViewStyle, StyleProp } from 'react-native';
|
|
4
|
+
import ReactNativeProgressiveBlurView, {
|
|
5
|
+
type BlurType,
|
|
6
|
+
type ProgressiveBlurDirection,
|
|
7
|
+
} from './ReactNativeProgressiveBlurViewNativeComponent';
|
|
8
|
+
|
|
9
|
+
export interface ProgressiveBlurViewProps {
|
|
10
|
+
/**
|
|
11
|
+
* @description The type of blur effect to apply
|
|
12
|
+
*
|
|
13
|
+
* @default 'regular'
|
|
14
|
+
*/
|
|
15
|
+
blurType?: BlurType;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* @description The maximum intensity of the blur effect (in pixels)
|
|
19
|
+
* This is the blur radius at the most blurred part of the gradient
|
|
20
|
+
*
|
|
21
|
+
* @default 20
|
|
22
|
+
*/
|
|
23
|
+
blurAmount?: number;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* @description The direction of the progressive blur gradient
|
|
27
|
+
* - 'blurredTopClearBottom': Blur starts at top, clear at bottom
|
|
28
|
+
* - 'blurredBottomClearTop': Blur starts at bottom, clear at top
|
|
29
|
+
*
|
|
30
|
+
* @default 'blurredTopClearBottom'
|
|
31
|
+
*/
|
|
32
|
+
direction?: ProgressiveBlurDirection;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* @description The offset where the gradient starts (0.0 to 1.0)
|
|
36
|
+
* 0.0 means the gradient starts immediately
|
|
37
|
+
* 1.0 means the gradient is delayed to the end
|
|
38
|
+
*
|
|
39
|
+
* @default 0.0
|
|
40
|
+
*/
|
|
41
|
+
startOffset?: number;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* @description Fallback color when reduced transparency is enabled
|
|
45
|
+
*
|
|
46
|
+
* Accepts hex color strings like `#FFFFFF`
|
|
47
|
+
*
|
|
48
|
+
* @default '#FFFFFF'
|
|
49
|
+
*/
|
|
50
|
+
reducedTransparencyFallbackColor?: string;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* @description style object for the progressive blur view
|
|
54
|
+
*
|
|
55
|
+
* @default undefined
|
|
56
|
+
*/
|
|
57
|
+
style?: StyleProp<ViewStyle>;
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* @description Child components to render inside the progressive blur view
|
|
61
|
+
*
|
|
62
|
+
* @default undefined
|
|
63
|
+
*/
|
|
64
|
+
children?: React.ReactNode;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* A progressive blur view component that provides variable/gradient blur effects.
|
|
69
|
+
*
|
|
70
|
+
* This component applies a blur effect that gradually changes intensity across the view,
|
|
71
|
+
* creating a smooth gradient from fully blurred to clear (or vice versa).
|
|
72
|
+
*
|
|
73
|
+
* **Platform Support:**
|
|
74
|
+
* - iOS: Full support using private Core Animation filters
|
|
75
|
+
* - Android: Supported using QmBlurView's ProgressiveBlurView
|
|
76
|
+
*
|
|
77
|
+
* This component uses the same positioning pattern as BlurView where the blur
|
|
78
|
+
* effect is positioned absolutely behind the content.
|
|
79
|
+
*
|
|
80
|
+
* @example
|
|
81
|
+
* ```tsx
|
|
82
|
+
* // Blur that fades from top (blurred) to bottom (clear)
|
|
83
|
+
* <ProgressiveBlurView
|
|
84
|
+
* blurType="light"
|
|
85
|
+
* blurAmount={30}
|
|
86
|
+
* direction="blurredTopClearBottom"
|
|
87
|
+
* startOffset={0.2}
|
|
88
|
+
* style={{ height: 200 }}
|
|
89
|
+
* >
|
|
90
|
+
* <Text>Content on top of progressive blur</Text>
|
|
91
|
+
* </ProgressiveBlurView>
|
|
92
|
+
* ```
|
|
93
|
+
*
|
|
94
|
+
* @example
|
|
95
|
+
* ```tsx
|
|
96
|
+
* // Blur that fades from bottom (blurred) to top (clear)
|
|
97
|
+
* <ProgressiveBlurView
|
|
98
|
+
* blurType="dark"
|
|
99
|
+
* blurAmount={40}
|
|
100
|
+
* direction="blurredBottomClearTop"
|
|
101
|
+
* style={{ height: 200 }}
|
|
102
|
+
* >
|
|
103
|
+
* <Text>Content visible at top, blurred at bottom</Text>
|
|
104
|
+
* </ProgressiveBlurView>
|
|
105
|
+
* ```
|
|
106
|
+
*/
|
|
107
|
+
export const ProgressiveBlurView: React.FC<ProgressiveBlurViewProps> = ({
|
|
108
|
+
blurType = 'regular',
|
|
109
|
+
blurAmount = 20,
|
|
110
|
+
direction = 'blurredTopClearBottom',
|
|
111
|
+
startOffset = 0.0,
|
|
112
|
+
reducedTransparencyFallbackColor = '#FFFFFF',
|
|
113
|
+
style,
|
|
114
|
+
children,
|
|
115
|
+
...props
|
|
116
|
+
}) => {
|
|
117
|
+
// If no children, render the blur view directly (for background use)
|
|
118
|
+
if (React.Children.count(children) === 0) {
|
|
119
|
+
return (
|
|
120
|
+
<ReactNativeProgressiveBlurView
|
|
121
|
+
blurType={blurType}
|
|
122
|
+
blurAmount={blurAmount}
|
|
123
|
+
direction={direction}
|
|
124
|
+
startOffset={startOffset}
|
|
125
|
+
reducedTransparencyFallbackColor={reducedTransparencyFallbackColor}
|
|
126
|
+
style={style}
|
|
127
|
+
{...props}
|
|
128
|
+
/>
|
|
129
|
+
);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
// If children exist, use the absolute positioning pattern
|
|
133
|
+
return (
|
|
134
|
+
<View style={[styles.container, style]}>
|
|
135
|
+
{/* Blur effect positioned absolutely behind content */}
|
|
136
|
+
<ReactNativeProgressiveBlurView
|
|
137
|
+
blurType={blurType}
|
|
138
|
+
blurAmount={blurAmount}
|
|
139
|
+
direction={direction}
|
|
140
|
+
startOffset={startOffset}
|
|
141
|
+
reducedTransparencyFallbackColor={reducedTransparencyFallbackColor}
|
|
142
|
+
style={StyleSheet.absoluteFill}
|
|
143
|
+
{...props}
|
|
144
|
+
/>
|
|
145
|
+
<View style={styles.children}>{children}</View>
|
|
146
|
+
</View>
|
|
147
|
+
);
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
export default ProgressiveBlurView;
|
|
151
|
+
|
|
152
|
+
const styles = StyleSheet.create({
|
|
153
|
+
container: {
|
|
154
|
+
position: 'relative',
|
|
155
|
+
overflow: 'hidden',
|
|
156
|
+
},
|
|
157
|
+
children: {
|
|
158
|
+
position: 'relative',
|
|
159
|
+
zIndex: 1,
|
|
160
|
+
},
|
|
161
|
+
});
|
|
@@ -16,7 +16,17 @@ export type BlurType =
|
|
|
16
16
|
| 'systemThinMaterial'
|
|
17
17
|
| 'systemMaterial'
|
|
18
18
|
| 'systemThickMaterial'
|
|
19
|
-
| 'systemChromeMaterial'
|
|
19
|
+
| 'systemChromeMaterial'
|
|
20
|
+
| 'systemUltraThinMaterialLight'
|
|
21
|
+
| 'systemThinMaterialLight'
|
|
22
|
+
| 'systemMaterialLight'
|
|
23
|
+
| 'systemThickMaterialLight'
|
|
24
|
+
| 'systemChromeMaterialLight'
|
|
25
|
+
| 'systemUltraThinMaterialDark'
|
|
26
|
+
| 'systemThinMaterialDark'
|
|
27
|
+
| 'systemMaterialDark'
|
|
28
|
+
| 'systemThickMaterialDark'
|
|
29
|
+
| 'systemChromeMaterialDark';
|
|
20
30
|
|
|
21
31
|
interface NativeProps extends ViewProps {
|
|
22
32
|
blurAmount?: WithDefault<Double, 10.0>;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
|
|
2
|
+
import type { ViewProps } from 'react-native';
|
|
3
|
+
import type {
|
|
4
|
+
WithDefault,
|
|
5
|
+
Double,
|
|
6
|
+
} from 'react-native/Libraries/Types/CodegenTypes';
|
|
7
|
+
|
|
8
|
+
export type BlurType =
|
|
9
|
+
| 'xlight'
|
|
10
|
+
| 'light'
|
|
11
|
+
| 'dark'
|
|
12
|
+
| 'extraDark'
|
|
13
|
+
| 'regular'
|
|
14
|
+
| 'prominent'
|
|
15
|
+
| 'systemUltraThinMaterial'
|
|
16
|
+
| 'systemThinMaterial'
|
|
17
|
+
| 'systemMaterial'
|
|
18
|
+
| 'systemThickMaterial'
|
|
19
|
+
| 'systemChromeMaterial'
|
|
20
|
+
| 'systemUltraThinMaterialLight'
|
|
21
|
+
| 'systemThinMaterialLight'
|
|
22
|
+
| 'systemMaterialLight'
|
|
23
|
+
| 'systemThickMaterialLight'
|
|
24
|
+
| 'systemChromeMaterialLight'
|
|
25
|
+
| 'systemUltraThinMaterialDark'
|
|
26
|
+
| 'systemThinMaterialDark'
|
|
27
|
+
| 'systemMaterialDark'
|
|
28
|
+
| 'systemThickMaterialDark'
|
|
29
|
+
| 'systemChromeMaterialDark';
|
|
30
|
+
|
|
31
|
+
export type ProgressiveBlurDirection =
|
|
32
|
+
| 'blurredTopClearBottom'
|
|
33
|
+
| 'blurredBottomClearTop';
|
|
34
|
+
|
|
35
|
+
interface NativeProps extends ViewProps {
|
|
36
|
+
blurAmount?: WithDefault<Double, 20.0>;
|
|
37
|
+
blurType?: WithDefault<BlurType, 'regular'>;
|
|
38
|
+
direction?: WithDefault<ProgressiveBlurDirection, 'blurredTopClearBottom'>;
|
|
39
|
+
startOffset?: WithDefault<Double, 0.0>;
|
|
40
|
+
reducedTransparencyFallbackColor?: WithDefault<string, '#FFFFFF'>;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export default codegenNativeComponent<NativeProps>(
|
|
44
|
+
'ReactNativeProgressiveBlurView'
|
|
45
|
+
);
|
package/src/index.tsx
CHANGED
|
@@ -9,3 +9,9 @@ export type { GlassType } from './ReactNativeLiquidGlassViewNativeComponent';
|
|
|
9
9
|
|
|
10
10
|
export { LiquidGlassView } from './LiquidGlassView';
|
|
11
11
|
export type { LiquidGlassViewProps } from './LiquidGlassView';
|
|
12
|
+
|
|
13
|
+
export { default as ReactNativeProgressiveBlurView } from './ReactNativeProgressiveBlurViewNativeComponent';
|
|
14
|
+
export type { ProgressiveBlurDirection } from './ReactNativeProgressiveBlurViewNativeComponent';
|
|
15
|
+
|
|
16
|
+
export { ProgressiveBlurView } from './ProgressiveBlurView';
|
|
17
|
+
export type { ProgressiveBlurViewProps } from './ProgressiveBlurView';
|