@sbaiahmed1/react-native-blur 0.2.1 → 0.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 +345 -106
- package/ReactNativeBlur.podspec +2 -1
- package/android/app/build/generated/source/codegen/java/com/facebook/react/viewmanagers/ReactNativeBlurViewManagerDelegate.java +18 -3
- package/android/app/build/generated/source/codegen/java/com/facebook/react/viewmanagers/ReactNativeBlurViewManagerInterface.java +6 -1
- package/android/app/build/generated/source/codegen/java/com/facebook/react/viewmanagers/ReactNativeGlassEffectContainerManagerDelegate.java +53 -0
- package/android/app/build/generated/source/codegen/java/com/facebook/react/viewmanagers/ReactNativeGlassEffectContainerManagerInterface.java +25 -0
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/ReactNativeBlurViewSpec/ComponentDescriptors.cpp +1 -1
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/ReactNativeBlurViewSpec/ComponentDescriptors.h +1 -1
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/ReactNativeBlurViewSpec/EventEmitters.h +1 -1
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/ReactNativeBlurViewSpec/Props.cpp +17 -7
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/ReactNativeBlurViewSpec/Props.h +55 -15
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/ReactNativeBlurViewSpec/ShadowNodes.cpp +1 -1
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/ReactNativeBlurViewSpec/ShadowNodes.h +7 -7
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/ReactNativeBlurViewSpec/States.h +3 -3
- package/android/src/main/java/com/sbaiahmed1/reactnativeblur/ReactNativeBlurView.kt +150 -46
- package/android/src/main/java/com/sbaiahmed1/reactnativeblur/ReactNativeBlurViewManager.kt +25 -0
- package/ios/ReactNativeBlurView.mm +197 -237
- package/ios/ReactNativeBlurView.swift +321 -0
- package/ios/ReactNativeBlurViewManager.h +5 -0
- package/ios/ReactNativeBlurViewManager.m +171 -0
- package/lib/module/BlurView.js +17 -2
- package/lib/module/BlurView.js.map +1 -1
- package/lib/module/ReactNativeBlurViewNativeComponent.ts +10 -3
- package/lib/typescript/src/BlurView.d.ts +36 -1
- package/lib/typescript/src/BlurView.d.ts.map +1 -1
- package/lib/typescript/src/ReactNativeBlurViewNativeComponent.d.ts +9 -3
- package/lib/typescript/src/ReactNativeBlurViewNativeComponent.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/BlurView.tsx +58 -3
- package/src/ReactNativeBlurViewNativeComponent.ts +10 -3
- package/ios/ReactNativeBlurViewManager.mm +0 -23
package/src/BlurView.tsx
CHANGED
|
@@ -4,11 +4,12 @@ import type { ViewStyle, StyleProp } from 'react-native';
|
|
|
4
4
|
import ReactNativeBlurView, {
|
|
5
5
|
type BlurType,
|
|
6
6
|
} from './ReactNativeBlurViewNativeComponent';
|
|
7
|
+
import type { GlassType } from '../src/ReactNativeBlurViewNativeComponent';
|
|
7
8
|
|
|
8
9
|
export interface BlurViewProps {
|
|
9
10
|
/**
|
|
10
11
|
* The type of blur effect to apply
|
|
11
|
-
* @default '
|
|
12
|
+
* @default 'xlight'
|
|
12
13
|
*/
|
|
13
14
|
blurType?: BlurType;
|
|
14
15
|
|
|
@@ -21,6 +22,7 @@ export interface BlurViewProps {
|
|
|
21
22
|
/**
|
|
22
23
|
* Fallback color when reduced transparency is enabled
|
|
23
24
|
* Accepts hex color strings like '#FFFFFF'
|
|
25
|
+
* @default '#FFFFFF'
|
|
24
26
|
*/
|
|
25
27
|
reducedTransparencyFallbackColor?: string;
|
|
26
28
|
|
|
@@ -33,6 +35,44 @@ export interface BlurViewProps {
|
|
|
33
35
|
* Child components to render inside the blur view
|
|
34
36
|
*/
|
|
35
37
|
children?: React.ReactNode;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Platform: iOS only
|
|
41
|
+
* The type of glass effect to apply
|
|
42
|
+
* @default 'clear'
|
|
43
|
+
*/
|
|
44
|
+
glassType?: GlassType;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Platform: iOS only
|
|
48
|
+
* The tint color of the glass effect
|
|
49
|
+
* accepts hex color strings like '#FFFFFF'
|
|
50
|
+
* accepts color names like 'white', 'clear', 'black', 'red', 'green', 'blue', 'yellow', 'cyan', 'magenta'
|
|
51
|
+
* @default 'clear'
|
|
52
|
+
*/
|
|
53
|
+
glassTintColor?: string;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Platform: iOS only
|
|
57
|
+
* The opacity of the glass effect (0-1)
|
|
58
|
+
* @default 1.0
|
|
59
|
+
*/
|
|
60
|
+
glassOpacity?: number;
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* The type of blur effect to apply
|
|
64
|
+
* liquidGlass = iOS Only
|
|
65
|
+
* blur = Android | iOS
|
|
66
|
+
* @default 'blur'
|
|
67
|
+
*/
|
|
68
|
+
type?: 'blur' | 'liquidGlass';
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Platform: iOS only
|
|
72
|
+
* Whether the blur view should be interactive
|
|
73
|
+
* @default true
|
|
74
|
+
*/
|
|
75
|
+
isInteractive?: boolean;
|
|
36
76
|
}
|
|
37
77
|
|
|
38
78
|
/**
|
|
@@ -58,11 +98,16 @@ export interface BlurViewProps {
|
|
|
58
98
|
* ```
|
|
59
99
|
*/
|
|
60
100
|
export const BlurView: React.FC<BlurViewProps> = ({
|
|
61
|
-
blurType = '
|
|
101
|
+
blurType = 'xlight',
|
|
62
102
|
blurAmount = 10,
|
|
63
|
-
reducedTransparencyFallbackColor,
|
|
103
|
+
reducedTransparencyFallbackColor = '#FFFFFF',
|
|
64
104
|
style,
|
|
65
105
|
children,
|
|
106
|
+
type = 'blur',
|
|
107
|
+
glassType = 'clear',
|
|
108
|
+
glassTintColor = 'clear',
|
|
109
|
+
glassOpacity = 1.0,
|
|
110
|
+
isInteractive = true,
|
|
66
111
|
...props
|
|
67
112
|
}) => {
|
|
68
113
|
// If no children, render the blur view directly (for background use)
|
|
@@ -71,8 +116,13 @@ export const BlurView: React.FC<BlurViewProps> = ({
|
|
|
71
116
|
<ReactNativeBlurView
|
|
72
117
|
blurType={blurType}
|
|
73
118
|
blurAmount={blurAmount}
|
|
119
|
+
glassType={glassType}
|
|
120
|
+
glassTintColor={glassTintColor}
|
|
121
|
+
glassOpacity={glassOpacity}
|
|
122
|
+
type={type}
|
|
74
123
|
reducedTransparencyFallbackColor={reducedTransparencyFallbackColor}
|
|
75
124
|
style={style}
|
|
125
|
+
isInteractive={isInteractive}
|
|
76
126
|
{...props}
|
|
77
127
|
/>
|
|
78
128
|
);
|
|
@@ -85,6 +135,11 @@ export const BlurView: React.FC<BlurViewProps> = ({
|
|
|
85
135
|
<ReactNativeBlurView
|
|
86
136
|
blurType={blurType}
|
|
87
137
|
blurAmount={blurAmount}
|
|
138
|
+
glassType={glassType}
|
|
139
|
+
glassTintColor={glassTintColor}
|
|
140
|
+
glassOpacity={glassOpacity}
|
|
141
|
+
type={type}
|
|
142
|
+
isInteractive={isInteractive}
|
|
88
143
|
reducedTransparencyFallbackColor={reducedTransparencyFallbackColor}
|
|
89
144
|
style={{
|
|
90
145
|
position: 'absolute',
|
|
@@ -18,10 +18,17 @@ export type BlurType =
|
|
|
18
18
|
| 'systemThickMaterial'
|
|
19
19
|
| 'systemChromeMaterial';
|
|
20
20
|
|
|
21
|
+
export type GlassType = 'clear' | 'regular';
|
|
22
|
+
|
|
21
23
|
interface NativeProps extends ViewProps {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
24
|
+
glassTintColor?: WithDefault<string, 'clear'>;
|
|
25
|
+
glassOpacity?: WithDefault<Double, 1.0>;
|
|
26
|
+
blurAmount?: WithDefault<Double, 10.0>;
|
|
27
|
+
type?: WithDefault<'blur' | 'liquidGlass', 'blur'>;
|
|
28
|
+
blurType?: WithDefault<BlurType, 'xlight'>;
|
|
29
|
+
glassType?: WithDefault<GlassType, 'clear'>;
|
|
30
|
+
reducedTransparencyFallbackColor?: WithDefault<string, '#FFFFFF'>;
|
|
31
|
+
isInteractive?: WithDefault<boolean, true>;
|
|
25
32
|
}
|
|
26
33
|
|
|
27
34
|
export default codegenNativeComponent<NativeProps>('ReactNativeBlurView');
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
#import <React/RCTViewManager.h>
|
|
2
|
-
#import <React/RCTUIManager.h>
|
|
3
|
-
#import "RCTBridge.h"
|
|
4
|
-
#import "ReactNativeBlurView.h"
|
|
5
|
-
|
|
6
|
-
@interface ReactNativeBlurViewManager : RCTViewManager
|
|
7
|
-
@end
|
|
8
|
-
|
|
9
|
-
@implementation ReactNativeBlurViewManager
|
|
10
|
-
|
|
11
|
-
RCT_EXPORT_MODULE(ReactNativeBlurView)
|
|
12
|
-
|
|
13
|
-
- (UIView *)view
|
|
14
|
-
{
|
|
15
|
-
return [[ReactNativeBlurView alloc] init];
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
// Legacy view manager - properties are now handled by Fabric
|
|
19
|
-
RCT_EXPORT_VIEW_PROPERTY(blurType, NSString)
|
|
20
|
-
RCT_EXPORT_VIEW_PROPERTY(blurAmount, NSNumber)
|
|
21
|
-
RCT_EXPORT_VIEW_PROPERTY(reducedTransparencyFallbackColor, NSString)
|
|
22
|
-
|
|
23
|
-
@end
|