@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.
Files changed (46) hide show
  1. package/LICENSE +20 -0
  2. package/README.md +222 -0
  3. package/ReactNativeBlur.podspec +20 -0
  4. package/android/app/build/generated/source/codegen/java/com/facebook/react/viewmanagers/ReactNativeBlurViewManagerDelegate.java +38 -0
  5. package/android/app/build/generated/source/codegen/java/com/facebook/react/viewmanagers/ReactNativeBlurViewManagerInterface.java +20 -0
  6. package/android/app/build/generated/source/codegen/jni/CMakeLists.txt +36 -0
  7. package/android/app/build/generated/source/codegen/jni/ReactNativeBlurViewSpec-generated.cpp +22 -0
  8. package/android/app/build/generated/source/codegen/jni/ReactNativeBlurViewSpec.h +24 -0
  9. package/android/app/build/generated/source/codegen/jni/react/renderer/components/ReactNativeBlurViewSpec/ComponentDescriptors.cpp +22 -0
  10. package/android/app/build/generated/source/codegen/jni/react/renderer/components/ReactNativeBlurViewSpec/ComponentDescriptors.h +24 -0
  11. package/android/app/build/generated/source/codegen/jni/react/renderer/components/ReactNativeBlurViewSpec/EventEmitters.cpp +16 -0
  12. package/android/app/build/generated/source/codegen/jni/react/renderer/components/ReactNativeBlurViewSpec/EventEmitters.h +23 -0
  13. package/android/app/build/generated/source/codegen/jni/react/renderer/components/ReactNativeBlurViewSpec/Props.cpp +27 -0
  14. package/android/app/build/generated/source/codegen/jni/react/renderer/components/ReactNativeBlurViewSpec/Props.h +63 -0
  15. package/android/app/build/generated/source/codegen/jni/react/renderer/components/ReactNativeBlurViewSpec/ReactNativeBlurViewSpecJSI-generated.cpp +17 -0
  16. package/android/app/build/generated/source/codegen/jni/react/renderer/components/ReactNativeBlurViewSpec/ReactNativeBlurViewSpecJSI.h +19 -0
  17. package/android/app/build/generated/source/codegen/jni/react/renderer/components/ReactNativeBlurViewSpec/ShadowNodes.cpp +17 -0
  18. package/android/app/build/generated/source/codegen/jni/react/renderer/components/ReactNativeBlurViewSpec/ShadowNodes.h +32 -0
  19. package/android/app/build/generated/source/codegen/jni/react/renderer/components/ReactNativeBlurViewSpec/States.cpp +16 -0
  20. package/android/app/build/generated/source/codegen/jni/react/renderer/components/ReactNativeBlurViewSpec/States.h +29 -0
  21. package/android/build.gradle +85 -0
  22. package/android/gradle.properties +5 -0
  23. package/android/src/main/AndroidManifest.xml +2 -0
  24. package/android/src/main/java/com/sbaiahmed1/reactnativeblur/ReactNativeBlurPackage.kt +19 -0
  25. package/android/src/main/java/com/sbaiahmed1/reactnativeblur/ReactNativeBlurView.kt +369 -0
  26. package/android/src/main/java/com/sbaiahmed1/reactnativeblur/ReactNativeBlurViewManager.kt +50 -0
  27. package/ios/ReactNativeBlurView.h +14 -0
  28. package/ios/ReactNativeBlurView.mm +311 -0
  29. package/ios/ReactNativeBlurViewManager.mm +23 -0
  30. package/lib/module/BlurView.js +41 -0
  31. package/lib/module/BlurView.js.map +1 -0
  32. package/lib/module/ReactNativeBlurViewNativeComponent.ts +27 -0
  33. package/lib/module/index.js +6 -0
  34. package/lib/module/index.js.map +1 -0
  35. package/lib/module/package.json +1 -0
  36. package/lib/typescript/package.json +1 -0
  37. package/lib/typescript/src/BlurView.d.ts +48 -0
  38. package/lib/typescript/src/BlurView.d.ts.map +1 -0
  39. package/lib/typescript/src/ReactNativeBlurViewNativeComponent.d.ts +11 -0
  40. package/lib/typescript/src/ReactNativeBlurViewNativeComponent.d.ts.map +1 -0
  41. package/lib/typescript/src/index.d.ts +5 -0
  42. package/lib/typescript/src/index.d.ts.map +1 -0
  43. package/package.json +170 -0
  44. package/src/BlurView.tsx +75 -0
  45. package/src/ReactNativeBlurViewNativeComponent.ts +27 -0
  46. package/src/index.tsx +5 -0
@@ -0,0 +1,311 @@
1
+ #import "ReactNativeBlurView.h"
2
+
3
+ #import <react/renderer/components/ReactNativeBlurViewSpec/ComponentDescriptors.h>
4
+ #import <react/renderer/components/ReactNativeBlurViewSpec/EventEmitters.h>
5
+ #import <react/renderer/components/ReactNativeBlurViewSpec/Props.h>
6
+ #import <react/renderer/components/ReactNativeBlurViewSpec/RCTComponentViewHelpers.h>
7
+
8
+ #import "RCTFabricComponentsPlugins.h"
9
+
10
+ using namespace facebook::react;
11
+
12
+ @interface ReactNativeBlurView () <RCTReactNativeBlurViewViewProtocol>
13
+
14
+ @end
15
+
16
+ @implementation ReactNativeBlurView {
17
+ UIVisualEffectView * _blurView;
18
+ UIView * _fallbackView;
19
+ }
20
+
21
+ + (ComponentDescriptorProvider)componentDescriptorProvider
22
+ {
23
+ return concreteComponentDescriptorProvider<ReactNativeBlurViewComponentDescriptor>();
24
+ }
25
+
26
+ - (instancetype)initWithFrame:(CGRect)frame
27
+ {
28
+ if (self = [super initWithFrame:frame]) {
29
+ static const auto defaultProps = std::make_shared<const ReactNativeBlurViewProps>();
30
+ _props = defaultProps;
31
+
32
+ [self setupBlurView];
33
+ }
34
+
35
+ return self;
36
+ }
37
+
38
+ - (void)setupBlurView
39
+ {
40
+ // Create blur effect
41
+ UIBlurEffect *blurEffect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleLight];
42
+ _blurView = [[UIVisualEffectView alloc] initWithEffect:blurEffect];
43
+ _blurView.frame = self.bounds;
44
+ _blurView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
45
+
46
+ // Create fallback view for reduced transparency
47
+ _fallbackView = [[UIView alloc] init];
48
+ _fallbackView.frame = self.bounds;
49
+ _fallbackView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
50
+ _fallbackView.backgroundColor = [UIColor colorWithWhite:0.8 alpha:0.8];
51
+ _fallbackView.hidden = YES;
52
+
53
+ // Insert blur views at index 0 to avoid interfering with React's child view management
54
+ [self insertSubview:_blurView atIndex:0];
55
+ [self insertSubview:_fallbackView atIndex:0];
56
+
57
+ // Check for reduced transparency
58
+ [self updateForReducedTransparency];
59
+
60
+ // Listen for accessibility changes
61
+ [[NSNotificationCenter defaultCenter] addObserver:self
62
+ selector:@selector(updateForReducedTransparency)
63
+ name:UIAccessibilityReduceTransparencyStatusDidChangeNotification
64
+ object:nil];
65
+ }
66
+
67
+ - (void)updateForReducedTransparency
68
+ {
69
+ BOOL reduceTransparency = UIAccessibilityIsReduceTransparencyEnabled();
70
+ _blurView.hidden = reduceTransparency;
71
+ _fallbackView.hidden = !reduceTransparency;
72
+ }
73
+
74
+ - (UIBlurEffectStyle)blurEffectStyleFromString:(NSString *)blurType
75
+ {
76
+ if ([blurType isEqualToString:@"xlight"]) {
77
+ return UIBlurEffectStyleExtraLight;
78
+ } else if ([blurType isEqualToString:@"light"]) {
79
+ return UIBlurEffectStyleLight;
80
+ } else if ([blurType isEqualToString:@"dark"]) {
81
+ return UIBlurEffectStyleDark;
82
+ } else if ([blurType isEqualToString:@"extraDark"]) {
83
+ return UIBlurEffectStyleSystemThickMaterialDark;
84
+ } else if ([blurType isEqualToString:@"regular"]) {
85
+ return UIBlurEffectStyleRegular;
86
+ } else if ([blurType isEqualToString:@"prominent"]) {
87
+ return UIBlurEffectStyleProminent;
88
+ } else if ([blurType isEqualToString:@"systemUltraThinMaterial"]) {
89
+ return UIBlurEffectStyleSystemUltraThinMaterial;
90
+ } else if ([blurType isEqualToString:@"systemThinMaterial"]) {
91
+ return UIBlurEffectStyleSystemThinMaterial;
92
+ } else if ([blurType isEqualToString:@"systemMaterial"]) {
93
+ return UIBlurEffectStyleSystemMaterial;
94
+ } else if ([blurType isEqualToString:@"systemThickMaterial"]) {
95
+ return UIBlurEffectStyleSystemThickMaterial;
96
+ } else if ([blurType isEqualToString:@"systemChromeMaterial"]) {
97
+ return UIBlurEffectStyleSystemChromeMaterial;
98
+ }
99
+
100
+ return UIBlurEffectStyleLight; // Default
101
+ }
102
+
103
+ - (void)updateProps:(Props::Shared const &)props oldProps:(Props::Shared const &)oldProps
104
+ {
105
+ const auto &oldViewProps = *std::static_pointer_cast<ReactNativeBlurViewProps const>(_props);
106
+ const auto &newViewProps = *std::static_pointer_cast<ReactNativeBlurViewProps const>(props);
107
+
108
+ // Update blur type
109
+ if (oldViewProps.blurType != newViewProps.blurType) {
110
+ std::string blurTypeStr = toString(newViewProps.blurType);
111
+ NSString *blurTypeString = [[NSString alloc] initWithUTF8String:blurTypeStr.c_str()];
112
+ UIBlurEffectStyle blurStyle = [self blurEffectStyleFromString:blurTypeString];
113
+ UIBlurEffect *blurEffect = [UIBlurEffect effectWithStyle:blurStyle];
114
+ _blurView.effect = blurEffect;
115
+ }
116
+
117
+ // Update blur amount (create custom blur effect)
118
+ if (oldViewProps.blurAmount != newViewProps.blurAmount) {
119
+ [self updateBlurEffectWithAmount:newViewProps.blurAmount];
120
+ }
121
+
122
+ // Update fallback color
123
+ if (oldViewProps.reducedTransparencyFallbackColor != newViewProps.reducedTransparencyFallbackColor) {
124
+ if (!newViewProps.reducedTransparencyFallbackColor.empty()) {
125
+ NSString *colorString = [[NSString alloc] initWithUTF8String:newViewProps.reducedTransparencyFallbackColor.c_str()];
126
+ _fallbackView.backgroundColor = [self hexStringToColor:colorString];
127
+ }
128
+ }
129
+
130
+ [super updateProps:props oldProps:oldProps];
131
+ }
132
+
133
+ - (void)updateBlurEffectWithAmount:(double)amount
134
+ {
135
+ // For amounts 0-30: Use alpha blending with UIVisualEffectView
136
+ // For amounts 30+: Create custom blur effect with Core Image
137
+
138
+ if (amount <= 30.0) {
139
+ // Use standard UIVisualEffectView with alpha
140
+ CGFloat alpha = amount / 30.0; // Scale to 0-1 for low amounts
141
+ _blurView.alpha = alpha;
142
+
143
+ // Remove any custom blur layer
144
+ [self.layer.sublayers enumerateObjectsUsingBlock:^(CALayer *layer, NSUInteger idx, BOOL *stop) {
145
+ if ([layer.name isEqualToString:@"customBlur"]) {
146
+ [layer removeFromSuperlayer];
147
+ }
148
+ }];
149
+ } else {
150
+ // Use full opacity for the base blur
151
+ _blurView.alpha = 1.0;
152
+
153
+ // Add custom blur overlay for enhanced effect
154
+ [self addCustomBlurOverlayWithIntensity:(amount - 30.0) / 70.0]; // Scale 30-100 to 0-1
155
+ }
156
+ }
157
+
158
+ - (void)addCustomBlurOverlayWithIntensity:(CGFloat)intensity
159
+ {
160
+ // Remove existing custom blur layer
161
+ [self.layer.sublayers enumerateObjectsUsingBlock:^(CALayer *layer, NSUInteger idx, BOOL *stop) {
162
+ if ([layer.name isEqualToString:@"customBlur"]) {
163
+ [layer removeFromSuperlayer];
164
+ }
165
+ }];
166
+
167
+ // Create a semi-transparent overlay that simulates additional blur
168
+ CALayer *blurOverlay = [CALayer layer];
169
+ blurOverlay.name = @"customBlur";
170
+ blurOverlay.frame = self.bounds;
171
+
172
+ // Create a gradient effect that simulates depth
173
+ CAGradientLayer *gradientLayer = [CAGradientLayer layer];
174
+ gradientLayer.frame = self.bounds;
175
+
176
+ // Adjust colors based on blur type
177
+ UIColor *overlayColor;
178
+ if ([self.blurType isEqualToString:@"dark"] || [self.blurType isEqualToString:@"extraDark"]) {
179
+ overlayColor = [UIColor colorWithWhite:0.0 alpha:intensity * 0.3];
180
+ } else {
181
+ overlayColor = [UIColor colorWithWhite:1.0 alpha:intensity * 0.2];
182
+ }
183
+
184
+ gradientLayer.colors = @[
185
+ (id)[overlayColor colorWithAlphaComponent:intensity * 0.1].CGColor,
186
+ (id)[overlayColor colorWithAlphaComponent:intensity * 0.3].CGColor,
187
+ (id)[overlayColor colorWithAlphaComponent:intensity * 0.1].CGColor
188
+ ];
189
+
190
+ gradientLayer.locations = @[@0.0, @0.5, @1.0];
191
+
192
+ [blurOverlay addSublayer:gradientLayer];
193
+ [self.layer addSublayer:blurOverlay];
194
+ }
195
+
196
+ - (NSString *)blurType
197
+ {
198
+ const auto &props = *std::static_pointer_cast<ReactNativeBlurViewProps const>(_props);
199
+ std::string blurTypeStr = toString(props.blurType);
200
+ return [[NSString alloc] initWithUTF8String:blurTypeStr.c_str()];
201
+ }
202
+
203
+ - (void)mountChildComponentView:(UIView<RCTComponentViewProtocol> *)childComponentView index:(NSInteger)index
204
+ {
205
+ // Always insert React subviews after the blur views (which are at indices 0 and 1)
206
+ NSInteger adjustedIndex = index + 2;
207
+ [self insertSubview:childComponentView atIndex:adjustedIndex];
208
+ }
209
+
210
+ - (void)unmountChildComponentView:(UIView<RCTComponentViewProtocol> *)childComponentView index:(NSInteger)index
211
+ {
212
+ [childComponentView removeFromSuperview];
213
+ }
214
+
215
+ - (void)layoutSubviews
216
+ {
217
+ [super layoutSubviews];
218
+
219
+ // Ensure blur view and fallback view cover the entire bounds
220
+ if (_blurView) {
221
+ _blurView.frame = self.bounds;
222
+ }
223
+ if (_fallbackView) {
224
+ _fallbackView.frame = self.bounds;
225
+ }
226
+
227
+ // Keep blur views at the back without using sendSubviewToBack to avoid index conflicts
228
+ if (_blurView && _blurView.superview == self) {
229
+ // Move to index 0 if not already there
230
+ NSInteger currentIndex = [self.subviews indexOfObject:_blurView];
231
+ if (currentIndex != 0 && currentIndex != NSNotFound) {
232
+ [_blurView removeFromSuperview];
233
+ [self insertSubview:_blurView atIndex:0];
234
+ }
235
+ }
236
+ if (_fallbackView && _fallbackView.superview == self) {
237
+ // Move to index 1 if not already there (after blur view)
238
+ NSInteger currentIndex = [self.subviews indexOfObject:_fallbackView];
239
+ if (currentIndex != 1 && currentIndex != NSNotFound) {
240
+ [_fallbackView removeFromSuperview];
241
+ [self insertSubview:_fallbackView atIndex:1];
242
+ }
243
+ }
244
+ }
245
+
246
+ - (void)dealloc
247
+ {
248
+ [[NSNotificationCenter defaultCenter] removeObserver:self];
249
+
250
+ // Clean up blur views
251
+ if (_blurView) {
252
+ [_blurView removeFromSuperview];
253
+ _blurView = nil;
254
+ }
255
+ if (_fallbackView) {
256
+ [_fallbackView removeFromSuperview];
257
+ _fallbackView = nil;
258
+ }
259
+ }
260
+
261
+ Class<RCTComponentViewProtocol> ReactNativeBlurViewCls(void)
262
+ {
263
+ return ReactNativeBlurView.class;
264
+ }
265
+
266
+ // Legacy compatibility methods for Old Architecture
267
+ - (void)setBlurAmount:(NSNumber *)blurAmount
268
+ {
269
+ if (blurAmount) {
270
+ [self updateBlurEffectWithAmount:[blurAmount doubleValue]];
271
+ }
272
+ }
273
+
274
+ - (void)setBlurType:(NSString *)blurType
275
+ {
276
+ if (blurType) {
277
+ UIBlurEffectStyle blurStyle = [self blurEffectStyleFromString:blurType];
278
+ UIBlurEffect *blurEffect = [UIBlurEffect effectWithStyle:blurStyle];
279
+ _blurView.effect = blurEffect;
280
+ }
281
+ }
282
+
283
+ - (void)setReducedTransparencyFallbackColor:(NSString *)color
284
+ {
285
+ if (color && color.length > 0) {
286
+ _fallbackView.backgroundColor = [self hexStringToColor:color];
287
+ }
288
+ }
289
+
290
+ - (UIColor *)hexStringToColor:(NSString *)stringToConvert
291
+ {
292
+ if (!stringToConvert || stringToConvert.length == 0) {
293
+ return [UIColor clearColor];
294
+ }
295
+
296
+ NSString *noHashString = [stringToConvert stringByReplacingOccurrencesOfString:@"#" withString:@""];
297
+ NSScanner *stringScanner = [NSScanner scannerWithString:noHashString];
298
+
299
+ unsigned hex;
300
+ if (![stringScanner scanHexInt:&hex]) {
301
+ return [UIColor clearColor];
302
+ }
303
+
304
+ int r = (hex >> 16) & 0xFF;
305
+ int g = (hex >> 8) & 0xFF;
306
+ int b = (hex) & 0xFF;
307
+
308
+ return [UIColor colorWithRed:r / 255.0f green:g / 255.0f blue:b / 255.0f alpha:1.0f];
309
+ }
310
+
311
+ @end
@@ -0,0 +1,23 @@
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
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+
3
+ import React from 'react';
4
+ import ReactNativeBlurView from './ReactNativeBlurViewNativeComponent';
5
+ import { jsx as _jsx } from "react/jsx-runtime";
6
+ /**
7
+ * A cross-platform blur view component that provides native blur effects.
8
+ *
9
+ * On iOS, this uses UIVisualEffectView for true blur effects.
10
+ * On Android, this uses the BlurView library for hardware-accelerated blur effects.
11
+ *
12
+ * @example
13
+ * ```tsx
14
+ * <BlurView
15
+ * blurType="light"
16
+ * blurAmount={20}
17
+ * style={{ flex: 1 }}
18
+ * >
19
+ * <Text>Content behind blur</Text>
20
+ * </BlurView>
21
+ * ```
22
+ */
23
+ export const BlurView = ({
24
+ blurType = 'light',
25
+ blurAmount = 10,
26
+ reducedTransparencyFallbackColor,
27
+ style,
28
+ children,
29
+ ...props
30
+ }) => {
31
+ return /*#__PURE__*/_jsx(ReactNativeBlurView, {
32
+ blurType: blurType,
33
+ blurAmount: blurAmount,
34
+ reducedTransparencyFallbackColor: reducedTransparencyFallbackColor,
35
+ style: style,
36
+ ...props,
37
+ children: children
38
+ });
39
+ };
40
+ export default BlurView;
41
+ //# sourceMappingURL=BlurView.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","ReactNativeBlurView","jsx","_jsx","BlurView","blurType","blurAmount","reducedTransparencyFallbackColor","style","children","props"],"sourceRoot":"../../src","sources":["BlurView.tsx"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AAEzB,OAAOC,mBAAmB,MAEnB,sCAAsC;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAgC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,QAAiC,GAAGA,CAAC;EAChDC,QAAQ,GAAG,OAAO;EAClBC,UAAU,GAAG,EAAE;EACfC,gCAAgC;EAChCC,KAAK;EACLC,QAAQ;EACR,GAAGC;AACL,CAAC,KAAK;EACJ,oBACEP,IAAA,CAACF,mBAAmB;IAClBI,QAAQ,EAAEA,QAAS;IACnBC,UAAU,EAAEA,UAAW;IACvBC,gCAAgC,EAAEA,gCAAiC;IACnEC,KAAK,EAAEA,KAAM;IAAA,GACTE,KAAK;IAAAD,QAAA,EAERA;EAAQ,CACU,CAAC;AAE1B,CAAC;AAED,eAAeL,QAAQ","ignoreList":[]}
@@ -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');
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+
3
+ export { default as ReactNativeBlurView } from './ReactNativeBlurViewNativeComponent';
4
+ export * from './ReactNativeBlurViewNativeComponent';
5
+ export { BlurView as default, BlurView } from "./BlurView.js";
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["default","ReactNativeBlurView","BlurView"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,SAASA,OAAO,IAAIC,mBAAmB,QAAQ,sCAAsC;AACrF,cAAc,sCAAsC;AAEpD,SAASC,QAAQ,IAAIF,OAAO,EAAEE,QAAQ,QAAQ,eAAY","ignoreList":[]}
@@ -0,0 +1 @@
1
+ {"type":"module"}
@@ -0,0 +1 @@
1
+ {"type":"module"}
@@ -0,0 +1,48 @@
1
+ import React from 'react';
2
+ import type { ViewStyle, StyleProp } from 'react-native';
3
+ import { type BlurType } from './ReactNativeBlurViewNativeComponent';
4
+ export interface BlurViewProps {
5
+ /**
6
+ * The type of blur effect to apply
7
+ * @default 'light'
8
+ */
9
+ blurType?: BlurType;
10
+ /**
11
+ * The intensity of the blur effect (0-100)
12
+ * @default 10
13
+ */
14
+ blurAmount?: number;
15
+ /**
16
+ * Fallback color when reduced transparency is enabled
17
+ * Accepts hex color strings like '#FFFFFF'
18
+ */
19
+ reducedTransparencyFallbackColor?: string;
20
+ /**
21
+ * Style object for the blur view
22
+ */
23
+ style?: StyleProp<ViewStyle>;
24
+ /**
25
+ * Child components to render inside the blur view
26
+ */
27
+ children?: React.ReactNode;
28
+ }
29
+ /**
30
+ * A cross-platform blur view component that provides native blur effects.
31
+ *
32
+ * On iOS, this uses UIVisualEffectView for true blur effects.
33
+ * On Android, this uses the BlurView library for hardware-accelerated blur effects.
34
+ *
35
+ * @example
36
+ * ```tsx
37
+ * <BlurView
38
+ * blurType="light"
39
+ * blurAmount={20}
40
+ * style={{ flex: 1 }}
41
+ * >
42
+ * <Text>Content behind blur</Text>
43
+ * </BlurView>
44
+ * ```
45
+ */
46
+ export declare const BlurView: React.FC<BlurViewProps>;
47
+ export default BlurView;
48
+ //# sourceMappingURL=BlurView.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BlurView.d.ts","sourceRoot":"","sources":["../../../src/BlurView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzD,OAA4B,EAC1B,KAAK,QAAQ,EACd,MAAM,sCAAsC,CAAC;AAE9C,MAAM,WAAW,aAAa;IAC5B;;;OAGG;IACH,QAAQ,CAAC,EAAE,QAAQ,CAAC;IAEpB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;;OAGG;IACH,gCAAgC,CAAC,EAAE,MAAM,CAAC;IAE1C;;OAEG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAE7B;;OAEG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,aAAa,CAmB5C,CAAC;AAEF,eAAe,QAAQ,CAAC"}
@@ -0,0 +1,11 @@
1
+ import type { ViewProps } from 'react-native';
2
+ import type { WithDefault, Double } from 'react-native/Libraries/Types/CodegenTypes';
3
+ export type BlurType = 'xlight' | 'light' | 'dark' | 'extraDark' | 'regular' | 'prominent' | 'systemUltraThinMaterial' | 'systemThinMaterial' | 'systemMaterial' | 'systemThickMaterial' | 'systemChromeMaterial';
4
+ interface NativeProps extends ViewProps {
5
+ blurType?: WithDefault<BlurType, 'light'>;
6
+ blurAmount?: WithDefault<Double, 10>;
7
+ reducedTransparencyFallbackColor?: string;
8
+ }
9
+ declare const _default: import("react-native/Libraries/Utilities/codegenNativeComponent").NativeComponentType<NativeProps>;
10
+ export default _default;
11
+ //# sourceMappingURL=ReactNativeBlurViewNativeComponent.d.ts.map
@@ -0,0 +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,UAAU,WAAY,SAAQ,SAAS;IACrC,QAAQ,CAAC,EAAE,WAAW,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IAC1C,UAAU,CAAC,EAAE,WAAW,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IACrC,gCAAgC,CAAC,EAAE,MAAM,CAAC;CAC3C;;AAED,wBAA0E"}
@@ -0,0 +1,5 @@
1
+ export { default as ReactNativeBlurView } from './ReactNativeBlurViewNativeComponent';
2
+ export * from './ReactNativeBlurViewNativeComponent';
3
+ export { BlurView as default, BlurView } from './BlurView';
4
+ export type { BlurViewProps } from './BlurView';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +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"}
package/package.json ADDED
@@ -0,0 +1,170 @@
1
+ {
2
+ "name": "@sbaiahmed1/react-native-blur",
3
+ "version": "0.1.0",
4
+ "description": "React native modern blur view",
5
+ "main": "./lib/module/index.js",
6
+ "types": "./lib/typescript/src/index.d.ts",
7
+ "exports": {
8
+ ".": {
9
+ "source": "./src/index.tsx",
10
+ "types": "./lib/typescript/src/index.d.ts",
11
+ "default": "./lib/module/index.js"
12
+ },
13
+ "./package.json": "./package.json"
14
+ },
15
+ "files": [
16
+ "src",
17
+ "lib",
18
+ "android",
19
+ "ios",
20
+ "cpp",
21
+ "*.podspec",
22
+ "react-native.config.js",
23
+ "!ios/build",
24
+ "!android/build",
25
+ "!android/gradle",
26
+ "!android/gradlew",
27
+ "!android/gradlew.bat",
28
+ "!android/local.properties",
29
+ "!**/__tests__",
30
+ "!**/__fixtures__",
31
+ "!**/__mocks__",
32
+ "!**/.*"
33
+ ],
34
+ "scripts": {
35
+ "example": "yarn workspace @sbaiahmed1/react-native-blur-example",
36
+ "test": "jest",
37
+ "typecheck": "tsc",
38
+ "lint": "eslint \"**/*.{js,ts,tsx}\"",
39
+ "clean": "del-cli android/build example/android/build example/android/app/build example/ios/build lib",
40
+ "prepare": "bob build",
41
+ "release": "release-it --only-version"
42
+ },
43
+ "keywords": [
44
+ "react-native",
45
+ "ios",
46
+ "android"
47
+ ],
48
+ "repository": {
49
+ "type": "git",
50
+ "url": "git+https://github.com/sbaiahmed1/sbaiahmed1-react-native-blur.git"
51
+ },
52
+ "author": "Ahmed Sbai <ahmedclubust@gmail.com> (https://github.com/sbaiahmed1)",
53
+ "license": "MIT",
54
+ "bugs": {
55
+ "url": "https://github.com/sbaiahmed1/sbaiahmed1-react-native-blur/issues"
56
+ },
57
+ "homepage": "https://github.com/sbaiahmed1/sbaiahmed1-react-native-blur#readme",
58
+ "publishConfig": {
59
+ "registry": "https://registry.npmjs.org/",
60
+ "access": "public"
61
+ },
62
+ "devDependencies": {
63
+ "@commitlint/config-conventional": "^19.6.0",
64
+ "@eslint/compat": "^1.2.7",
65
+ "@eslint/eslintrc": "^3.3.0",
66
+ "@eslint/js": "^9.22.0",
67
+ "@evilmartians/lefthook": "^1.5.0",
68
+ "@react-native-community/cli": "15.0.0-alpha.2",
69
+ "@react-native/babel-preset": "0.79.2",
70
+ "@react-native/eslint-config": "^0.78.0",
71
+ "@release-it/conventional-changelog": "^9.0.2",
72
+ "@types/jest": "^29.5.5",
73
+ "@types/react": "^19.0.0",
74
+ "commitlint": "^19.6.1",
75
+ "del-cli": "^5.1.0",
76
+ "eslint": "^9.22.0",
77
+ "eslint-config-prettier": "^10.1.1",
78
+ "eslint-plugin-prettier": "^5.2.3",
79
+ "jest": "^29.7.0",
80
+ "prettier": "^3.0.3",
81
+ "react": "19.0.0",
82
+ "react-native": "0.79.2",
83
+ "react-native-builder-bob": "^0.40.11",
84
+ "release-it": "^17.10.0",
85
+ "turbo": "^1.10.7",
86
+ "typescript": "^5.8.3"
87
+ },
88
+ "peerDependencies": {
89
+ "react": "*",
90
+ "react-native": "*"
91
+ },
92
+ "workspaces": [
93
+ "example"
94
+ ],
95
+ "packageManager": "yarn@3.6.1",
96
+ "jest": {
97
+ "preset": "react-native",
98
+ "modulePathIgnorePatterns": [
99
+ "<rootDir>/example/node_modules",
100
+ "<rootDir>/lib/"
101
+ ]
102
+ },
103
+ "commitlint": {
104
+ "extends": [
105
+ "@commitlint/config-conventional"
106
+ ]
107
+ },
108
+ "release-it": {
109
+ "git": {
110
+ "commitMessage": "chore: release ${version}",
111
+ "tagName": "v${version}"
112
+ },
113
+ "npm": {
114
+ "publish": true
115
+ },
116
+ "github": {
117
+ "release": true
118
+ },
119
+ "plugins": {
120
+ "@release-it/conventional-changelog": {
121
+ "preset": {
122
+ "name": "angular"
123
+ }
124
+ }
125
+ }
126
+ },
127
+ "prettier": {
128
+ "quoteProps": "consistent",
129
+ "singleQuote": true,
130
+ "tabWidth": 2,
131
+ "trailingComma": "es5",
132
+ "useTabs": false
133
+ },
134
+ "react-native-builder-bob": {
135
+ "source": "src",
136
+ "output": "lib",
137
+ "targets": [
138
+ [
139
+ "module",
140
+ {
141
+ "esm": true
142
+ }
143
+ ],
144
+ [
145
+ "typescript",
146
+ {
147
+ "project": "tsconfig.build.json"
148
+ }
149
+ ]
150
+ ]
151
+ },
152
+ "codegenConfig": {
153
+ "name": "ReactNativeBlurViewSpec",
154
+ "type": "all",
155
+ "jsSrcsDir": "src",
156
+ "android": {
157
+ "javaPackageName": "com.sbaiahmed1.reactnativeblur"
158
+ },
159
+ "ios": {
160
+ "componentProvider": {
161
+ "ReactNativeBlurView": "ReactNativeBlurView"
162
+ }
163
+ }
164
+ },
165
+ "create-react-native-library": {
166
+ "languages": "kotlin-objc",
167
+ "type": "fabric-view",
168
+ "version": "0.50.3"
169
+ }
170
+ }