@sbaiahmed1/react-native-blur 0.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/LICENSE +20 -0
- package/README.md +222 -0
- package/ReactNativeBlur.podspec +20 -0
- package/android/app/build/generated/source/codegen/java/com/facebook/react/viewmanagers/ReactNativeBlurViewManagerDelegate.java +38 -0
- package/android/app/build/generated/source/codegen/java/com/facebook/react/viewmanagers/ReactNativeBlurViewManagerInterface.java +20 -0
- package/android/app/build/generated/source/codegen/jni/CMakeLists.txt +36 -0
- package/android/app/build/generated/source/codegen/jni/ReactNativeBlurViewSpec-generated.cpp +22 -0
- package/android/app/build/generated/source/codegen/jni/ReactNativeBlurViewSpec.h +24 -0
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/ReactNativeBlurViewSpec/ComponentDescriptors.cpp +22 -0
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/ReactNativeBlurViewSpec/ComponentDescriptors.h +24 -0
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/ReactNativeBlurViewSpec/EventEmitters.cpp +16 -0
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/ReactNativeBlurViewSpec/EventEmitters.h +23 -0
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/ReactNativeBlurViewSpec/Props.cpp +27 -0
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/ReactNativeBlurViewSpec/Props.h +63 -0
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/ReactNativeBlurViewSpec/ReactNativeBlurViewSpecJSI-generated.cpp +17 -0
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/ReactNativeBlurViewSpec/ReactNativeBlurViewSpecJSI.h +19 -0
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/ReactNativeBlurViewSpec/ShadowNodes.cpp +17 -0
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/ReactNativeBlurViewSpec/ShadowNodes.h +32 -0
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/ReactNativeBlurViewSpec/States.cpp +16 -0
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/ReactNativeBlurViewSpec/States.h +29 -0
- package/android/build.gradle +85 -0
- package/android/gradle.properties +5 -0
- package/android/src/main/AndroidManifest.xml +2 -0
- package/android/src/main/java/com/sbaiahmed1/reactnativeblur/ReactNativeBlurPackage.kt +19 -0
- package/android/src/main/java/com/sbaiahmed1/reactnativeblur/ReactNativeBlurView.kt +369 -0
- package/android/src/main/java/com/sbaiahmed1/reactnativeblur/ReactNativeBlurViewManager.kt +50 -0
- package/ios/ReactNativeBlurView.h +14 -0
- package/ios/ReactNativeBlurView.mm +311 -0
- package/ios/ReactNativeBlurViewManager.mm +23 -0
- package/lib/module/BlurView.js +41 -0
- package/lib/module/BlurView.js.map +1 -0
- package/lib/module/ReactNativeBlurViewNativeComponent.ts +27 -0
- package/lib/module/index.js +6 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/BlurView.d.ts +48 -0
- package/lib/typescript/src/BlurView.d.ts.map +1 -0
- package/lib/typescript/src/ReactNativeBlurViewNativeComponent.d.ts +11 -0
- package/lib/typescript/src/ReactNativeBlurViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +5 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/package.json +170 -0
- package/src/BlurView.tsx +75 -0
- package/src/ReactNativeBlurViewNativeComponent.ts +27 -0
- package/src/index.tsx +5 -0
package/src/BlurView.tsx
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ViewStyle, StyleProp } from 'react-native';
|
|
3
|
+
import ReactNativeBlurView, {
|
|
4
|
+
type BlurType,
|
|
5
|
+
} from './ReactNativeBlurViewNativeComponent';
|
|
6
|
+
|
|
7
|
+
export interface BlurViewProps {
|
|
8
|
+
/**
|
|
9
|
+
* The type of blur effect to apply
|
|
10
|
+
* @default 'light'
|
|
11
|
+
*/
|
|
12
|
+
blurType?: BlurType;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* The intensity of the blur effect (0-100)
|
|
16
|
+
* @default 10
|
|
17
|
+
*/
|
|
18
|
+
blurAmount?: number;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Fallback color when reduced transparency is enabled
|
|
22
|
+
* Accepts hex color strings like '#FFFFFF'
|
|
23
|
+
*/
|
|
24
|
+
reducedTransparencyFallbackColor?: string;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Style object for the blur view
|
|
28
|
+
*/
|
|
29
|
+
style?: StyleProp<ViewStyle>;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Child components to render inside the blur view
|
|
33
|
+
*/
|
|
34
|
+
children?: React.ReactNode;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* A cross-platform blur view component that provides native blur effects.
|
|
39
|
+
*
|
|
40
|
+
* On iOS, this uses UIVisualEffectView for true blur effects.
|
|
41
|
+
* On Android, this uses the BlurView library for hardware-accelerated blur effects.
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* ```tsx
|
|
45
|
+
* <BlurView
|
|
46
|
+
* blurType="light"
|
|
47
|
+
* blurAmount={20}
|
|
48
|
+
* style={{ flex: 1 }}
|
|
49
|
+
* >
|
|
50
|
+
* <Text>Content behind blur</Text>
|
|
51
|
+
* </BlurView>
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
54
|
+
export const BlurView: React.FC<BlurViewProps> = ({
|
|
55
|
+
blurType = 'light',
|
|
56
|
+
blurAmount = 10,
|
|
57
|
+
reducedTransparencyFallbackColor,
|
|
58
|
+
style,
|
|
59
|
+
children,
|
|
60
|
+
...props
|
|
61
|
+
}) => {
|
|
62
|
+
return (
|
|
63
|
+
<ReactNativeBlurView
|
|
64
|
+
blurType={blurType}
|
|
65
|
+
blurAmount={blurAmount}
|
|
66
|
+
reducedTransparencyFallbackColor={reducedTransparencyFallbackColor}
|
|
67
|
+
style={style}
|
|
68
|
+
{...props}
|
|
69
|
+
>
|
|
70
|
+
{children}
|
|
71
|
+
</ReactNativeBlurView>
|
|
72
|
+
);
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
export default BlurView;
|
|
@@ -0,0 +1,27 @@
|
|
|
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
|
+
|
|
21
|
+
interface NativeProps extends ViewProps {
|
|
22
|
+
blurType?: WithDefault<BlurType, 'light'>;
|
|
23
|
+
blurAmount?: WithDefault<Double, 10>;
|
|
24
|
+
reducedTransparencyFallbackColor?: string;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export default codegenNativeComponent<NativeProps>('ReactNativeBlurView');
|
package/src/index.tsx
ADDED