@sbaiahmed1/react-native-blur 3.1.2 → 4.0.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 +319 -308
- package/ReactNativeBlur.podspec +1 -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/java/com/facebook/react/viewmanagers/ReactNativeGlassViewManagerDelegate.java +38 -0
- package/android/app/build/generated/source/codegen/java/com/facebook/react/viewmanagers/ReactNativeGlassViewManagerInterface.java +20 -0
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/ReactNativeBlurViewSpec/ComponentDescriptors.cpp +1 -0
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/ReactNativeBlurViewSpec/ComponentDescriptors.h +1 -0
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/ReactNativeBlurViewSpec/EventEmitters.cpp +1 -0
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/ReactNativeBlurViewSpec/EventEmitters.h +7 -0
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/ReactNativeBlurViewSpec/Props.cpp +21 -2
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/ReactNativeBlurViewSpec/Props.h +70 -2
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/ReactNativeBlurViewSpec/ShadowNodes.cpp +1 -0
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/ReactNativeBlurViewSpec/ShadowNodes.h +11 -0
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/ReactNativeBlurViewSpec/States.h +12 -0
- package/android/build.gradle +2 -3
- package/android/src/main/java/com/sbaiahmed1/reactnativeblur/ReactNativeBlurView.kt +62 -269
- package/android/src/main/java/com/sbaiahmed1/reactnativeblur/ReactNativeBlurViewManager.kt +13 -8
- package/ios/Helpers/BlurStyleHelpers.swift +1 -1
- package/ios/Helpers/ReactNativeBlurViewHelper.swift +8 -32
- package/ios/Helpers/ReactNativeLiquidGlassViewHelper.swift +44 -0
- package/ios/ReactNativeBlurView.mm +28 -74
- package/ios/{ReactNativeBlurViewManager.m → ReactNativeBlurViewManager.mm} +15 -39
- package/ios/ReactNativeLiquidGlassView.h +14 -0
- package/ios/ReactNativeLiquidGlassView.mm +284 -0
- package/ios/ReactNativeLiquidGlassViewManager.h +6 -0
- package/ios/ReactNativeLiquidGlassViewManager.mm +20 -0
- package/ios/Views/AdvancedBlurView.swift +6 -34
- package/ios/Views/BasicColoredView.swift +37 -44
- package/ios/Views/LiquidGlassContainerView.swift +173 -0
- package/lib/module/BlurView.js +17 -31
- package/lib/module/BlurView.js.map +1 -1
- package/lib/module/LiquidGlassView.js +75 -0
- package/lib/module/LiquidGlassView.js.map +1 -0
- package/lib/module/ReactNativeBlurViewNativeComponent.ts +1 -7
- package/lib/module/ReactNativeLiquidGlassViewNativeComponent.ts +57 -0
- package/lib/module/index.js +2 -0
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/src/BlurView.d.ts +19 -39
- package/lib/typescript/src/BlurView.d.ts.map +1 -1
- package/lib/typescript/src/LiquidGlassView.d.ts +85 -0
- package/lib/typescript/src/LiquidGlassView.d.ts.map +1 -0
- package/lib/typescript/src/ReactNativeBlurViewNativeComponent.d.ts +1 -6
- package/lib/typescript/src/ReactNativeBlurViewNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/ReactNativeLiquidGlassViewNativeComponent.d.ts +44 -0
- package/lib/typescript/src/ReactNativeLiquidGlassViewNativeComponent.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 +6 -3
- package/src/BlurView.tsx +37 -68
- package/src/LiquidGlassView.tsx +138 -0
- package/src/ReactNativeBlurViewNativeComponent.ts +1 -7
- package/src/ReactNativeLiquidGlassViewNativeComponent.ts +57 -0
- package/src/index.tsx +6 -0
|
@@ -1,65 +1,45 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { ViewStyle, StyleProp } from 'react-native';
|
|
3
3
|
import { type BlurType } from './ReactNativeBlurViewNativeComponent';
|
|
4
|
-
import type { GlassType } from '../src/ReactNativeBlurViewNativeComponent';
|
|
5
4
|
export interface BlurViewProps {
|
|
6
5
|
/**
|
|
7
|
-
* The type of blur effect to apply
|
|
6
|
+
* @description The type of blur effect to apply
|
|
7
|
+
*
|
|
8
8
|
* @default 'xlight'
|
|
9
9
|
*/
|
|
10
10
|
blurType?: BlurType;
|
|
11
11
|
/**
|
|
12
|
-
* The intensity of the blur effect (0-100)
|
|
12
|
+
* @description The intensity of the blur effect (0-100)
|
|
13
|
+
*
|
|
13
14
|
* @default 10
|
|
14
15
|
*/
|
|
15
16
|
blurAmount?: number;
|
|
16
17
|
/**
|
|
17
|
-
* Fallback color when reduced transparency is enabled
|
|
18
|
-
*
|
|
18
|
+
* @description Fallback color when reduced transparency is enabled
|
|
19
|
+
*
|
|
20
|
+
* Accepts hex color strings like `#FFFFFF`
|
|
21
|
+
*
|
|
19
22
|
* @default '#FFFFFF'
|
|
20
23
|
*/
|
|
21
24
|
reducedTransparencyFallbackColor?: string;
|
|
22
25
|
/**
|
|
23
|
-
*
|
|
26
|
+
* @description style object for the blur view
|
|
27
|
+
*
|
|
28
|
+
* @default undefined
|
|
24
29
|
*/
|
|
25
30
|
style?: StyleProp<ViewStyle>;
|
|
26
31
|
/**
|
|
27
|
-
*
|
|
32
|
+
* @description style object for the blur view
|
|
33
|
+
*
|
|
34
|
+
* @default false
|
|
28
35
|
*/
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Platform: iOS only
|
|
32
|
-
* The type of glass effect to apply
|
|
33
|
-
* @default 'clear'
|
|
34
|
-
*/
|
|
35
|
-
glassType?: GlassType;
|
|
36
|
-
/**
|
|
37
|
-
* Platform: iOS only
|
|
38
|
-
* The tint color of the glass effect
|
|
39
|
-
* accepts hex color strings like '#FFFFFF'
|
|
40
|
-
* accepts color names like 'white', 'clear', 'black', 'red', 'green', 'blue', 'yellow', 'cyan', 'magenta'
|
|
41
|
-
* @default 'clear'
|
|
42
|
-
*/
|
|
43
|
-
glassTintColor?: string;
|
|
36
|
+
ignoreSafeArea?: boolean;
|
|
44
37
|
/**
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
* @default
|
|
38
|
+
* @description Child components to render inside the blur view
|
|
39
|
+
*
|
|
40
|
+
* @default undefined
|
|
48
41
|
*/
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* The type of blur effect to apply
|
|
52
|
-
* liquidGlass = iOS Only
|
|
53
|
-
* blur = Android | iOS
|
|
54
|
-
* @default 'blur'
|
|
55
|
-
*/
|
|
56
|
-
type?: 'blur' | 'liquidGlass';
|
|
57
|
-
/**
|
|
58
|
-
* Platform: iOS only
|
|
59
|
-
* Whether the blur view should be interactive
|
|
60
|
-
* @default true
|
|
61
|
-
*/
|
|
62
|
-
isInteractive?: boolean;
|
|
42
|
+
children?: React.ReactNode;
|
|
63
43
|
}
|
|
64
44
|
/**
|
|
65
45
|
* A cross-platform blur view component that provides native blur effects.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BlurView.d.ts","sourceRoot":"","sources":["../../../src/BlurView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzD,OAA4B,EAC1B,KAAK,QAAQ,EACd,MAAM,sCAAsC,CAAC;
|
|
1
|
+
{"version":3,"file":"BlurView.d.ts","sourceRoot":"","sources":["../../../src/BlurView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzD,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,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,CAuC5C,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ViewStyle, StyleProp } from 'react-native';
|
|
3
|
+
import { type GlassType } from './ReactNativeLiquidGlassViewNativeComponent';
|
|
4
|
+
export interface LiquidGlassViewProps {
|
|
5
|
+
/**
|
|
6
|
+
* The type of glass effect to apply
|
|
7
|
+
* Platform: iOS 26+ only
|
|
8
|
+
* @default 'clear'
|
|
9
|
+
*/
|
|
10
|
+
glassType?: GlassType /**
|
|
11
|
+
* The tint color of the glass effect
|
|
12
|
+
* Accepts hex color strings like '#FFFFFF' or color names
|
|
13
|
+
* Platform: iOS 26+ only
|
|
14
|
+
* @default 'clear'
|
|
15
|
+
*/;
|
|
16
|
+
glassTintColor?: string;
|
|
17
|
+
/**
|
|
18
|
+
* The opacity of the glass effect (0-1)
|
|
19
|
+
* Platform: iOS 26+ only
|
|
20
|
+
* @default 1.0
|
|
21
|
+
*/
|
|
22
|
+
glassOpacity?: number;
|
|
23
|
+
/**
|
|
24
|
+
* Fallback color when reduced transparency is enabled or on older iOS versions
|
|
25
|
+
* Accepts hex color strings like '#FFFFFF'
|
|
26
|
+
* Platform: iOS only
|
|
27
|
+
* @default '#FFFFFF'
|
|
28
|
+
*/
|
|
29
|
+
reducedTransparencyFallbackColor?: string;
|
|
30
|
+
/**
|
|
31
|
+
* Whether the glass view should be interactive
|
|
32
|
+
* Platform: iOS 26+ only
|
|
33
|
+
* @default true
|
|
34
|
+
*/
|
|
35
|
+
isInteractive?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Whether the glass view should ignore safe area insets
|
|
38
|
+
* Platform: iOS 26+ only
|
|
39
|
+
* @default false
|
|
40
|
+
*/
|
|
41
|
+
ignoreSafeArea?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Style object for the liquid glass view
|
|
44
|
+
*/
|
|
45
|
+
style?: StyleProp<ViewStyle>;
|
|
46
|
+
/**
|
|
47
|
+
* Child components to render inside the liquid glass view
|
|
48
|
+
*/
|
|
49
|
+
children?: React.ReactNode;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* A Liquid Glass view component that provides iOS 26+ glass effects.
|
|
53
|
+
*
|
|
54
|
+
* This component uses the new UIKit glass effect API available on iOS 26+.
|
|
55
|
+
* On older iOS versions or when reduced transparency is enabled, it falls back
|
|
56
|
+
* to a solid color background.
|
|
57
|
+
*
|
|
58
|
+
* **Platform Support:**
|
|
59
|
+
* - iOS 26+: Native glass effect with full functionality
|
|
60
|
+
* - iOS < 26 or Android: Fallback to reducedTransparencyFallbackColor
|
|
61
|
+
*
|
|
62
|
+
* This component automatically handles the proper positioning pattern where the glass
|
|
63
|
+
* effect is positioned absolutely behind the content, ensuring interactive elements
|
|
64
|
+
* work correctly.
|
|
65
|
+
*
|
|
66
|
+
* @example
|
|
67
|
+
* ```tsx
|
|
68
|
+
* import { LiquidGlassView } from '@sbaiahmed1/react-native-blur';
|
|
69
|
+
*
|
|
70
|
+
* <LiquidGlassView
|
|
71
|
+
* glassType="clear"
|
|
72
|
+
* glassTintColor="#007AFF"
|
|
73
|
+
* glassOpacity={0.8}
|
|
74
|
+
* style={{ flex: 1 }}
|
|
75
|
+
* >
|
|
76
|
+
* <Text>Content on top of liquid glass</Text>
|
|
77
|
+
* <Button title="Interactive Button" onPress={() => {}} />
|
|
78
|
+
* </LiquidGlassView>
|
|
79
|
+
* ```
|
|
80
|
+
*
|
|
81
|
+
* @platform ios
|
|
82
|
+
*/
|
|
83
|
+
export declare const LiquidGlassView: React.FC<LiquidGlassViewProps>;
|
|
84
|
+
export default LiquidGlassView;
|
|
85
|
+
//# sourceMappingURL=LiquidGlassView.d.ts.map
|
|
@@ -0,0 +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;;;;OAIG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC;;;;;OAKnB,CAAC;IACJ,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;;;;OAKG;IACH,gCAAgC,CAAC,EAAE,MAAM,CAAC;IAE1C;;;;OAIG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IAExB;;;;OAIG;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,CAyC1D,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
|
@@ -1,16 +1,11 @@
|
|
|
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';
|
|
4
|
-
export type GlassType = 'clear' | 'regular';
|
|
5
4
|
interface NativeProps extends ViewProps {
|
|
6
|
-
glassTintColor?: WithDefault<string, 'clear'>;
|
|
7
|
-
glassOpacity?: WithDefault<Double, 1.0>;
|
|
8
5
|
blurAmount?: WithDefault<Double, 10.0>;
|
|
9
|
-
type?: WithDefault<'blur' | 'liquidGlass', 'blur'>;
|
|
10
6
|
blurType?: WithDefault<BlurType, 'xlight'>;
|
|
11
|
-
glassType?: WithDefault<GlassType, 'clear'>;
|
|
12
7
|
reducedTransparencyFallbackColor?: WithDefault<string, '#FFFFFF'>;
|
|
13
|
-
|
|
8
|
+
ignoreSafeArea?: WithDefault<boolean, false>;
|
|
14
9
|
}
|
|
15
10
|
declare const _default: import("react-native/Libraries/Utilities/codegenNativeComponent").NativeComponentType<NativeProps>;
|
|
16
11
|
export default _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReactNativeBlurViewNativeComponent.d.ts","sourceRoot":"","sources":["../../../src/ReactNativeBlurViewNativeComponent.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,CAAC;AAE3B,
|
|
1
|
+
{"version":3,"file":"ReactNativeBlurViewNativeComponent.d.ts","sourceRoot":"","sources":["../../../src/ReactNativeBlurViewNativeComponent.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,CAAC;AAE3B,UAAU,WAAY,SAAQ,SAAS;IACrC,UAAU,CAAC,EAAE,WAAW,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IACvC,QAAQ,CAAC,EAAE,WAAW,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IAC3C,gCAAgC,CAAC,EAAE,WAAW,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IAClE,cAAc,CAAC,EAAE,WAAW,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;CAC9C;;AAED,wBAA0E"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { ViewProps } from 'react-native';
|
|
2
|
+
import type { WithDefault, Double } from 'react-native/Libraries/Types/CodegenTypes';
|
|
3
|
+
export type GlassType = 'clear' | 'regular';
|
|
4
|
+
interface NativeProps extends ViewProps {
|
|
5
|
+
/**
|
|
6
|
+
* The type of glass effect to apply
|
|
7
|
+
* Platform: iOS only
|
|
8
|
+
* @default 'clear'
|
|
9
|
+
*/
|
|
10
|
+
glassType?: WithDefault<GlassType, 'clear'>;
|
|
11
|
+
/**
|
|
12
|
+
* The tint color of the glass effect
|
|
13
|
+
* Platform: iOS only
|
|
14
|
+
* @default 'clear'
|
|
15
|
+
*/
|
|
16
|
+
glassTintColor?: WithDefault<string, 'clear'>;
|
|
17
|
+
/**
|
|
18
|
+
* The opacity of the glass effect (0-1)
|
|
19
|
+
* Platform: iOS only
|
|
20
|
+
* @default 1.0
|
|
21
|
+
*/
|
|
22
|
+
glassOpacity?: WithDefault<Double, 1.0>;
|
|
23
|
+
/**
|
|
24
|
+
* Fallback color when reduced transparency is enabled
|
|
25
|
+
* Platform: iOS only
|
|
26
|
+
* @default '#FFFFFF'
|
|
27
|
+
*/
|
|
28
|
+
reducedTransparencyFallbackColor?: WithDefault<string, '#FFFFFF'>;
|
|
29
|
+
/**
|
|
30
|
+
* Whether the glass view should be interactive
|
|
31
|
+
* Platform: iOS only
|
|
32
|
+
* @default true
|
|
33
|
+
*/
|
|
34
|
+
isInteractive?: WithDefault<boolean, true>;
|
|
35
|
+
/**
|
|
36
|
+
* Whether the glass view should ignore safe area insets
|
|
37
|
+
* Platform: iOS only
|
|
38
|
+
* @default false
|
|
39
|
+
*/
|
|
40
|
+
ignoreSafeArea?: WithDefault<boolean, false>;
|
|
41
|
+
}
|
|
42
|
+
declare const _default: import("react-native/Libraries/Utilities/codegenNativeComponent").NativeComponentType<NativeProps>;
|
|
43
|
+
export default _default;
|
|
44
|
+
//# sourceMappingURL=ReactNativeLiquidGlassViewNativeComponent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ReactNativeLiquidGlassViewNativeComponent.d.ts","sourceRoot":"","sources":["../../../src/ReactNativeLiquidGlassViewNativeComponent.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,SAAS,GAAG,OAAO,GAAG,SAAS,CAAC;AAE5C,UAAU,WAAY,SAAQ,SAAS;IACrC;;;;OAIG;IACH,SAAS,CAAC,EAAE,WAAW,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IAE5C;;;;OAIG;IACH,cAAc,CAAC,EAAE,WAAW,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAE9C;;;;OAIG;IACH,YAAY,CAAC,EAAE,WAAW,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAExC;;;;OAIG;IACH,gCAAgC,CAAC,EAAE,WAAW,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IAElE;;;;OAIG;IACH,aAAa,CAAC,EAAE,WAAW,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IAE3C;;;;OAIG;IACH,cAAc,CAAC,EAAE,WAAW,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;CAC9C;;AAED,wBAGE"}
|
|
@@ -2,4 +2,8 @@ export { default as ReactNativeBlurView } from './ReactNativeBlurViewNativeCompo
|
|
|
2
2
|
export * from './ReactNativeBlurViewNativeComponent';
|
|
3
3
|
export { BlurView as default, BlurView } from './BlurView';
|
|
4
4
|
export type { BlurViewProps } from './BlurView';
|
|
5
|
+
export { default as ReactNativeLiquidGlassView } from './ReactNativeLiquidGlassViewNativeComponent';
|
|
6
|
+
export type { GlassType } from './ReactNativeLiquidGlassViewNativeComponent';
|
|
7
|
+
export { LiquidGlassView } from './LiquidGlassView';
|
|
8
|
+
export type { LiquidGlassViewProps } from './LiquidGlassView';
|
|
5
9
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AACtF,cAAc,sCAAsC,CAAC;AAErD,OAAO,EAAE,QAAQ,IAAI,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC3D,YAAY,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AACtF,cAAc,sCAAsC,CAAC;AAErD,OAAO,EAAE,QAAQ,IAAI,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC3D,YAAY,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEhD,OAAO,EAAE,OAAO,IAAI,0BAA0B,EAAE,MAAM,6CAA6C,CAAC;AACpG,YAAY,EAAE,SAAS,EAAE,MAAM,6CAA6C,CAAC;AAE7E,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,YAAY,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sbaiahmed1/react-native-blur",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.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",
|
|
@@ -38,7 +38,9 @@
|
|
|
38
38
|
"lint": "eslint \"**/*.{js,ts,tsx}\"",
|
|
39
39
|
"clean": "del-cli android/build example/android/build example/android/app/build example/ios/build lib",
|
|
40
40
|
"prepare": "bob build",
|
|
41
|
-
"release": "release-it"
|
|
41
|
+
"release": "release-it",
|
|
42
|
+
"setup": "yarn && yarn prepare",
|
|
43
|
+
"setup:example": "yarn setup && cd example && yarn && cd ios && pod install && cd .. && yarn start --client-logs"
|
|
42
44
|
},
|
|
43
45
|
"keywords": [
|
|
44
46
|
"react-native",
|
|
@@ -162,7 +164,8 @@
|
|
|
162
164
|
},
|
|
163
165
|
"ios": {
|
|
164
166
|
"componentProvider": {
|
|
165
|
-
"ReactNativeBlurView": "ReactNativeBlurView"
|
|
167
|
+
"ReactNativeBlurView": "ReactNativeBlurView",
|
|
168
|
+
"ReactNativeLiquidGlassView": "ReactNativeLiquidGlassView"
|
|
166
169
|
}
|
|
167
170
|
}
|
|
168
171
|
},
|
package/src/BlurView.tsx
CHANGED
|
@@ -1,78 +1,54 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { View } from 'react-native';
|
|
2
|
+
import { StyleSheet, View } from 'react-native';
|
|
3
3
|
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';
|
|
8
7
|
|
|
9
8
|
export interface BlurViewProps {
|
|
10
9
|
/**
|
|
11
|
-
* The type of blur effect to apply
|
|
10
|
+
* @description The type of blur effect to apply
|
|
11
|
+
*
|
|
12
12
|
* @default 'xlight'
|
|
13
13
|
*/
|
|
14
14
|
blurType?: BlurType;
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
|
-
* The intensity of the blur effect (0-100)
|
|
17
|
+
* @description The intensity of the blur effect (0-100)
|
|
18
|
+
*
|
|
18
19
|
* @default 10
|
|
19
20
|
*/
|
|
20
21
|
blurAmount?: number;
|
|
21
22
|
|
|
22
23
|
/**
|
|
23
|
-
* Fallback color when reduced transparency is enabled
|
|
24
|
-
*
|
|
24
|
+
* @description Fallback color when reduced transparency is enabled
|
|
25
|
+
*
|
|
26
|
+
* Accepts hex color strings like `#FFFFFF`
|
|
27
|
+
*
|
|
25
28
|
* @default '#FFFFFF'
|
|
26
29
|
*/
|
|
27
30
|
reducedTransparencyFallbackColor?: string;
|
|
28
31
|
|
|
29
32
|
/**
|
|
30
|
-
*
|
|
33
|
+
* @description style object for the blur view
|
|
34
|
+
*
|
|
35
|
+
* @default undefined
|
|
31
36
|
*/
|
|
32
37
|
style?: StyleProp<ViewStyle>;
|
|
33
38
|
|
|
34
39
|
/**
|
|
35
|
-
*
|
|
40
|
+
* @description style object for the blur view
|
|
41
|
+
*
|
|
42
|
+
* @default false
|
|
36
43
|
*/
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Platform: iOS only
|
|
41
|
-
* The type of glass effect to apply
|
|
42
|
-
* @default 'clear'
|
|
43
|
-
*/
|
|
44
|
-
glassType?: GlassType;
|
|
44
|
+
ignoreSafeArea?: boolean;
|
|
45
45
|
|
|
46
46
|
/**
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
* accepts color names like 'white', 'clear', 'black', 'red', 'green', 'blue', 'yellow', 'cyan', 'magenta'
|
|
51
|
-
* @default 'clear'
|
|
47
|
+
* @description Child components to render inside the blur view
|
|
48
|
+
*
|
|
49
|
+
* @default undefined
|
|
52
50
|
*/
|
|
53
|
-
|
|
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;
|
|
51
|
+
children?: React.ReactNode;
|
|
76
52
|
}
|
|
77
53
|
|
|
78
54
|
/**
|
|
@@ -103,26 +79,18 @@ export const BlurView: React.FC<BlurViewProps> = ({
|
|
|
103
79
|
reducedTransparencyFallbackColor = '#FFFFFF',
|
|
104
80
|
style,
|
|
105
81
|
children,
|
|
106
|
-
|
|
107
|
-
glassType = 'clear',
|
|
108
|
-
glassTintColor = 'clear',
|
|
109
|
-
glassOpacity = 1.0,
|
|
110
|
-
isInteractive = true,
|
|
82
|
+
ignoreSafeArea = false,
|
|
111
83
|
...props
|
|
112
84
|
}) => {
|
|
113
85
|
// If no children, render the blur view directly (for background use)
|
|
114
86
|
if (React.Children.count(children) === 0) {
|
|
115
87
|
return (
|
|
116
88
|
<ReactNativeBlurView
|
|
89
|
+
ignoreSafeArea={ignoreSafeArea}
|
|
117
90
|
blurType={blurType}
|
|
118
91
|
blurAmount={blurAmount}
|
|
119
|
-
glassType={glassType}
|
|
120
|
-
glassTintColor={glassTintColor}
|
|
121
|
-
glassOpacity={glassOpacity}
|
|
122
|
-
type={type}
|
|
123
92
|
reducedTransparencyFallbackColor={reducedTransparencyFallbackColor}
|
|
124
93
|
style={style}
|
|
125
|
-
isInteractive={isInteractive}
|
|
126
94
|
{...props}
|
|
127
95
|
/>
|
|
128
96
|
);
|
|
@@ -130,30 +98,31 @@ export const BlurView: React.FC<BlurViewProps> = ({
|
|
|
130
98
|
|
|
131
99
|
// If children exist, use the absolute positioning pattern
|
|
132
100
|
return (
|
|
133
|
-
<View style={[
|
|
101
|
+
<View style={[styles.container, style]}>
|
|
134
102
|
{/* Blur effect positioned absolutely behind content */}
|
|
135
103
|
<ReactNativeBlurView
|
|
104
|
+
ignoreSafeArea={ignoreSafeArea}
|
|
136
105
|
blurType={blurType}
|
|
137
106
|
blurAmount={blurAmount}
|
|
138
|
-
glassType={glassType}
|
|
139
|
-
glassTintColor={glassTintColor}
|
|
140
|
-
glassOpacity={glassOpacity}
|
|
141
|
-
type={type}
|
|
142
|
-
isInteractive={isInteractive}
|
|
143
107
|
reducedTransparencyFallbackColor={reducedTransparencyFallbackColor}
|
|
144
|
-
style={
|
|
145
|
-
position: 'absolute',
|
|
146
|
-
top: 0,
|
|
147
|
-
left: 0,
|
|
148
|
-
right: 0,
|
|
149
|
-
bottom: 0,
|
|
150
|
-
}}
|
|
108
|
+
style={StyleSheet.absoluteFill}
|
|
151
109
|
{...props}
|
|
152
110
|
/>
|
|
153
111
|
{/* Content positioned relatively on top */}
|
|
154
|
-
<View style={
|
|
112
|
+
<View style={styles.children}>{children}</View>
|
|
155
113
|
</View>
|
|
156
114
|
);
|
|
157
115
|
};
|
|
158
116
|
|
|
159
117
|
export default BlurView;
|
|
118
|
+
|
|
119
|
+
const styles = StyleSheet.create({
|
|
120
|
+
container: {
|
|
121
|
+
position: 'relative',
|
|
122
|
+
overflow: 'hidden',
|
|
123
|
+
},
|
|
124
|
+
children: {
|
|
125
|
+
position: 'relative',
|
|
126
|
+
zIndex: 1,
|
|
127
|
+
},
|
|
128
|
+
});
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Platform } from 'react-native';
|
|
3
|
+
import type { ViewStyle, StyleProp } from 'react-native';
|
|
4
|
+
import ReactNativeLiquidGlassView, {
|
|
5
|
+
type GlassType,
|
|
6
|
+
} from './ReactNativeLiquidGlassViewNativeComponent';
|
|
7
|
+
import BlurView from './BlurView';
|
|
8
|
+
|
|
9
|
+
export interface LiquidGlassViewProps {
|
|
10
|
+
/**
|
|
11
|
+
* The type of glass effect to apply
|
|
12
|
+
* Platform: iOS 26+ only
|
|
13
|
+
* @default 'clear'
|
|
14
|
+
*/
|
|
15
|
+
glassType?: GlassType /**
|
|
16
|
+
* The tint color of the glass effect
|
|
17
|
+
* Accepts hex color strings like '#FFFFFF' or color names
|
|
18
|
+
* Platform: iOS 26+ only
|
|
19
|
+
* @default 'clear'
|
|
20
|
+
*/;
|
|
21
|
+
glassTintColor?: string;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* The opacity of the glass effect (0-1)
|
|
25
|
+
* Platform: iOS 26+ only
|
|
26
|
+
* @default 1.0
|
|
27
|
+
*/
|
|
28
|
+
glassOpacity?: number;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Fallback color when reduced transparency is enabled or on older iOS versions
|
|
32
|
+
* Accepts hex color strings like '#FFFFFF'
|
|
33
|
+
* Platform: iOS only
|
|
34
|
+
* @default '#FFFFFF'
|
|
35
|
+
*/
|
|
36
|
+
reducedTransparencyFallbackColor?: string;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Whether the glass view should be interactive
|
|
40
|
+
* Platform: iOS 26+ only
|
|
41
|
+
* @default true
|
|
42
|
+
*/
|
|
43
|
+
isInteractive?: boolean;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Whether the glass view should ignore safe area insets
|
|
47
|
+
* Platform: iOS 26+ only
|
|
48
|
+
* @default false
|
|
49
|
+
*/
|
|
50
|
+
ignoreSafeArea?: boolean;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Style object for the liquid glass view
|
|
54
|
+
*/
|
|
55
|
+
style?: StyleProp<ViewStyle>;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Child components to render inside the liquid glass view
|
|
59
|
+
*/
|
|
60
|
+
children?: React.ReactNode;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* A Liquid Glass view component that provides iOS 26+ glass effects.
|
|
65
|
+
*
|
|
66
|
+
* This component uses the new UIKit glass effect API available on iOS 26+.
|
|
67
|
+
* On older iOS versions or when reduced transparency is enabled, it falls back
|
|
68
|
+
* to a solid color background.
|
|
69
|
+
*
|
|
70
|
+
* **Platform Support:**
|
|
71
|
+
* - iOS 26+: Native glass effect with full functionality
|
|
72
|
+
* - iOS < 26 or Android: Fallback to reducedTransparencyFallbackColor
|
|
73
|
+
*
|
|
74
|
+
* This component automatically handles the proper positioning pattern where the glass
|
|
75
|
+
* effect is positioned absolutely behind the content, ensuring interactive elements
|
|
76
|
+
* work correctly.
|
|
77
|
+
*
|
|
78
|
+
* @example
|
|
79
|
+
* ```tsx
|
|
80
|
+
* import { LiquidGlassView } from '@sbaiahmed1/react-native-blur';
|
|
81
|
+
*
|
|
82
|
+
* <LiquidGlassView
|
|
83
|
+
* glassType="clear"
|
|
84
|
+
* glassTintColor="#007AFF"
|
|
85
|
+
* glassOpacity={0.8}
|
|
86
|
+
* style={{ flex: 1 }}
|
|
87
|
+
* >
|
|
88
|
+
* <Text>Content on top of liquid glass</Text>
|
|
89
|
+
* <Button title="Interactive Button" onPress={() => {}} />
|
|
90
|
+
* </LiquidGlassView>
|
|
91
|
+
* ```
|
|
92
|
+
*
|
|
93
|
+
* @platform ios
|
|
94
|
+
*/
|
|
95
|
+
export const LiquidGlassView: React.FC<LiquidGlassViewProps> = ({
|
|
96
|
+
glassType = 'clear',
|
|
97
|
+
glassTintColor = 'clear',
|
|
98
|
+
glassOpacity = 1.0,
|
|
99
|
+
reducedTransparencyFallbackColor = '#FFFFFF',
|
|
100
|
+
isInteractive = true,
|
|
101
|
+
ignoreSafeArea = false,
|
|
102
|
+
style,
|
|
103
|
+
children,
|
|
104
|
+
...props
|
|
105
|
+
}) => {
|
|
106
|
+
// Only render on iOS 26+ (fallback otherwise)
|
|
107
|
+
if (
|
|
108
|
+
Platform.OS !== 'ios' ||
|
|
109
|
+
(Platform.OS === 'ios' && parseInt(Platform.Version, 10) < 26)
|
|
110
|
+
) {
|
|
111
|
+
console.warn(
|
|
112
|
+
'LiquidGlassView is only supported on iOS. Rendering children without glass effect.'
|
|
113
|
+
);
|
|
114
|
+
return (
|
|
115
|
+
<BlurView blurAmount={70} style={style}>
|
|
116
|
+
{children}
|
|
117
|
+
</BlurView>
|
|
118
|
+
);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
// If children exist, use the absolute positioning pattern
|
|
122
|
+
return (
|
|
123
|
+
<ReactNativeLiquidGlassView
|
|
124
|
+
glassType={glassType}
|
|
125
|
+
glassTintColor={glassTintColor}
|
|
126
|
+
glassOpacity={glassOpacity}
|
|
127
|
+
reducedTransparencyFallbackColor={reducedTransparencyFallbackColor}
|
|
128
|
+
isInteractive={isInteractive}
|
|
129
|
+
ignoreSafeArea={ignoreSafeArea}
|
|
130
|
+
style={style}
|
|
131
|
+
{...props}
|
|
132
|
+
>
|
|
133
|
+
{children}
|
|
134
|
+
</ReactNativeLiquidGlassView>
|
|
135
|
+
);
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
export default LiquidGlassView;
|
|
@@ -18,17 +18,11 @@ export type BlurType =
|
|
|
18
18
|
| 'systemThickMaterial'
|
|
19
19
|
| 'systemChromeMaterial';
|
|
20
20
|
|
|
21
|
-
export type GlassType = 'clear' | 'regular';
|
|
22
|
-
|
|
23
21
|
interface NativeProps extends ViewProps {
|
|
24
|
-
glassTintColor?: WithDefault<string, 'clear'>;
|
|
25
|
-
glassOpacity?: WithDefault<Double, 1.0>;
|
|
26
22
|
blurAmount?: WithDefault<Double, 10.0>;
|
|
27
|
-
type?: WithDefault<'blur' | 'liquidGlass', 'blur'>;
|
|
28
23
|
blurType?: WithDefault<BlurType, 'xlight'>;
|
|
29
|
-
glassType?: WithDefault<GlassType, 'clear'>;
|
|
30
24
|
reducedTransparencyFallbackColor?: WithDefault<string, '#FFFFFF'>;
|
|
31
|
-
|
|
25
|
+
ignoreSafeArea?: WithDefault<boolean, false>;
|
|
32
26
|
}
|
|
33
27
|
|
|
34
28
|
export default codegenNativeComponent<NativeProps>('ReactNativeBlurView');
|