@sbaiahmed1/react-native-blur 4.1.1 → 4.2.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 CHANGED
@@ -1,8 +1,8 @@
1
1
  # @sbaiahmed1/react-native-blur
2
2
 
3
- A modern React Native library providing **three specialized components** for advanced visual effects: `BlurView` for native blur effects, `LiquidGlassView` for cutting-edge liquid glass effects on iOS 26+ (with Android fallback to enhanced blur) and `ProgressiveBlurView` for smooth, variable blur transitions.`
3
+ A modern React Native library providing **four specialized components** for advanced visual effects: `BlurView` for native blur effects, `LiquidGlassView` for cutting-edge liquid glass effects on iOS 26+ (with Android fallback to enhanced blur), `LiquidGlassContainer` for iOS 26+ glass container effects with configurable spacing, and `ProgressiveBlurView` for smooth, variable blur transitions.
4
4
 
5
- > **📦 Current Version: 4.0.0** | **⚠️ Breaking Changes**: If upgrading from 3.x, see [Breaking Changes](#️-breaking-changes-in-v400) section.
5
+ > **⚠️ Breaking Changes**: If upgrading from 3.x, see [Breaking Changes](#️-breaking-changes-in-v400) section.
6
6
 
7
7
  <div align="center">
8
8
  <p>
@@ -133,15 +133,16 @@ import { LiquidGlassView } from '@sbaiahmed1/react-native-blur';
133
133
 
134
134
  ## Features
135
135
 
136
- - **Three Specialized Components**:
136
+ - **Four Specialized Components**:
137
137
  - `BlurView` - Dedicated blur effects component with multiple blur types
138
138
  - `ProgressiveBlurView` - Variable/gradient blur transitions (iOS & Android)
139
139
  - `LiquidGlassView` - Separate component for iOS 26+ liquid glass effects
140
+ - `LiquidGlassContainer` - iOS 26+ glass container with configurable spacing for grouping glass elements
140
141
  - �🌊 **Liquid Glass Effects**: Revolutionary glass effects using iOS 26+ UIGlassEffect API
141
142
  - 🎨 **Multiple Blur Types**: Support for various blur styles including system materials on iOS
142
143
  - 📱 **Cross-Platform**: Works on both iOS and Android
143
144
  - ♿ **Accessibility**: Automatic fallback for reduced transparency settings
144
- - 🔧 **TypeScript**: Full TypeScript support with proper type definitions for both components
145
+ - 🔧 **TypeScript**: Full TypeScript support with proper type definitions for all components
145
146
  - 🚀 **Turbo Module**: Built with React Native's new architecture (Fabric)
146
147
  - 🎯 **Customizable**: Adjustable blur intensity, glass tint colors, and opacity
147
148
  - 💡 **Performance Optimized**: Uses hardware acceleration for smooth rendering
@@ -153,12 +154,12 @@ import { LiquidGlassView } from '@sbaiahmed1/react-native-blur';
153
154
 
154
155
  ### Key Advantages
155
156
 
156
- - **Two Specialized Components**: Separate `BlurView` and `LiquidGlassView` components for clean architecture
157
- - **Liquid Glass Effects**: Only library with iOS 26+ UIGlassEffect support
157
+ - **Four Specialized Components**: Separate `BlurView`, `LiquidGlassView`, `LiquidGlassContainer`, and `ProgressiveBlurView` components for clean architecture
158
+ - **Liquid Glass Effects**: Only library with iOS 26+ UIGlassEffect and UIGlassContainerEffect support
158
159
  - **Real Android Blur**: Hardware-accelerated blur on Android (not overlay)
159
160
  - **New Architecture**: Built for Fabric/Turbo Modules
160
161
  - **Modern Stack**: SwiftUI for iOS, Kotlin for Android
161
- - **Full TypeScript**: Complete type definitions for both components
162
+ - **Full TypeScript**: Complete type definitions for all components
162
163
 
163
164
  ### vs. @react-native-community/blur
164
165
 
@@ -245,7 +246,7 @@ The library uses native Android blur with automatic platform detection. No addit
245
246
  > 📦 **Dependency**: The library uses [QmBlurView](https://github.com/QmDeve/QmBlurView) from Maven Central:
246
247
  >
247
248
  > ```gradle
248
- > implementation 'com.qmdeve:QmBlurView:1.0.4.3'
249
+ > implementation 'com.qmdeve:QmBlurView:1.0.5-Beta01'
249
250
  > ```
250
251
 
251
252
  The implementation automatically handles different Android versions:
@@ -256,7 +257,7 @@ The implementation automatically handles different Android versions:
256
257
 
257
258
  ## Usage
258
259
 
259
- The library now provides **three specialized components** for different visual effects:
260
+ The library now provides **four specialized components** for different visual effects:
260
261
 
261
262
  ### BlurView - Standard Blur Effects
262
263
 
@@ -417,9 +418,91 @@ function InteractiveGlass() {
417
418
  }
418
419
  ```
419
420
 
421
+ ### LiquidGlassContainer - Glass Container Effects (iOS 26+)
422
+
423
+ Use `LiquidGlassContainer` to create a glass container with configurable spacing between glass elements. This component uses iOS 26+ `UIGlassContainerEffect` to create beautiful grouped glass effects.
424
+
425
+ **Note:** This component automatically falls back to a regular View on Android and older iOS versions.
426
+
427
+ #### Basic Usage
428
+
429
+ ```tsx
430
+ import React from 'react';
431
+ import { LiquidGlassContainer, LiquidGlassView } from '@sbaiahmed1/react-native-blur';
432
+
433
+ function GlassContainerExample() {
434
+ return (
435
+ <LiquidGlassContainer spacing={20} style={{ flex: 1 }}>
436
+ <LiquidGlassView
437
+ glassType="clear"
438
+ glassTintColor="#000000"
439
+ glassOpacity={0.3}
440
+ style={{ width: 120, height: 120, borderRadius: 60 }}
441
+ >
442
+ <Text>Circle 1</Text>
443
+ </LiquidGlassView>
444
+ <LiquidGlassView
445
+ glassType="clear"
446
+ glassTintColor="#000000"
447
+ glassOpacity={0.3}
448
+ style={{ width: 120, height: 120, borderRadius: 60 }}
449
+ >
450
+ <Text>Circle 2</Text>
451
+ </LiquidGlassView>
452
+ </LiquidGlassContainer>
453
+ );
454
+ }
455
+ ```
456
+
457
+ #### Animated Glass Container
458
+
459
+ ```tsx
460
+ import React, { useRef } from 'react';
461
+ import { Animated } from 'react-native';
462
+ import { LiquidGlassContainer, LiquidGlassView } from '@sbaiahmed1/react-native-blur';
463
+
464
+ function AnimatedGlassContainer() {
465
+ const translateX = useRef(new Animated.Value(0)).current;
466
+
467
+ const animateElements = () => {
468
+ Animated.sequence([
469
+ Animated.timing(translateX, {
470
+ toValue: -50,
471
+ duration: 2000,
472
+ useNativeDriver: true,
473
+ }),
474
+ Animated.timing(translateX, {
475
+ toValue: 30,
476
+ duration: 2000,
477
+ useNativeDriver: true,
478
+ }),
479
+ ]).start();
480
+ };
481
+
482
+ return (
483
+ <LiquidGlassContainer spacing={30} style={{ flexDirection: 'row' }}>
484
+ <LiquidGlassView
485
+ glassType="clear"
486
+ style={{ width: 100, height: 100, borderRadius: 50 }}
487
+ >
488
+ <Text>Static</Text>
489
+ </LiquidGlassView>
490
+ <Animated.View style={{ transform: [{ translateX }] }}>
491
+ <LiquidGlassView
492
+ glassType="clear"
493
+ style={{ width: 100, height: 100, borderRadius: 50 }}
494
+ >
495
+ <Text>Animated</Text>
496
+ </LiquidGlassView>
497
+ </Animated.View>
498
+ </LiquidGlassContainer>
499
+ );
500
+ }
501
+ ```
502
+
420
503
  ## Props
421
504
 
422
- The library now provides two separate components with their own props:
505
+ The library now provides four separate components with their own props:
423
506
 
424
507
  ### BlurView Props
425
508
 
@@ -449,6 +532,7 @@ All props are optional and have sensible defaults.
449
532
  | `children` | `ReactNode` | `undefined` | Child components to render inside the blur view |
450
533
 
451
534
  > **Platform Note**: `ProgressiveBlurView` works on both **iOS** and **Android**.
535
+ >
452
536
  > - **iOS**: Uses private Core Animation filters for variable blur effects
453
537
  > - **Android**: Extends QMBlur's BlurView with custom gradient masking to create progressive blur effect
454
538
 
@@ -467,10 +551,22 @@ All props are optional and have sensible defaults.
467
551
  | `style` | `ViewStyle` | `undefined` | Style object for the glass view |
468
552
  | `children` | `ReactNode` | `undefined` | Child components to render inside the glass view |
469
553
 
554
+ ### LiquidGlassContainer Props
555
+
556
+ All props are optional and have sensible defaults.
557
+
558
+ | Prop | Type | Default | Description |
559
+ | ---------- | ----------- | ----------- | ---------------------------------------------------------------------------------------------------- |
560
+ | `spacing` | `number` | `0` | (iOS 26+ only) The spacing value between glass elements in the container |
561
+ | `style` | `ViewStyle` | `undefined` | Style object for the glass container |
562
+ | `children` | `ReactNode` | `undefined` | Child components to render inside the glass container (typically `LiquidGlassView` components) |
563
+
470
564
  > **Note**: The `BlurType` and `GlassType` are exported types from the library. See [Blur Types](#blur-types) and [Glass Types](#glass-types) sections below for all available values.
471
565
 
472
566
  > **Platform Note**: `LiquidGlassView` automatically falls back to `BlurView` on Android and iOS versions older than iOS 26.
473
567
 
568
+ > **Platform Note**: `LiquidGlassContainer` automatically falls back to a regular `View` on Android and iOS versions older than iOS 26.
569
+
474
570
  ## Blur Types (BlurView)
475
571
 
476
572
  The following blur types are supported for `BlurView`:
@@ -536,7 +632,7 @@ The component uses the QmBlurView library to provide real blur effects with hard
536
632
 
537
633
  ## Accessibility
538
634
 
539
- Both components automatically respect the "Reduce Transparency" accessibility setting:
635
+ All components automatically respect the "Reduce Transparency" accessibility setting:
540
636
 
541
637
  ### BlurView
542
638
 
@@ -548,20 +644,29 @@ Both components automatically respect the "Reduce Transparency" accessibility se
548
644
  - **iOS 26+**: When reduce transparency is enabled, the liquid glass effect is hidden and a fallback view with solid color is shown
549
645
  - **iOS < 26 & Android**: Automatically falls back to `BlurView` behavior
550
646
 
551
- You can customize the fallback color using the `reducedTransparencyFallbackColor` prop on both components.
647
+ ### LiquidGlassContainer
648
+
649
+ - **iOS 26+**: When reduce transparency is enabled, falls back to regular View
650
+ - **iOS < 26 & Android**: Always renders as regular View
651
+
652
+ You can customize the fallback color using the `reducedTransparencyFallbackColor` prop on `BlurView` and `LiquidGlassView` components.
552
653
 
553
654
  ## TypeScript Support
554
655
 
555
- This package includes full TypeScript definitions for both components:
656
+ This package includes full TypeScript definitions for all components:
556
657
 
557
658
  ```tsx
558
659
  import {
559
660
  BlurView,
560
661
  LiquidGlassView,
662
+ LiquidGlassContainer,
663
+ ProgressiveBlurView,
561
664
  BlurType,
562
665
  GlassType,
563
666
  BlurViewProps,
564
667
  LiquidGlassViewProps,
668
+ LiquidGlassContainerProps,
669
+ ProgressiveBlurViewProps,
565
670
  } from '@sbaiahmed1/react-native-blur';
566
671
 
567
672
  // BlurType is exported for type checking
@@ -580,6 +685,11 @@ interface MyGlassComponentProps {
580
685
  glassProps: LiquidGlassViewProps;
581
686
  }
582
687
 
688
+ // LiquidGlassContainerProps for glass container props
689
+ interface MyGlassContainerProps {
690
+ containerProps: LiquidGlassContainerProps;
691
+ }
692
+
583
693
  // Example with BlurView properties
584
694
  const blurProps: BlurViewProps = {
585
695
  blurType: 'systemMaterial',
@@ -594,16 +704,23 @@ const liquidGlassProps: LiquidGlassViewProps = {
594
704
  glassOpacity: 0.8,
595
705
  isInteractive: true,
596
706
  };
707
+
708
+ // Example with LiquidGlassContainer properties
709
+ const liquidGlassContainerProps: LiquidGlassContainerProps = {
710
+ spacing: 20,
711
+ };
597
712
  ```
598
713
 
599
714
  ## Example App
600
715
 
601
- The package includes a comprehensive example app that demonstrates both components with all their features. The example app features:
716
+ The package includes a comprehensive example app that demonstrates all components with all their features. The example app features:
602
717
 
603
718
  - **BlurView Demo**: Interactive blur type selector with live preview of all blur types
604
719
  - **LiquidGlassView Demo**: Showcase of iOS 26+ glass effects with customizable properties
605
- - **Practical Use Cases**: Real-world examples like cards, modals, and overlays using both components
606
- - **Comparison Views**: Side-by-side comparisons between BlurView and LiquidGlassView effects
720
+ - **LiquidGlassContainer Demo**: Interactive demonstrations of glass container spacing with animated examples
721
+ - **ProgressiveBlurView Demo**: Variable blur gradient examples for different use cases
722
+ - **Practical Use Cases**: Real-world examples like cards, modals, and overlays using all components
723
+ - **Comparison Views**: Side-by-side comparisons between different effect types
607
724
  - **Platform Fallbacks**: Visual demonstrations of how effects degrade gracefully on older platforms
608
725
 
609
726
  To run the example:
@@ -639,12 +756,32 @@ yarn android
639
756
  - Automatic fallback to `BlurView` with enhanced blur effects
640
757
  - Same performance characteristics as `BlurView`
641
758
 
759
+ ### LiquidGlassContainer
760
+
761
+ - **iOS 26+**:
762
+ - **Native Container Effects**: Uses `UIGlassContainerEffect` API for efficient glass grouping
763
+ - **Optimized Spacing**: Hardware-accelerated spacing calculations
764
+ - **Animation Ready**: Smooth animations with no performance impact
765
+ - **iOS < 26 & Android**:
766
+ - Lightweight View fallback with minimal overhead
767
+
642
768
  ### General Tips
643
769
 
644
770
  - Avoid using too many blur/glass views simultaneously on lower-end devices
645
771
  - Consider using `reducedTransparencyFallbackColor` for better accessibility
646
- - `LiquidGlassView` automatically falls back to `BlurView` on unsupported platforms
647
- - Both components are optimized for React Native's new architecture (Fabric)
772
+ - `LiquidGlassView` and `LiquidGlassContainer` automatically fall back on unsupported platforms
773
+ - All components are optimized for React Native's new architecture (Fabric)
774
+
775
+ ## What's New in v4.1.2
776
+
777
+ ### 🌊 LiquidGlassContainer Component (NEW)
778
+
779
+ - **New Component**: `LiquidGlassContainer` for iOS 26+ glass container effects
780
+ - Uses iOS 26+ `UIGlassContainerEffect` API for grouping glass elements
781
+ - Configurable spacing between glass elements with the `spacing` prop
782
+ - Perfect for creating interactive, grouped glass interfaces
783
+ - Automatic fallback to regular View on Android and older iOS versions
784
+ - Fully integrated with animated components for dynamic effects
648
785
 
649
786
  ## What's New in v4.0.0
650
787
 
@@ -652,7 +789,7 @@ yarn android
652
789
 
653
790
  ### 🎯 Component Separation (BREAKING CHANGE)
654
791
 
655
- - **Two Specialized Components**: Split single `BlurView` into dedicated `BlurView` and `LiquidGlassView` components
792
+ - **Four Specialized Components**: Split single `BlurView` into dedicated `BlurView`, `LiquidGlassView`, `LiquidGlassContainer`, and `ProgressiveBlurView` components
656
793
  - **Removed `type` prop**: No more switching between blur/liquidGlass modes - use the appropriate component instead
657
794
  - **Cleaner APIs**: Each component has focused props without mixing blur and glass properties
658
795
  - **Better Architecture**: True separation of concerns following React best practices
@@ -662,6 +799,7 @@ yarn android
662
799
 
663
800
  - Revolutionary glass effects using Apple's new UIGlassEffect API
664
801
  - Dedicated `LiquidGlassView` component for glass-specific effects
802
+ - Dedicated `LiquidGlassContainer` component for grouping glass elements with spacing
665
803
  - Customizable glass types: `clear` and `regular`
666
804
  - Adjustable tint colors and opacity for stunning visual effects
667
805
  - Automatic fallback to enhanced blur on older iOS versions and Android
@@ -675,14 +813,15 @@ yarn android
675
813
 
676
814
  ### 📱 Enhanced Example App
677
815
 
678
- - Separate demonstrations for BlurView and LiquidGlassView
816
+ - Separate demonstrations for BlurView, LiquidGlassView, LiquidGlassContainer, and ProgressiveBlurView
679
817
  - Interactive property controls for real-time customization
680
818
  - Practical use case examples (cards, modals, overlays)
681
- - Comparison views showing both components side by side
819
+ - Comparison views showing different components side by side
820
+ - Animated examples demonstrating LiquidGlassContainer spacing effects
682
821
 
683
822
  ### 🛠️ Developer Experience
684
823
 
685
- - Full TypeScript support with separate prop types for each component (`BlurViewProps`, `LiquidGlassViewProps`)
824
+ - Full TypeScript support with separate prop types for each component (`BlurViewProps`, `LiquidGlassViewProps`, `LiquidGlassContainerProps`, `ProgressiveBlurViewProps`)
686
825
  - Cleaner, more intuitive API design
687
826
  - Improved component layout handling
688
827
  - Better accessibility support with smart fallbacks
@@ -74,7 +74,7 @@ def kotlin_version = getExtOrDefault("kotlinVersion")
74
74
  dependencies {
75
75
  implementation "com.facebook.react:react-android"
76
76
  implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
77
- implementation 'com.qmdeve:QmBlurView:1.0.4.5'
77
+ implementation 'com.qmdeve:QmBlurView:1.0.5-Beta01'
78
78
  }
79
79
 
80
80
  react {
@@ -0,0 +1,18 @@
1
+ // ReactNativeLiquidGlassContainerHelper.swift
2
+
3
+ import UIKit
4
+
5
+ // MARK: - Objective-C Bridging Helpers for Liquid Glass Container
6
+
7
+ @objc public class ReactNativeLiquidGlassContainerHelper: NSObject {
8
+
9
+ /// Creates and returns a liquid glass container view.
10
+ @objc public static func createLiquidGlassContainerWithFrame(_ frame: CGRect) -> LiquidGlassContainer {
11
+ return LiquidGlassContainer(frame: frame)
12
+ }
13
+
14
+ /// Updates the liquid glass container with a new spacing value.
15
+ @objc public static func updateLiquidGlassContainer(_ container: LiquidGlassContainer, withSpacing spacing: Double) {
16
+ container.spacing = CGFloat(spacing)
17
+ }
18
+ }
@@ -0,0 +1,14 @@
1
+ #import <React/RCTViewComponentView.h>
2
+ #import <UIKit/UIKit.h>
3
+
4
+ #ifndef ReactNativeLiquidGlassContainerNativeComponent_h
5
+ #define ReactNativeLiquidGlassContainerNativeComponent_h
6
+
7
+ NS_ASSUME_NONNULL_BEGIN
8
+
9
+ @interface ReactNativeLiquidGlassContainer : RCTViewComponentView
10
+ @end
11
+
12
+ NS_ASSUME_NONNULL_END
13
+
14
+ #endif /* ReactNativeLiquidGlassContainerNativeComponent_h */
@@ -0,0 +1,133 @@
1
+ #import "ReactNativeLiquidGlassContainer.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
+ #if __has_include("ReactNativeBlur-Swift.h")
11
+ #import "ReactNativeBlur-Swift.h"
12
+ #else
13
+ #import <ReactNativeBlur/ReactNativeBlur-Swift.h>
14
+ #endif
15
+
16
+ using namespace facebook::react;
17
+
18
+ @interface ReactNativeLiquidGlassContainer () <RCTReactNativeLiquidGlassContainerViewProtocol>
19
+ @end
20
+
21
+ @implementation ReactNativeLiquidGlassContainer {
22
+ LiquidGlassContainer *_containerView;
23
+ Props::Shared _props;
24
+ LayoutMetrics _layoutMetrics;
25
+ }
26
+
27
+ + (ComponentDescriptorProvider)componentDescriptorProvider
28
+ {
29
+ return concreteComponentDescriptorProvider<ReactNativeLiquidGlassContainerComponentDescriptor>();
30
+ }
31
+
32
+ - (instancetype)initWithFrame:(CGRect)frame
33
+ {
34
+ if (self = [super initWithFrame:frame]) {
35
+ static const auto defaultProps = std::make_shared<const ReactNativeLiquidGlassContainerProps>();
36
+ _props = defaultProps;
37
+
38
+ const auto &containerProps = *std::static_pointer_cast<const ReactNativeLiquidGlassContainerProps>(defaultProps);
39
+
40
+ _containerView = [ReactNativeLiquidGlassContainerHelper createLiquidGlassContainerWithFrame:frame];
41
+
42
+ // Set initial spacing from default props
43
+ [ReactNativeLiquidGlassContainerHelper updateLiquidGlassContainer:_containerView withSpacing:containerProps.spacing];
44
+
45
+ [self addSubview:_containerView];
46
+ }
47
+ return self;
48
+ }
49
+
50
+ - (void)updateProps:(Props::Shared const &)props oldProps:(Props::Shared const &)oldProps
51
+ {
52
+ const auto &oldViewProps = *std::static_pointer_cast<ReactNativeLiquidGlassContainerProps const>(_props);
53
+ const auto &newViewProps = *std::static_pointer_cast<ReactNativeLiquidGlassContainerProps const>(props);
54
+
55
+ // Update spacing if it has changed
56
+ if (oldViewProps.spacing != newViewProps.spacing) {
57
+ [ReactNativeLiquidGlassContainerHelper updateLiquidGlassContainer:_containerView withSpacing:newViewProps.spacing];
58
+ }
59
+
60
+ // Store the new props
61
+ _props = props;
62
+
63
+ [super updateProps:props oldProps:oldProps];
64
+ }
65
+
66
+ - (void)finalizeUpdates:(RNComponentViewUpdateMask)updateMask
67
+ {
68
+ [super finalizeUpdates:updateMask];
69
+
70
+ // Apply border radius from layout metrics to the container view
71
+ if (@available(iOS 26.0, *)) {
72
+ const auto &props = *std::static_pointer_cast<ReactNativeLiquidGlassContainerProps const>(_props);
73
+ const auto borderMetrics = props.resolveBorderMetrics(_layoutMetrics);
74
+
75
+ // Use topLeft.horizontal same as React Native RCTViewComponentView implementation
76
+ CGFloat radius = borderMetrics.borderRadii.topLeft.horizontal;
77
+
78
+ if (radius > 0) {
79
+ _containerView.layer.cornerRadius = radius;
80
+ _containerView.layer.masksToBounds = YES;
81
+ }
82
+ }
83
+ }
84
+
85
+ - (void)layoutSubviews
86
+ {
87
+ [super layoutSubviews];
88
+ _containerView.frame = self.bounds;
89
+
90
+ // Copy corner radius from the Fabric view to the container view
91
+ _containerView.layer.cornerRadius = self.layer.cornerRadius;
92
+ _containerView.layer.cornerCurve = self.layer.cornerCurve;
93
+ _containerView.layer.masksToBounds = self.layer.masksToBounds;
94
+ }
95
+
96
+ - (void)updateLayoutMetrics:(const LayoutMetrics &)layoutMetrics oldLayoutMetrics:(const LayoutMetrics &)oldLayoutMetrics
97
+ {
98
+ _layoutMetrics = layoutMetrics;
99
+ [super updateLayoutMetrics:layoutMetrics oldLayoutMetrics:oldLayoutMetrics];
100
+ }
101
+
102
+ - (void)mountChildComponentView:(UIView<RCTComponentViewProtocol> *)childComponentView index:(NSInteger)index
103
+ {
104
+ if (@available(iOS 26.0, *)) {
105
+ // On iOS 26+, add children to the contentView if available
106
+ if ([_containerView isKindOfClass:[UIVisualEffectView class]]) {
107
+ UIVisualEffectView *effectView = (UIVisualEffectView *)_containerView;
108
+ [effectView.contentView insertSubview:childComponentView atIndex:index];
109
+ return;
110
+ }
111
+ }
112
+
113
+ // Fallback: add directly to container view
114
+ [_containerView insertSubview:childComponentView atIndex:index];
115
+ }
116
+
117
+ - (void)unmountChildComponentView:(UIView<RCTComponentViewProtocol> *)childComponentView index:(NSInteger)index
118
+ {
119
+ [childComponentView removeFromSuperview];
120
+ }
121
+
122
+ - (void)dealloc
123
+ {
124
+ [_containerView removeFromSuperview];
125
+ _containerView = nil;
126
+ }
127
+
128
+ @end
129
+
130
+ Class<RCTComponentViewProtocol> LiquidGlassContainerCls(void)
131
+ {
132
+ return ReactNativeLiquidGlassContainer.class;
133
+ }
@@ -0,0 +1,6 @@
1
+ #import <React/RCTViewManager.h>
2
+ #import <React/RCTUIManager.h>
3
+ #import "RCTBridge.h"
4
+
5
+ @interface ReactNativeLiquidGlassContainerManager : RCTViewManager
6
+ @end
@@ -0,0 +1,17 @@
1
+ #import "ReactNativeLiquidGlassContainerManager.h"
2
+ #import "ReactNativeLiquidGlassContainer.h"
3
+ #import <React/RCTUIManager.h>
4
+ #import <React/RCTLog.h>
5
+
6
+ @implementation ReactNativeLiquidGlassContainerManager
7
+
8
+ RCT_EXPORT_MODULE(ReactNativeLiquidGlassContainer)
9
+
10
+ RCT_EXPORT_VIEW_PROPERTY(spacing, double)
11
+
12
+ - (UIView *)view
13
+ {
14
+ return [[ReactNativeLiquidGlassContainer alloc] init];
15
+ }
16
+
17
+ @end
@@ -43,14 +43,19 @@ class BlurEffectView: UIVisualEffectView {
43
43
  self?.effect = UIBlurEffect(style: self?.blurStyle ?? .systemMaterial)
44
44
  }
45
45
 
46
- // Set intensity and pause
46
+ // Set intensity
47
47
  animator?.fractionComplete = intensity
48
- animator?.pauseAnimation()
48
+ // Stop the animation at the current state
49
+ DispatchQueue.main.async { [weak self] in
50
+ self?.animator?.stopAnimation(true)
51
+ self?.animator?.finishAnimation(at: .current)
52
+ }
49
53
  }
50
54
 
51
55
  deinit {
52
- animator?.stopAnimation(true)
53
- animator?.finishAnimation(at: .current)
56
+ guard let animator = animator, animator.state == .active else { return }
57
+ animator.stopAnimation(true)
58
+ animator.finishAnimation(at: .current)
54
59
  }
55
60
  }
56
61
 
@@ -69,4 +74,4 @@ struct Blur: UIViewRepresentable {
69
74
  func updateUIView(_ uiView: BlurEffectView, context: Context) {
70
75
  uiView.updateBlur(style: style, intensity: intensity)
71
76
  }
72
- }
77
+ }
@@ -0,0 +1,33 @@
1
+ import UIKit
2
+
3
+ // MARK: - Liquid Glass Container (iOS 26+ UIGlassContainerEffect)
4
+
5
+ #if compiler(>=6.2)
6
+ @objc public class LiquidGlassContainer: UIVisualEffectView {
7
+ @objc public var spacing: CGFloat = 0 {
8
+ didSet {
9
+ if #available(iOS 26.0, *) {
10
+ setupView()
11
+ }
12
+ }
13
+ }
14
+
15
+ public override func layoutSubviews() {
16
+ super.layoutSubviews()
17
+ if #available(iOS 26.0, *) {
18
+ setupView()
19
+ }
20
+ }
21
+
22
+ @available(iOS 26.0, *)
23
+ private func setupView() {
24
+ let effect = UIGlassContainerEffect()
25
+ effect.spacing = spacing
26
+ self.effect = effect
27
+ }
28
+ }
29
+ #else
30
+ @objc public class LiquidGlassContainer: UIView {
31
+ @objc public var spacing: CGFloat = 0
32
+ }
33
+ #endif
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+
3
+ import React from 'react';
4
+ import { Platform, View } from 'react-native';
5
+ import ReactNativeLiquidGlassContainer from './ReactNativeLiquidGlassContainerNativeComponent';
6
+ import { jsx as _jsx } from "react/jsx-runtime";
7
+ /**
8
+ * LiquidGlassContainer component
9
+ *
10
+ * A UIKit-based container that applies the iOS 26+ UIGlassContainerEffect.
11
+ * This component uses the liquid glass container effect with configurable spacing.
12
+ *
13
+ * Platform: iOS only (iOS 26+)
14
+ *
15
+ * @example
16
+ * ```tsx
17
+ * <LiquidGlassContainer spacing={20} style={{ flex: 1 }}>
18
+ * <Text>Content inside glass container</Text>
19
+ * </LiquidGlassContainer>
20
+ * ```
21
+ */
22
+ export const LiquidGlassContainer = ({
23
+ spacing = 0,
24
+ style,
25
+ children,
26
+ ...rest
27
+ }) => {
28
+ const isCompatibleIOS = Platform.OS === 'ios' && parseInt(Platform.Version, 10) >= 26;
29
+ if (!isCompatibleIOS) {
30
+ // Fallback to regular View on non-iOS platforms or older iOS versions
31
+ return /*#__PURE__*/_jsx(View, {
32
+ style: style,
33
+ ...rest,
34
+ children: children
35
+ });
36
+ }
37
+ return /*#__PURE__*/_jsx(ReactNativeLiquidGlassContainer, {
38
+ spacing: spacing,
39
+ style: style,
40
+ ...rest,
41
+ children: children
42
+ });
43
+ };
44
+ //# sourceMappingURL=LiquidGlassContainer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","Platform","View","ReactNativeLiquidGlassContainer","jsx","_jsx","LiquidGlassContainer","spacing","style","children","rest","isCompatibleIOS","OS","parseInt","Version"],"sourceRoot":"../../src","sources":["LiquidGlassContainer.tsx"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,QAAQ,EAAEC,IAAI,QAAwB,cAAc;AAC7D,OAAOC,+BAA+B,MAAM,kDAAkD;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAW/F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,oBAAyD,GAAGA,CAAC;EACxEC,OAAO,GAAG,CAAC;EACXC,KAAK;EACLC,QAAQ;EACR,GAAGC;AACL,CAAC,KAAK;EACJ,MAAMC,eAAe,GACnBV,QAAQ,CAACW,EAAE,KAAK,KAAK,IAAIC,QAAQ,CAACZ,QAAQ,CAACa,OAAO,EAAY,EAAE,CAAC,IAAI,EAAE;EAEzE,IAAI,CAACH,eAAe,EAAE;IACpB;IACA,oBACEN,IAAA,CAACH,IAAI;MAACM,KAAK,EAAEA,KAAM;MAAA,GAAKE,IAAI;MAAAD,QAAA,EACzBA;IAAQ,CACL,CAAC;EAEX;EAEA,oBACEJ,IAAA,CAACF,+BAA+B;IAACI,OAAO,EAAEA,OAAQ;IAACC,KAAK,EAAEA,KAAM;IAAA,GAAKE,IAAI;IAAAD,QAAA,EACtEA;EAAQ,CACsB,CAAC;AAEtC,CAAC","ignoreList":[]}
@@ -0,0 +1,17 @@
1
+ import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
2
+ import type { ViewProps } from 'react-native';
3
+ import type { Double } from 'react-native/Libraries/Types/CodegenTypes';
4
+
5
+ interface NativeProps extends ViewProps {
6
+ /**
7
+ * The spacing value for the glass container effect
8
+ * Platform: iOS only (iOS 26+)
9
+ * @default 0
10
+ */
11
+ spacing?: Double;
12
+ }
13
+
14
+ export default codegenNativeComponent<NativeProps>(
15
+ 'ReactNativeLiquidGlassContainer',
16
+ { excludedPlatforms: ['android'] }
17
+ );
@@ -7,4 +7,6 @@ export { default as ReactNativeLiquidGlassView } from './ReactNativeLiquidGlassV
7
7
  export { LiquidGlassView } from "./LiquidGlassView.js";
8
8
  export { default as ReactNativeProgressiveBlurView } from './ReactNativeProgressiveBlurViewNativeComponent';
9
9
  export { ProgressiveBlurView } from "./ProgressiveBlurView.js";
10
+ export { default as ReactNativeLiquidGlassContainer } from './ReactNativeLiquidGlassContainerNativeComponent';
11
+ export { LiquidGlassContainer } from "./LiquidGlassContainer.js";
10
12
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["default","ReactNativeBlurView","BlurView","ReactNativeLiquidGlassView","LiquidGlassView","ReactNativeProgressiveBlurView","ProgressiveBlurView"],"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;AAG1D,SAASF,OAAO,IAAIG,0BAA0B,QAAQ,6CAA6C;AAGnG,SAASC,eAAe,QAAQ,sBAAmB;AAGnD,SAASJ,OAAO,IAAIK,8BAA8B,QAAQ,iDAAiD;AAG3G,SAASC,mBAAmB,QAAQ,0BAAuB","ignoreList":[]}
1
+ {"version":3,"names":["default","ReactNativeBlurView","BlurView","ReactNativeLiquidGlassView","LiquidGlassView","ReactNativeProgressiveBlurView","ProgressiveBlurView","ReactNativeLiquidGlassContainer","LiquidGlassContainer"],"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;AAG1D,SAASF,OAAO,IAAIG,0BAA0B,QAAQ,6CAA6C;AAGnG,SAASC,eAAe,QAAQ,sBAAmB;AAGnD,SAASJ,OAAO,IAAIK,8BAA8B,QAAQ,iDAAiD;AAG3G,SAASC,mBAAmB,QAAQ,0BAAuB;AAG3D,SAASN,OAAO,IAAIO,+BAA+B,QAAQ,kDAAkD;AAE7G,SAASC,oBAAoB,QAAQ,2BAAwB","ignoreList":[]}
@@ -0,0 +1,27 @@
1
+ import React from 'react';
2
+ import { type ViewProps } from 'react-native';
3
+ export interface LiquidGlassContainerProps extends ViewProps {
4
+ /**
5
+ * The spacing value for the glass container effect
6
+ * Platform: iOS only (iOS 26+)
7
+ * @default 0
8
+ */
9
+ spacing?: number;
10
+ }
11
+ /**
12
+ * LiquidGlassContainer component
13
+ *
14
+ * A UIKit-based container that applies the iOS 26+ UIGlassContainerEffect.
15
+ * This component uses the liquid glass container effect with configurable spacing.
16
+ *
17
+ * Platform: iOS only (iOS 26+)
18
+ *
19
+ * @example
20
+ * ```tsx
21
+ * <LiquidGlassContainer spacing={20} style={{ flex: 1 }}>
22
+ * <Text>Content inside glass container</Text>
23
+ * </LiquidGlassContainer>
24
+ * ```
25
+ */
26
+ export declare const LiquidGlassContainer: React.FC<LiquidGlassContainerProps>;
27
+ //# sourceMappingURL=LiquidGlassContainer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LiquidGlassContainer.d.ts","sourceRoot":"","sources":["../../../src/LiquidGlassContainer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAkB,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAG9D,MAAM,WAAW,yBAA0B,SAAQ,SAAS;IAC1D;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,oBAAoB,EAAE,KAAK,CAAC,EAAE,CAAC,yBAAyB,CAuBpE,CAAC"}
@@ -0,0 +1,13 @@
1
+ import type { ViewProps } from 'react-native';
2
+ import type { Double } from 'react-native/Libraries/Types/CodegenTypes';
3
+ interface NativeProps extends ViewProps {
4
+ /**
5
+ * The spacing value for the glass container effect
6
+ * Platform: iOS only (iOS 26+)
7
+ * @default 0
8
+ */
9
+ spacing?: Double;
10
+ }
11
+ declare const _default: import("react-native/Libraries/Utilities/codegenNativeComponent").NativeComponentType<NativeProps>;
12
+ export default _default;
13
+ //# sourceMappingURL=ReactNativeLiquidGlassContainerNativeComponent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ReactNativeLiquidGlassContainerNativeComponent.d.ts","sourceRoot":"","sources":["../../../src/ReactNativeLiquidGlassContainerNativeComponent.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AAExE,UAAU,WAAY,SAAQ,SAAS;IACrC;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;;AAED,wBAGE"}
@@ -10,4 +10,7 @@ export { default as ReactNativeProgressiveBlurView } from './ReactNativeProgress
10
10
  export type { ProgressiveBlurDirection } from './ReactNativeProgressiveBlurViewNativeComponent';
11
11
  export { ProgressiveBlurView } from './ProgressiveBlurView';
12
12
  export type { ProgressiveBlurViewProps } from './ProgressiveBlurView';
13
+ export { default as ReactNativeLiquidGlassContainer } from './ReactNativeLiquidGlassContainerNativeComponent';
14
+ export { LiquidGlassContainer } from './LiquidGlassContainer';
15
+ export type { LiquidGlassContainerProps } from './LiquidGlassContainer';
13
16
  //# 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;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;AAE9D,OAAO,EAAE,OAAO,IAAI,8BAA8B,EAAE,MAAM,iDAAiD,CAAC;AAC5G,YAAY,EAAE,wBAAwB,EAAE,MAAM,iDAAiD,CAAC;AAEhG,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,YAAY,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,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;AAE9D,OAAO,EAAE,OAAO,IAAI,8BAA8B,EAAE,MAAM,iDAAiD,CAAC;AAC5G,YAAY,EAAE,wBAAwB,EAAE,MAAM,iDAAiD,CAAC;AAEhG,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,YAAY,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;AAEtE,OAAO,EAAE,OAAO,IAAI,+BAA+B,EAAE,MAAM,kDAAkD,CAAC;AAE9G,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,YAAY,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sbaiahmed1/react-native-blur",
3
- "version": "4.1.1",
3
+ "version": "4.2.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",
@@ -165,7 +165,8 @@
165
165
  "componentProvider": {
166
166
  "ReactNativeBlurView": "ReactNativeBlurView",
167
167
  "ReactNativeLiquidGlassView": "ReactNativeLiquidGlassView",
168
- "ReactNativeProgressiveBlurView": "ReactNativeProgressiveBlurView"
168
+ "ReactNativeProgressiveBlurView": "ReactNativeProgressiveBlurView",
169
+ "ReactNativeLiquidGlassContainer": "ReactNativeLiquidGlassContainer"
169
170
  }
170
171
  }
171
172
  },
@@ -0,0 +1,52 @@
1
+ import React from 'react';
2
+ import { Platform, View, type ViewProps } from 'react-native';
3
+ import ReactNativeLiquidGlassContainer from './ReactNativeLiquidGlassContainerNativeComponent';
4
+
5
+ export interface LiquidGlassContainerProps extends ViewProps {
6
+ /**
7
+ * The spacing value for the glass container effect
8
+ * Platform: iOS only (iOS 26+)
9
+ * @default 0
10
+ */
11
+ spacing?: number;
12
+ }
13
+
14
+ /**
15
+ * LiquidGlassContainer component
16
+ *
17
+ * A UIKit-based container that applies the iOS 26+ UIGlassContainerEffect.
18
+ * This component uses the liquid glass container effect with configurable spacing.
19
+ *
20
+ * Platform: iOS only (iOS 26+)
21
+ *
22
+ * @example
23
+ * ```tsx
24
+ * <LiquidGlassContainer spacing={20} style={{ flex: 1 }}>
25
+ * <Text>Content inside glass container</Text>
26
+ * </LiquidGlassContainer>
27
+ * ```
28
+ */
29
+ export const LiquidGlassContainer: React.FC<LiquidGlassContainerProps> = ({
30
+ spacing = 0,
31
+ style,
32
+ children,
33
+ ...rest
34
+ }) => {
35
+ const isCompatibleIOS =
36
+ Platform.OS === 'ios' && parseInt(Platform.Version as string, 10) >= 26;
37
+
38
+ if (!isCompatibleIOS) {
39
+ // Fallback to regular View on non-iOS platforms or older iOS versions
40
+ return (
41
+ <View style={style} {...rest}>
42
+ {children}
43
+ </View>
44
+ );
45
+ }
46
+
47
+ return (
48
+ <ReactNativeLiquidGlassContainer spacing={spacing} style={style} {...rest}>
49
+ {children}
50
+ </ReactNativeLiquidGlassContainer>
51
+ );
52
+ };
@@ -0,0 +1,17 @@
1
+ import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
2
+ import type { ViewProps } from 'react-native';
3
+ import type { Double } from 'react-native/Libraries/Types/CodegenTypes';
4
+
5
+ interface NativeProps extends ViewProps {
6
+ /**
7
+ * The spacing value for the glass container effect
8
+ * Platform: iOS only (iOS 26+)
9
+ * @default 0
10
+ */
11
+ spacing?: Double;
12
+ }
13
+
14
+ export default codegenNativeComponent<NativeProps>(
15
+ 'ReactNativeLiquidGlassContainer',
16
+ { excludedPlatforms: ['android'] }
17
+ );
package/src/index.tsx CHANGED
@@ -15,3 +15,8 @@ export type { ProgressiveBlurDirection } from './ReactNativeProgressiveBlurViewN
15
15
 
16
16
  export { ProgressiveBlurView } from './ProgressiveBlurView';
17
17
  export type { ProgressiveBlurViewProps } from './ProgressiveBlurView';
18
+
19
+ export { default as ReactNativeLiquidGlassContainer } from './ReactNativeLiquidGlassContainerNativeComponent';
20
+
21
+ export { LiquidGlassContainer } from './LiquidGlassContainer';
22
+ export type { LiquidGlassContainerProps } from './LiquidGlassContainer';