@sbaiahmed1/react-native-blur 4.6.1-beta.6 → 4.6.2-beta.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 (28) hide show
  1. package/README.md +2 -1
  2. package/android/app/build/generated/source/codegen/java/com/facebook/react/viewmanagers/ReactNativeBlurViewManagerDelegate.java +53 -0
  3. package/android/app/build/generated/source/codegen/java/com/facebook/react/viewmanagers/ReactNativeBlurViewManagerInterface.java +25 -0
  4. package/android/app/build/generated/source/codegen/java/com/facebook/react/viewmanagers/ReactNativeGlassEffectContainerManagerDelegate.java +53 -0
  5. package/android/app/build/generated/source/codegen/java/com/facebook/react/viewmanagers/ReactNativeGlassEffectContainerManagerInterface.java +25 -0
  6. package/android/app/build/generated/source/codegen/java/com/facebook/react/viewmanagers/ReactNativeGlassViewManagerDelegate.java +38 -0
  7. package/android/app/build/generated/source/codegen/java/com/facebook/react/viewmanagers/ReactNativeGlassViewManagerInterface.java +20 -0
  8. package/android/app/build/generated/source/codegen/jni/CMakeLists.txt +36 -0
  9. package/android/app/build/generated/source/codegen/jni/ReactNativeBlurViewSpec-generated.cpp +22 -0
  10. package/android/app/build/generated/source/codegen/jni/ReactNativeBlurViewSpec.h +24 -0
  11. package/android/app/build/generated/source/codegen/jni/react/renderer/components/ReactNativeBlurViewSpec/ComponentDescriptors.cpp +23 -0
  12. package/android/app/build/generated/source/codegen/jni/react/renderer/components/ReactNativeBlurViewSpec/ComponentDescriptors.h +25 -0
  13. package/android/app/build/generated/source/codegen/jni/react/renderer/components/ReactNativeBlurViewSpec/EventEmitters.cpp +17 -0
  14. package/android/app/build/generated/source/codegen/jni/react/renderer/components/ReactNativeBlurViewSpec/EventEmitters.h +30 -0
  15. package/android/app/build/generated/source/codegen/jni/react/renderer/components/ReactNativeBlurViewSpec/Props.cpp +46 -0
  16. package/android/app/build/generated/source/codegen/jni/react/renderer/components/ReactNativeBlurViewSpec/Props.h +131 -0
  17. package/android/app/build/generated/source/codegen/jni/react/renderer/components/ReactNativeBlurViewSpec/ReactNativeBlurViewSpecJSI-generated.cpp +17 -0
  18. package/android/app/build/generated/source/codegen/jni/react/renderer/components/ReactNativeBlurViewSpec/ReactNativeBlurViewSpecJSI.h +19 -0
  19. package/android/app/build/generated/source/codegen/jni/react/renderer/components/ReactNativeBlurViewSpec/ShadowNodes.cpp +18 -0
  20. package/android/app/build/generated/source/codegen/jni/react/renderer/components/ReactNativeBlurViewSpec/ShadowNodes.h +43 -0
  21. package/android/app/build/generated/source/codegen/jni/react/renderer/components/ReactNativeBlurViewSpec/States.cpp +16 -0
  22. package/android/app/build/generated/source/codegen/jni/react/renderer/components/ReactNativeBlurViewSpec/States.h +41 -0
  23. package/android/src/main/java/com/sbaiahmed1/reactnativeblur/ReactNativeBlurView.kt +26 -8
  24. package/android/src/main/java/com/sbaiahmed1/reactnativeblur/ReactNativeProgressiveBlurView.kt +26 -8
  25. package/ios/Helpers/ReactNativeBlurViewHelper.swift +12 -0
  26. package/ios/Views/AdvancedBlurView.swift +67 -45
  27. package/ios/Views/BlurEffectView.swift +50 -44
  28. package/package.json +1 -1
package/README.md CHANGED
@@ -7,7 +7,7 @@ A modern React Native library providing **six specialized components** for advan
7
7
  <div align="center">
8
8
  <p>
9
9
  <img src="https://img.shields.io/npm/v/@sbaiahmed1/react-native-blur?style=for-the-badge&color=blue" alt="npm version" />
10
- <img src="https://img.shields.io/npm/dt/@sbaiahmed1/react-native-blur?style=for-the-badge&color=green" alt="downloads" />
10
+ <img src="https://img.shields.io/npm/dm/%40sbaiahmed1%2Freact-native-blur?style=for-the-badge" alt="downloads per month" />
11
11
  <img src="https://img.shields.io/github/license/sbaiahmed1/react-native-blur?style=for-the-badge&color=orange" alt="license" />
12
12
  <img src="https://img.shields.io/github/stars/sbaiahmed1/react-native-blur?style=for-the-badge&color=yellow" alt="stars" />
13
13
  </p>
@@ -1001,6 +1001,7 @@ MIT
1001
1001
 
1002
1002
  <div align="center">
1003
1003
  <img src="https://img.shields.io/github/contributors/sbaiahmed1/react-native-blur?style=for-the-badge" alt="contributors" />
1004
+ <img src="https://img.shields.io/npm/dt/@sbaiahmed1/react-native-blur?style=for-the-badge&color=green" alt="downloads" />
1004
1005
  <img src="https://img.shields.io/github/last-commit/sbaiahmed1/react-native-blur?style=for-the-badge" alt="last commit" />
1005
1006
  <img src="https://img.shields.io/github/issues/sbaiahmed1/react-native-blur?style=for-the-badge" alt="issues" />
1006
1007
  <img src="https://img.shields.io/github/issues-pr/sbaiahmed1/react-native-blur?style=for-the-badge" alt="pull requests" />
@@ -0,0 +1,53 @@
1
+ /**
2
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
3
+ *
4
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
5
+ * once the code is regenerated.
6
+ *
7
+ * @generated by codegen project: GeneratePropsJavaDelegate.js
8
+ */
9
+
10
+ package com.facebook.react.viewmanagers;
11
+
12
+ import android.view.View;
13
+ import androidx.annotation.Nullable;
14
+ import com.facebook.react.uimanager.BaseViewManager;
15
+ import com.facebook.react.uimanager.BaseViewManagerDelegate;
16
+ import com.facebook.react.uimanager.LayoutShadowNode;
17
+
18
+ public class ReactNativeBlurViewManagerDelegate<T extends View, U extends BaseViewManager<T, ? extends LayoutShadowNode> & ReactNativeBlurViewManagerInterface<T>> extends BaseViewManagerDelegate<T, U> {
19
+ public ReactNativeBlurViewManagerDelegate(U viewManager) {
20
+ super(viewManager);
21
+ }
22
+ @Override
23
+ public void setProperty(T view, String propName, @Nullable Object value) {
24
+ switch (propName) {
25
+ case "glassTintColor":
26
+ mViewManager.setGlassTintColor(view, value == null ? "clear" : (String) value);
27
+ break;
28
+ case "glassOpacity":
29
+ mViewManager.setGlassOpacity(view, value == null ? 1f : ((Double) value).doubleValue());
30
+ break;
31
+ case "blurAmount":
32
+ mViewManager.setBlurAmount(view, value == null ? 10f : ((Double) value).doubleValue());
33
+ break;
34
+ case "type":
35
+ mViewManager.setType(view, (String) value);
36
+ break;
37
+ case "blurType":
38
+ mViewManager.setBlurType(view, (String) value);
39
+ break;
40
+ case "glassType":
41
+ mViewManager.setGlassType(view, (String) value);
42
+ break;
43
+ case "reducedTransparencyFallbackColor":
44
+ mViewManager.setReducedTransparencyFallbackColor(view, value == null ? "#FFFFFF" : (String) value);
45
+ break;
46
+ case "isInteractive":
47
+ mViewManager.setIsInteractive(view, value == null ? true : (boolean) value);
48
+ break;
49
+ default:
50
+ super.setProperty(view, propName, value);
51
+ }
52
+ }
53
+ }
@@ -0,0 +1,25 @@
1
+ /**
2
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
3
+ *
4
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
5
+ * once the code is regenerated.
6
+ *
7
+ * @generated by codegen project: GeneratePropsJavaInterface.js
8
+ */
9
+
10
+ package com.facebook.react.viewmanagers;
11
+
12
+ import android.view.View;
13
+ import androidx.annotation.Nullable;
14
+ import com.facebook.react.uimanager.ViewManagerWithGeneratedInterface;
15
+
16
+ public interface ReactNativeBlurViewManagerInterface<T extends View> extends ViewManagerWithGeneratedInterface {
17
+ void setGlassTintColor(T view, @Nullable String value);
18
+ void setGlassOpacity(T view, double value);
19
+ void setBlurAmount(T view, double value);
20
+ void setType(T view, @Nullable String value);
21
+ void setBlurType(T view, @Nullable String value);
22
+ void setGlassType(T view, @Nullable String value);
23
+ void setReducedTransparencyFallbackColor(T view, @Nullable String value);
24
+ void setIsInteractive(T view, boolean value);
25
+ }
@@ -0,0 +1,53 @@
1
+ /**
2
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
3
+ *
4
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
5
+ * once the code is regenerated.
6
+ *
7
+ * @generated by codegen project: GeneratePropsJavaDelegate.js
8
+ */
9
+
10
+ package com.facebook.react.viewmanagers;
11
+
12
+ import android.view.View;
13
+ import androidx.annotation.Nullable;
14
+ import com.facebook.react.uimanager.BaseViewManager;
15
+ import com.facebook.react.uimanager.BaseViewManagerDelegate;
16
+ import com.facebook.react.uimanager.LayoutShadowNode;
17
+
18
+ public class ReactNativeGlassEffectContainerManagerDelegate<T extends View, U extends BaseViewManager<T, ? extends LayoutShadowNode> & ReactNativeGlassEffectContainerManagerInterface<T>> extends BaseViewManagerDelegate<T, U> {
19
+ public ReactNativeGlassEffectContainerManagerDelegate(U viewManager) {
20
+ super(viewManager);
21
+ }
22
+ @Override
23
+ public void setProperty(T view, String propName, @Nullable Object value) {
24
+ switch (propName) {
25
+ case "glassType":
26
+ mViewManager.setGlassType(view, (String) value);
27
+ break;
28
+ case "glassTintColor":
29
+ mViewManager.setGlassTintColor(view, value == null ? "clear" : (String) value);
30
+ break;
31
+ case "glassOpacity":
32
+ mViewManager.setGlassOpacity(view, value == null ? 1f : ((Double) value).doubleValue());
33
+ break;
34
+ case "isInteractive":
35
+ mViewManager.setIsInteractive(view, value == null ? true : (boolean) value);
36
+ break;
37
+ case "spacing":
38
+ mViewManager.setSpacing(view, value == null ? 8f : ((Double) value).doubleValue());
39
+ break;
40
+ case "enableMorphing":
41
+ mViewManager.setEnableMorphing(view, value == null ? true : (boolean) value);
42
+ break;
43
+ case "morphingDuration":
44
+ mViewManager.setMorphingDuration(view, value == null ? 300 : ((Double) value).intValue());
45
+ break;
46
+ case "reducedTransparencyFallbackColor":
47
+ mViewManager.setReducedTransparencyFallbackColor(view, value == null ? "#FFFFFF" : (String) value);
48
+ break;
49
+ default:
50
+ super.setProperty(view, propName, value);
51
+ }
52
+ }
53
+ }
@@ -0,0 +1,25 @@
1
+ /**
2
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
3
+ *
4
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
5
+ * once the code is regenerated.
6
+ *
7
+ * @generated by codegen project: GeneratePropsJavaInterface.js
8
+ */
9
+
10
+ package com.facebook.react.viewmanagers;
11
+
12
+ import android.view.View;
13
+ import androidx.annotation.Nullable;
14
+ import com.facebook.react.uimanager.ViewManagerWithGeneratedInterface;
15
+
16
+ public interface ReactNativeGlassEffectContainerManagerInterface<T extends View> extends ViewManagerWithGeneratedInterface {
17
+ void setGlassType(T view, @Nullable String value);
18
+ void setGlassTintColor(T view, @Nullable String value);
19
+ void setGlassOpacity(T view, double value);
20
+ void setIsInteractive(T view, boolean value);
21
+ void setSpacing(T view, double value);
22
+ void setEnableMorphing(T view, boolean value);
23
+ void setMorphingDuration(T view, int value);
24
+ void setReducedTransparencyFallbackColor(T view, @Nullable String value);
25
+ }
@@ -0,0 +1,38 @@
1
+ /**
2
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
3
+ *
4
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
5
+ * once the code is regenerated.
6
+ *
7
+ * @generated by codegen project: GeneratePropsJavaDelegate.js
8
+ */
9
+
10
+ package com.facebook.react.viewmanagers;
11
+
12
+ import android.view.View;
13
+ import androidx.annotation.Nullable;
14
+ import com.facebook.react.uimanager.BaseViewManager;
15
+ import com.facebook.react.uimanager.BaseViewManagerDelegate;
16
+ import com.facebook.react.uimanager.LayoutShadowNode;
17
+
18
+ public class ReactNativeGlassViewManagerDelegate<T extends View, U extends BaseViewManager<T, ? extends LayoutShadowNode> & ReactNativeGlassViewManagerInterface<T>> extends BaseViewManagerDelegate<T, U> {
19
+ public ReactNativeGlassViewManagerDelegate(U viewManager) {
20
+ super(viewManager);
21
+ }
22
+ @Override
23
+ public void setProperty(T view, String propName, @Nullable Object value) {
24
+ switch (propName) {
25
+ case "glassType":
26
+ mViewManager.setGlassType(view, (String) value);
27
+ break;
28
+ case "glassAmount":
29
+ mViewManager.setGlassAmount(view, value == null ? 50f : ((Double) value).doubleValue());
30
+ break;
31
+ case "reducedTransparencyFallbackColor":
32
+ mViewManager.setReducedTransparencyFallbackColor(view, value == null ? null : (String) value);
33
+ break;
34
+ default:
35
+ super.setProperty(view, propName, value);
36
+ }
37
+ }
38
+ }
@@ -0,0 +1,20 @@
1
+ /**
2
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
3
+ *
4
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
5
+ * once the code is regenerated.
6
+ *
7
+ * @generated by codegen project: GeneratePropsJavaInterface.js
8
+ */
9
+
10
+ package com.facebook.react.viewmanagers;
11
+
12
+ import android.view.View;
13
+ import androidx.annotation.Nullable;
14
+ import com.facebook.react.uimanager.ViewManagerWithGeneratedInterface;
15
+
16
+ public interface ReactNativeGlassViewManagerInterface<T extends View> extends ViewManagerWithGeneratedInterface {
17
+ void setGlassType(T view, @Nullable String value);
18
+ void setGlassAmount(T view, double value);
19
+ void setReducedTransparencyFallbackColor(T view, @Nullable String value);
20
+ }
@@ -0,0 +1,36 @@
1
+ # Copyright (c) Meta Platforms, Inc. and affiliates.
2
+ #
3
+ # This source code is licensed under the MIT license found in the
4
+ # LICENSE file in the root directory of this source tree.
5
+
6
+ cmake_minimum_required(VERSION 3.13)
7
+ set(CMAKE_VERBOSE_MAKEFILE on)
8
+
9
+ file(GLOB react_codegen_SRCS CONFIGURE_DEPENDS *.cpp react/renderer/components/ReactNativeBlurViewSpec/*.cpp)
10
+
11
+ add_library(
12
+ react_codegen_ReactNativeBlurViewSpec
13
+ OBJECT
14
+ ${react_codegen_SRCS}
15
+ )
16
+
17
+ target_include_directories(react_codegen_ReactNativeBlurViewSpec PUBLIC . react/renderer/components/ReactNativeBlurViewSpec)
18
+
19
+ target_link_libraries(
20
+ react_codegen_ReactNativeBlurViewSpec
21
+ fbjni
22
+ jsi
23
+ # We need to link different libraries based on whether we are building rncore or not, that's necessary
24
+ # because we want to break a circular dependency between react_codegen_rncore and reactnative
25
+ reactnative
26
+ )
27
+
28
+ target_compile_options(
29
+ react_codegen_ReactNativeBlurViewSpec
30
+ PRIVATE
31
+ -DLOG_TAG=\"ReactNative\"
32
+ -fexceptions
33
+ -frtti
34
+ -std=c++20
35
+ -Wall
36
+ )
@@ -0,0 +1,22 @@
1
+
2
+ /**
3
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
+ *
5
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
6
+ * once the code is regenerated.
7
+ *
8
+ * @generated by codegen project: GenerateModuleJniCpp.js
9
+ */
10
+
11
+ #include "ReactNativeBlurViewSpec.h"
12
+
13
+ namespace facebook::react {
14
+
15
+
16
+
17
+ std::shared_ptr<TurboModule> ReactNativeBlurViewSpec_ModuleProvider(const std::string &moduleName, const JavaTurboModule::InitParams &params) {
18
+
19
+ return nullptr;
20
+ }
21
+
22
+ } // namespace facebook::react
@@ -0,0 +1,24 @@
1
+
2
+ /**
3
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
+ *
5
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
6
+ * once the code is regenerated.
7
+ *
8
+ * @generated by codegen project: GenerateModuleJniH.js
9
+ */
10
+
11
+ #pragma once
12
+
13
+ #include <ReactCommon/JavaTurboModule.h>
14
+ #include <ReactCommon/TurboModule.h>
15
+ #include <jsi/jsi.h>
16
+
17
+ namespace facebook::react {
18
+
19
+
20
+
21
+ JSI_EXPORT
22
+ std::shared_ptr<TurboModule> ReactNativeBlurViewSpec_ModuleProvider(const std::string &moduleName, const JavaTurboModule::InitParams &params);
23
+
24
+ } // namespace facebook::react
@@ -0,0 +1,23 @@
1
+
2
+ /**
3
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
+ *
5
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
6
+ * once the code is regenerated.
7
+ *
8
+ * @generated by codegen project: GenerateComponentDescriptorCpp.js
9
+ */
10
+
11
+ #include <react/renderer/components/ReactNativeBlurViewSpec/ComponentDescriptors.h>
12
+ #include <react/renderer/core/ConcreteComponentDescriptor.h>
13
+ #include <react/renderer/componentregistry/ComponentDescriptorProviderRegistry.h>
14
+
15
+ namespace facebook::react {
16
+
17
+ void ReactNativeBlurViewSpec_registerComponentDescriptorsFromCodegen(
18
+ std::shared_ptr<const ComponentDescriptorProviderRegistry> registry) {
19
+ registry->add(concreteComponentDescriptorProvider<ReactNativeBlurViewComponentDescriptor>());
20
+ registry->add(concreteComponentDescriptorProvider<ReactNativeGlassEffectContainerComponentDescriptor>());
21
+ }
22
+
23
+ } // namespace facebook::react
@@ -0,0 +1,25 @@
1
+
2
+ /**
3
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
+ *
5
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
6
+ * once the code is regenerated.
7
+ *
8
+ * @generated by codegen project: GenerateComponentDescriptorH.js
9
+ */
10
+
11
+ #pragma once
12
+
13
+ #include <react/renderer/components/ReactNativeBlurViewSpec/ShadowNodes.h>
14
+ #include <react/renderer/core/ConcreteComponentDescriptor.h>
15
+ #include <react/renderer/componentregistry/ComponentDescriptorProviderRegistry.h>
16
+
17
+ namespace facebook::react {
18
+
19
+ using ReactNativeBlurViewComponentDescriptor = ConcreteComponentDescriptor<ReactNativeBlurViewShadowNode>;
20
+ using ReactNativeGlassEffectContainerComponentDescriptor = ConcreteComponentDescriptor<ReactNativeGlassEffectContainerShadowNode>;
21
+
22
+ void ReactNativeBlurViewSpec_registerComponentDescriptorsFromCodegen(
23
+ std::shared_ptr<const ComponentDescriptorProviderRegistry> registry);
24
+
25
+ } // namespace facebook::react
@@ -0,0 +1,17 @@
1
+
2
+ /**
3
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
+ *
5
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
6
+ * once the code is regenerated.
7
+ *
8
+ * @generated by codegen project: GenerateEventEmitterCpp.js
9
+ */
10
+
11
+ #include <react/renderer/components/ReactNativeBlurViewSpec/EventEmitters.h>
12
+
13
+
14
+ namespace facebook::react {
15
+
16
+
17
+ } // namespace facebook::react
@@ -0,0 +1,30 @@
1
+
2
+ /**
3
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
+ *
5
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
6
+ * once the code is regenerated.
7
+ *
8
+ * @generated by codegen project: GenerateEventEmitterH.js
9
+ */
10
+ #pragma once
11
+
12
+ #include <react/renderer/components/view/ViewEventEmitter.h>
13
+
14
+
15
+ namespace facebook::react {
16
+ class ReactNativeBlurViewEventEmitter : public ViewEventEmitter {
17
+ public:
18
+ using ViewEventEmitter::ViewEventEmitter;
19
+
20
+
21
+
22
+ };
23
+ class ReactNativeGlassEffectContainerEventEmitter : public ViewEventEmitter {
24
+ public:
25
+ using ViewEventEmitter::ViewEventEmitter;
26
+
27
+
28
+
29
+ };
30
+ } // namespace facebook::react
@@ -0,0 +1,46 @@
1
+
2
+ /**
3
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
+ *
5
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
6
+ * once the code is regenerated.
7
+ *
8
+ * @generated by codegen project: GeneratePropsCpp.js
9
+ */
10
+
11
+ #include <react/renderer/components/ReactNativeBlurViewSpec/Props.h>
12
+ #include <react/renderer/core/PropsParserContext.h>
13
+ #include <react/renderer/core/propsConversions.h>
14
+
15
+ namespace facebook::react {
16
+
17
+ ReactNativeBlurViewProps::ReactNativeBlurViewProps(
18
+ const PropsParserContext &context,
19
+ const ReactNativeBlurViewProps &sourceProps,
20
+ const RawProps &rawProps): ViewProps(context, sourceProps, rawProps),
21
+
22
+ glassTintColor(convertRawProp(context, rawProps, "glassTintColor", sourceProps.glassTintColor, {"clear"})),
23
+ glassOpacity(convertRawProp(context, rawProps, "glassOpacity", sourceProps.glassOpacity, {1.0})),
24
+ blurAmount(convertRawProp(context, rawProps, "blurAmount", sourceProps.blurAmount, {10.0})),
25
+ type(convertRawProp(context, rawProps, "type", sourceProps.type, {ReactNativeBlurViewType::Blur})),
26
+ blurType(convertRawProp(context, rawProps, "blurType", sourceProps.blurType, {ReactNativeBlurViewBlurType::Xlight})),
27
+ glassType(convertRawProp(context, rawProps, "glassType", sourceProps.glassType, {ReactNativeBlurViewGlassType::Clear})),
28
+ reducedTransparencyFallbackColor(convertRawProp(context, rawProps, "reducedTransparencyFallbackColor", sourceProps.reducedTransparencyFallbackColor, {"#FFFFFF"})),
29
+ isInteractive(convertRawProp(context, rawProps, "isInteractive", sourceProps.isInteractive, {true}))
30
+ {}
31
+ ReactNativeGlassEffectContainerProps::ReactNativeGlassEffectContainerProps(
32
+ const PropsParserContext &context,
33
+ const ReactNativeGlassEffectContainerProps &sourceProps,
34
+ const RawProps &rawProps): ViewProps(context, sourceProps, rawProps),
35
+
36
+ glassType(convertRawProp(context, rawProps, "glassType", sourceProps.glassType, {ReactNativeGlassEffectContainerGlassType::Clear})),
37
+ glassTintColor(convertRawProp(context, rawProps, "glassTintColor", sourceProps.glassTintColor, {"clear"})),
38
+ glassOpacity(convertRawProp(context, rawProps, "glassOpacity", sourceProps.glassOpacity, {1.0})),
39
+ isInteractive(convertRawProp(context, rawProps, "isInteractive", sourceProps.isInteractive, {true})),
40
+ spacing(convertRawProp(context, rawProps, "spacing", sourceProps.spacing, {8.0})),
41
+ enableMorphing(convertRawProp(context, rawProps, "enableMorphing", sourceProps.enableMorphing, {true})),
42
+ morphingDuration(convertRawProp(context, rawProps, "morphingDuration", sourceProps.morphingDuration, {300})),
43
+ reducedTransparencyFallbackColor(convertRawProp(context, rawProps, "reducedTransparencyFallbackColor", sourceProps.reducedTransparencyFallbackColor, {"#FFFFFF"}))
44
+ {}
45
+
46
+ } // namespace facebook::react
@@ -0,0 +1,131 @@
1
+
2
+ /**
3
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
+ *
5
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
6
+ * once the code is regenerated.
7
+ *
8
+ * @generated by codegen project: GeneratePropsH.js
9
+ */
10
+ #pragma once
11
+
12
+ #include <react/renderer/components/view/ViewProps.h>
13
+ #include <react/renderer/core/PropsParserContext.h>
14
+
15
+ namespace facebook::react {
16
+
17
+ enum class ReactNativeBlurViewType { Blur, LiquidGlass };
18
+
19
+ static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, ReactNativeBlurViewType &result) {
20
+ auto string = (std::string)value;
21
+ if (string == "blur") { result = ReactNativeBlurViewType::Blur; return; }
22
+ if (string == "liquidGlass") { result = ReactNativeBlurViewType::LiquidGlass; return; }
23
+ abort();
24
+ }
25
+
26
+ static inline std::string toString(const ReactNativeBlurViewType &value) {
27
+ switch (value) {
28
+ case ReactNativeBlurViewType::Blur: return "blur";
29
+ case ReactNativeBlurViewType::LiquidGlass: return "liquidGlass";
30
+ }
31
+ }
32
+ enum class ReactNativeBlurViewBlurType { Xlight, Light, Dark, ExtraDark, Regular, Prominent, SystemUltraThinMaterial, SystemThinMaterial, SystemMaterial, SystemThickMaterial, SystemChromeMaterial };
33
+
34
+ static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, ReactNativeBlurViewBlurType &result) {
35
+ auto string = (std::string)value;
36
+ if (string == "xlight") { result = ReactNativeBlurViewBlurType::Xlight; return; }
37
+ if (string == "light") { result = ReactNativeBlurViewBlurType::Light; return; }
38
+ if (string == "dark") { result = ReactNativeBlurViewBlurType::Dark; return; }
39
+ if (string == "extraDark") { result = ReactNativeBlurViewBlurType::ExtraDark; return; }
40
+ if (string == "regular") { result = ReactNativeBlurViewBlurType::Regular; return; }
41
+ if (string == "prominent") { result = ReactNativeBlurViewBlurType::Prominent; return; }
42
+ if (string == "systemUltraThinMaterial") { result = ReactNativeBlurViewBlurType::SystemUltraThinMaterial; return; }
43
+ if (string == "systemThinMaterial") { result = ReactNativeBlurViewBlurType::SystemThinMaterial; return; }
44
+ if (string == "systemMaterial") { result = ReactNativeBlurViewBlurType::SystemMaterial; return; }
45
+ if (string == "systemThickMaterial") { result = ReactNativeBlurViewBlurType::SystemThickMaterial; return; }
46
+ if (string == "systemChromeMaterial") { result = ReactNativeBlurViewBlurType::SystemChromeMaterial; return; }
47
+ abort();
48
+ }
49
+
50
+ static inline std::string toString(const ReactNativeBlurViewBlurType &value) {
51
+ switch (value) {
52
+ case ReactNativeBlurViewBlurType::Xlight: return "xlight";
53
+ case ReactNativeBlurViewBlurType::Light: return "light";
54
+ case ReactNativeBlurViewBlurType::Dark: return "dark";
55
+ case ReactNativeBlurViewBlurType::ExtraDark: return "extraDark";
56
+ case ReactNativeBlurViewBlurType::Regular: return "regular";
57
+ case ReactNativeBlurViewBlurType::Prominent: return "prominent";
58
+ case ReactNativeBlurViewBlurType::SystemUltraThinMaterial: return "systemUltraThinMaterial";
59
+ case ReactNativeBlurViewBlurType::SystemThinMaterial: return "systemThinMaterial";
60
+ case ReactNativeBlurViewBlurType::SystemMaterial: return "systemMaterial";
61
+ case ReactNativeBlurViewBlurType::SystemThickMaterial: return "systemThickMaterial";
62
+ case ReactNativeBlurViewBlurType::SystemChromeMaterial: return "systemChromeMaterial";
63
+ }
64
+ }
65
+ enum class ReactNativeBlurViewGlassType { Clear, Regular };
66
+
67
+ static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, ReactNativeBlurViewGlassType &result) {
68
+ auto string = (std::string)value;
69
+ if (string == "clear") { result = ReactNativeBlurViewGlassType::Clear; return; }
70
+ if (string == "regular") { result = ReactNativeBlurViewGlassType::Regular; return; }
71
+ abort();
72
+ }
73
+
74
+ static inline std::string toString(const ReactNativeBlurViewGlassType &value) {
75
+ switch (value) {
76
+ case ReactNativeBlurViewGlassType::Clear: return "clear";
77
+ case ReactNativeBlurViewGlassType::Regular: return "regular";
78
+ }
79
+ }
80
+
81
+ class ReactNativeBlurViewProps final : public ViewProps {
82
+ public:
83
+ ReactNativeBlurViewProps() = default;
84
+ ReactNativeBlurViewProps(const PropsParserContext& context, const ReactNativeBlurViewProps &sourceProps, const RawProps &rawProps);
85
+
86
+ #pragma mark - Props
87
+
88
+ std::string glassTintColor{"clear"};
89
+ double glassOpacity{1.0};
90
+ double blurAmount{10.0};
91
+ ReactNativeBlurViewType type{ReactNativeBlurViewType::Blur};
92
+ ReactNativeBlurViewBlurType blurType{ReactNativeBlurViewBlurType::Xlight};
93
+ ReactNativeBlurViewGlassType glassType{ReactNativeBlurViewGlassType::Clear};
94
+ std::string reducedTransparencyFallbackColor{"#FFFFFF"};
95
+ bool isInteractive{true};
96
+ };
97
+
98
+ enum class ReactNativeGlassEffectContainerGlassType { Clear, Regular };
99
+
100
+ static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, ReactNativeGlassEffectContainerGlassType &result) {
101
+ auto string = (std::string)value;
102
+ if (string == "clear") { result = ReactNativeGlassEffectContainerGlassType::Clear; return; }
103
+ if (string == "regular") { result = ReactNativeGlassEffectContainerGlassType::Regular; return; }
104
+ abort();
105
+ }
106
+
107
+ static inline std::string toString(const ReactNativeGlassEffectContainerGlassType &value) {
108
+ switch (value) {
109
+ case ReactNativeGlassEffectContainerGlassType::Clear: return "clear";
110
+ case ReactNativeGlassEffectContainerGlassType::Regular: return "regular";
111
+ }
112
+ }
113
+
114
+ class ReactNativeGlassEffectContainerProps final : public ViewProps {
115
+ public:
116
+ ReactNativeGlassEffectContainerProps() = default;
117
+ ReactNativeGlassEffectContainerProps(const PropsParserContext& context, const ReactNativeGlassEffectContainerProps &sourceProps, const RawProps &rawProps);
118
+
119
+ #pragma mark - Props
120
+
121
+ ReactNativeGlassEffectContainerGlassType glassType{ReactNativeGlassEffectContainerGlassType::Clear};
122
+ std::string glassTintColor{"clear"};
123
+ double glassOpacity{1.0};
124
+ bool isInteractive{true};
125
+ double spacing{8.0};
126
+ bool enableMorphing{true};
127
+ int morphingDuration{300};
128
+ std::string reducedTransparencyFallbackColor{"#FFFFFF"};
129
+ };
130
+
131
+ } // namespace facebook::react
@@ -0,0 +1,17 @@
1
+ /**
2
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
3
+ *
4
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
5
+ * once the code is regenerated.
6
+ *
7
+ * @generated by codegen project: GenerateModuleCpp.js
8
+ */
9
+
10
+ #include "ReactNativeBlurViewSpecJSI.h"
11
+
12
+ namespace facebook::react {
13
+
14
+
15
+
16
+
17
+ } // namespace facebook::react
@@ -0,0 +1,19 @@
1
+ /**
2
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
3
+ *
4
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
5
+ * once the code is regenerated.
6
+ *
7
+ * @generated by codegen project: GenerateModuleH.js
8
+ */
9
+
10
+ #pragma once
11
+
12
+ #include <ReactCommon/TurboModule.h>
13
+ #include <react/bridging/Bridging.h>
14
+
15
+ namespace facebook::react {
16
+
17
+
18
+
19
+ } // namespace facebook::react
@@ -0,0 +1,18 @@
1
+
2
+ /**
3
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
+ *
5
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
6
+ * once the code is regenerated.
7
+ *
8
+ * @generated by codegen project: GenerateShadowNodeCpp.js
9
+ */
10
+
11
+ #include <react/renderer/components/ReactNativeBlurViewSpec/ShadowNodes.h>
12
+
13
+ namespace facebook::react {
14
+
15
+ extern const char ReactNativeBlurViewComponentName[] = "ReactNativeBlurView";
16
+ extern const char ReactNativeGlassEffectContainerComponentName[] = "ReactNativeGlassEffectContainer";
17
+
18
+ } // namespace facebook::react
@@ -0,0 +1,43 @@
1
+
2
+ /**
3
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
+ *
5
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
6
+ * once the code is regenerated.
7
+ *
8
+ * @generated by codegen project: GenerateShadowNodeH.js
9
+ */
10
+
11
+ #pragma once
12
+
13
+ #include <react/renderer/components/ReactNativeBlurViewSpec/EventEmitters.h>
14
+ #include <react/renderer/components/ReactNativeBlurViewSpec/Props.h>
15
+ #include <react/renderer/components/ReactNativeBlurViewSpec/States.h>
16
+ #include <react/renderer/components/view/ConcreteViewShadowNode.h>
17
+ #include <jsi/jsi.h>
18
+
19
+ namespace facebook::react {
20
+
21
+ JSI_EXPORT extern const char ReactNativeBlurViewComponentName[];
22
+
23
+ /*
24
+ * `ShadowNode` for <ReactNativeBlurView> component.
25
+ */
26
+ using ReactNativeBlurViewShadowNode = ConcreteViewShadowNode<
27
+ ReactNativeBlurViewComponentName,
28
+ ReactNativeBlurViewProps,
29
+ ReactNativeBlurViewEventEmitter,
30
+ ReactNativeBlurViewState>;
31
+
32
+ JSI_EXPORT extern const char ReactNativeGlassEffectContainerComponentName[];
33
+
34
+ /*
35
+ * `ShadowNode` for <ReactNativeGlassEffectContainer> component.
36
+ */
37
+ using ReactNativeGlassEffectContainerShadowNode = ConcreteViewShadowNode<
38
+ ReactNativeGlassEffectContainerComponentName,
39
+ ReactNativeGlassEffectContainerProps,
40
+ ReactNativeGlassEffectContainerEventEmitter,
41
+ ReactNativeGlassEffectContainerState>;
42
+
43
+ } // namespace facebook::react
@@ -0,0 +1,16 @@
1
+
2
+ /**
3
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
+ *
5
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
6
+ * once the code is regenerated.
7
+ *
8
+ * @generated by codegen project: GenerateStateCpp.js
9
+ */
10
+ #include <react/renderer/components/ReactNativeBlurViewSpec/States.h>
11
+
12
+ namespace facebook::react {
13
+
14
+
15
+
16
+ } // namespace facebook::react
@@ -0,0 +1,41 @@
1
+ /**
2
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
3
+ *
4
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
5
+ * once the code is regenerated.
6
+ *
7
+ * @generated by codegen project: GenerateStateH.js
8
+ */
9
+ #pragma once
10
+
11
+ #ifdef ANDROID
12
+ #include <folly/dynamic.h>
13
+ #endif
14
+
15
+ namespace facebook::react {
16
+
17
+ class ReactNativeBlurViewState {
18
+ public:
19
+ ReactNativeBlurViewState() = default;
20
+
21
+ #ifdef ANDROID
22
+ ReactNativeBlurViewState(ReactNativeBlurViewState const &previousState, folly::dynamic data){};
23
+ folly::dynamic getDynamic() const {
24
+ return {};
25
+ };
26
+ #endif
27
+ };
28
+
29
+ class ReactNativeGlassEffectContainerState {
30
+ public:
31
+ ReactNativeGlassEffectContainerState() = default;
32
+
33
+ #ifdef ANDROID
34
+ ReactNativeGlassEffectContainerState(ReactNativeGlassEffectContainerState const &previousState, folly::dynamic data){};
35
+ folly::dynamic getDynamic() const {
36
+ return {};
37
+ };
38
+ #endif
39
+ };
40
+
41
+ } // namespace facebook::react
@@ -187,16 +187,18 @@ class ReactNativeBlurView : BlurViewGroup {
187
187
  /**
188
188
  * Finds the optimal view to use as blur capture root.
189
189
  *
190
- * Returns the nearest react-native-screens Screen ancestor if found, which scopes
191
- * the blur to the current screen and prevents capturing navigation transitions.
192
- *
193
- * Returns null when no Screen ancestor exists (e.g. modals, standalone usage).
194
- * A null return means swapBlurRootToScreenAncestor() is a no-op and QmBlurView
195
- * keeps its default decor view as the blur root this is correct for modals
196
- * because they need to blur the content behind them (in the main activity window).
190
+ * Priority:
191
+ * 1. Nearest react-native-screens Screen ancestor scopes blur to the current
192
+ * screen and prevents capturing navigation transition artifacts.
193
+ * 2. Nearest ReactRootView ancestor scopes blur to the React Native root when
194
+ * the component is not inside a Screen (e.g. plain View hierarchies). Without
195
+ * this fallback, QmBlurView defaults to the activity decor view and blurs the
196
+ * entire screen instead of just the component area (issue #89).
197
+ * 3. null — returned for modals, which intentionally need to blur content from
198
+ * the main activity window (decor view is correct there).
197
199
  */
198
200
  private fun findOptimalBlurRoot(): ViewGroup? {
199
- return findNearestScreenAncestor()
201
+ return findNearestScreenAncestor() ?: findNearestReactRootView()
200
202
  }
201
203
 
202
204
  /**
@@ -214,6 +216,22 @@ class ReactNativeBlurView : BlurViewGroup {
214
216
  return null
215
217
  }
216
218
 
219
+ /**
220
+ * Walks up the view hierarchy looking for the React Native root view.
221
+ * Used as a fallback when no Screen ancestor exists, to scope the blur
222
+ * capture to the RN root rather than the full activity decor view.
223
+ */
224
+ private fun findNearestReactRootView(): ViewGroup? {
225
+ var currentParent = this.parent
226
+ while (currentParent != null) {
227
+ if (currentParent.javaClass.name == "com.facebook.react.ReactRootView") {
228
+ return currentParent as? ViewGroup
229
+ }
230
+ currentParent = currentParent.parent
231
+ }
232
+ return null
233
+ }
234
+
217
235
  /**
218
236
  * Initialize the blur view with current settings.
219
237
  * Called after the view is attached and the blur root has been swapped.
@@ -209,16 +209,18 @@ class ReactNativeProgressiveBlurView : FrameLayout {
209
209
  /**
210
210
  * Finds the optimal view to use as blur capture root.
211
211
  *
212
- * Returns the nearest react-native-screens Screen ancestor if found, which scopes
213
- * the blur to the current screen and prevents capturing navigation transitions.
214
- *
215
- * Returns null when no Screen ancestor exists (e.g. modals, standalone usage).
216
- * A null return means swapBlurRootToScreenAncestor() is a no-op and QmBlurView
217
- * keeps its default decor view as the blur root this is correct for modals
218
- * because they need to blur the content behind them (in the main activity window).
212
+ * Priority:
213
+ * 1. Nearest react-native-screens Screen ancestor scopes blur to the current
214
+ * screen and prevents capturing navigation transition artifacts.
215
+ * 2. Nearest ReactRootView ancestor scopes blur to the React Native root when
216
+ * the component is not inside a Screen (e.g. plain View hierarchies). Without
217
+ * this fallback, QmBlurView defaults to the activity decor view and blurs the
218
+ * entire screen instead of just the component area (issue #89).
219
+ * 3. null — returned for modals, which intentionally need to blur content from
220
+ * the main activity window (decor view is correct there).
219
221
  */
220
222
  private fun findOptimalBlurRoot(): ViewGroup? {
221
- return findNearestScreenAncestor()
223
+ return findNearestScreenAncestor() ?: findNearestReactRootView()
222
224
  }
223
225
 
224
226
  /**
@@ -235,6 +237,22 @@ class ReactNativeProgressiveBlurView : FrameLayout {
235
237
  return null
236
238
  }
237
239
 
240
+ /**
241
+ * Walks up the view hierarchy looking for the React Native root view.
242
+ * Used as a fallback when no Screen ancestor exists, to scope the blur
243
+ * capture to the RN root rather than the full activity decor view.
244
+ */
245
+ private fun findNearestReactRootView(): ViewGroup? {
246
+ var currentParent = this.parent
247
+ while (currentParent != null) {
248
+ if (currentParent.javaClass.name == "com.facebook.react.ReactRootView") {
249
+ return currentParent as? ViewGroup
250
+ }
251
+ currentParent = currentParent.parent
252
+ }
253
+ return null
254
+ }
255
+
238
256
  override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) {
239
257
  val width = MeasureSpec.getSize(widthMeasureSpec)
240
258
  val height = MeasureSpec.getSize(heightMeasureSpec)
@@ -1,23 +1,35 @@
1
+ // ReactNativeBlurViewHelper.swift
2
+
3
+ import SwiftUI
1
4
  import UIKit
2
5
 
6
+ // MARK: - Objective-C Bridging Helpers
7
+
3
8
  @objc public class ReactNativeBlurViewHelper: NSObject {
9
+
10
+ /// Creates and returns a blur view.
4
11
  @objc public static func createBlurViewWithFrame(_ frame: CGRect) -> AdvancedBlurView {
5
12
  return AdvancedBlurView(frame: frame)
6
13
  }
7
14
 
15
+ /// Updates the blur view with a new blur amount.
8
16
  @objc public static func updateBlurView(_ blurView: AdvancedBlurView, withBlurAmount blurAmount: Double) {
9
17
  blurView.blurAmount = blurAmount
10
18
  }
11
19
 
20
+ /// Updates the blur view with a new blur type.
12
21
  @objc public static func updateBlurView(_ blurView: AdvancedBlurView, withBlurType blurType: String) {
13
22
  blurView.blurTypeString = blurType
14
23
  }
15
24
 
25
+ /// Updates the blur view with a new reduced transparency fallback color.
16
26
  @objc public static func updateBlurView(_ blurView: AdvancedBlurView, withReducedTransparencyFallbackColor reducedTransparencyFallbackColor: UIColor) {
17
27
  blurView.reducedTransparencyFallbackColor = reducedTransparencyFallbackColor
18
28
  }
19
29
 
30
+ /// Updates the blur view with a new ignoreSafeArea value.
20
31
  @objc public static func updateBlurView(_ blurView: AdvancedBlurView, withIgnoringSafeArea ignoreSafeArea: Bool) {
21
32
  blurView.ignoreSafeArea = ignoreSafeArea
22
33
  }
23
34
  }
35
+
@@ -1,8 +1,11 @@
1
+ import SwiftUI
1
2
  import UIKit
2
3
 
4
+ // MARK: - UIKit Wrapper for Blur
5
+
3
6
  @objc public class AdvancedBlurView: UIView {
4
- private let blurEffectView = BlurEffectView(effect: nil)
5
- private let fallbackView = UIView()
7
+
8
+ private var hostingController: UIHostingController<BasicColoredView>?
6
9
 
7
10
  @objc public var blurAmount: Double = 10.0 {
8
11
  didSet {
@@ -26,63 +29,79 @@ import UIKit
26
29
  didSet {
27
30
  updateView()
28
31
  }
29
- }
32
+ }
30
33
 
31
34
  public override init(frame: CGRect) {
32
35
  super.init(frame: frame)
33
- setupViews()
34
36
  }
35
37
 
36
38
  required init?(coder: NSCoder) {
37
39
  super.init(coder: coder)
38
- setupViews()
39
- }
40
-
41
- private func setupViews() {
42
- blurEffectView.isUserInteractionEnabled = false
43
- fallbackView.isUserInteractionEnabled = false
44
- addSubview(fallbackView)
45
- addSubview(blurEffectView)
46
- syncBackgroundLayersToBack()
47
- updateView()
48
40
  }
49
41
 
50
- private func syncBackgroundLayersToBack() {
51
- if fallbackView.superview === self {
52
- sendSubviewToBack(fallbackView)
53
- }
54
- if blurEffectView.superview === self {
55
- sendSubviewToBack(blurEffectView)
42
+ public override func layoutSubviews() {
43
+ super.layoutSubviews()
44
+ // Defer controller setup until we have a valid frame to avoid issues with initial render
45
+ // in complex layouts (e.g. FlashList with dynamic content)
46
+ if hostingController == nil && bounds.width > 0 && bounds.height > 0 {
47
+ setupHostingController()
56
48
  }
57
49
  }
58
50
 
59
- public override func didAddSubview(_ subview: UIView) {
60
- super.didAddSubview(subview)
61
- if subview !== blurEffectView && subview !== fallbackView {
62
- syncBackgroundLayersToBack()
51
+ private func setupHostingController() {
52
+ // Completely remove old hosting controller
53
+ if let oldHosting = hostingController {
54
+ oldHosting.view.removeFromSuperview()
55
+ oldHosting.removeFromParent()
63
56
  }
64
- }
57
+ hostingController = nil
65
58
 
66
- public override func layoutSubviews() {
67
- super.layoutSubviews()
68
- fallbackView.frame = bounds
69
- blurEffectView.frame = bounds
59
+ let blurStyle = blurStyleFromString(blurTypeString)
60
+ let swiftUIView = BasicColoredView(
61
+ blurAmount: blurAmount,
62
+ blurStyle: blurStyle,
63
+ ignoreSafeArea: ignoreSafeArea,
64
+ reducedTransparencyFallbackColor: reducedTransparencyFallbackColor
65
+ )
66
+
67
+ let hosting = UIHostingController(rootView: swiftUIView)
68
+ hosting.view.backgroundColor = .clear
69
+ hosting.view.translatesAutoresizingMaskIntoConstraints = false
70
+
71
+ // Insert at index 0 to ensure it stays behind any potential subviews (though usually this view has no children)
72
+ // This fixes the z-ordering bug where blur covers content
73
+ if !subviews.isEmpty {
74
+ insertSubview(hosting.view, at: 0)
75
+ } else {
76
+ addSubview(hosting.view)
77
+ }
78
+
79
+ NSLayoutConstraint.activate([
80
+ hosting.view.topAnchor.constraint(equalTo: topAnchor),
81
+ hosting.view.leadingAnchor.constraint(equalTo: leadingAnchor),
82
+ hosting.view.trailingAnchor.constraint(equalTo: trailingAnchor),
83
+ hosting.view.bottomAnchor.constraint(equalTo: bottomAnchor)
84
+ ])
85
+
86
+ self.hostingController = hosting
70
87
  }
71
88
 
72
89
  private func updateView() {
73
- if UIAccessibility.isReduceTransparencyEnabled {
74
- fallbackView.isHidden = false
75
- blurEffectView.isHidden = true
76
- fallbackView.backgroundColor = reducedTransparencyFallbackColor
77
- return
90
+ if let hosting = hostingController {
91
+ // Update the existing controller's root view to avoid expensive recreation
92
+ // This fixes performance bottlenecks and state synchronization issues
93
+ let blurStyle = blurStyleFromString(blurTypeString)
94
+ let swiftUIView = BasicColoredView(
95
+ blurAmount: blurAmount,
96
+ blurStyle: blurStyle,
97
+ ignoreSafeArea: ignoreSafeArea,
98
+ reducedTransparencyFallbackColor: reducedTransparencyFallbackColor
99
+ )
100
+ hosting.rootView = swiftUIView
101
+ hosting.view.setNeedsLayout()
102
+ } else {
103
+ setupHostingController()
78
104
  }
79
-
80
- fallbackView.isHidden = true
81
- blurEffectView.isHidden = false
82
- let blurStyle = blurStyleFromString(blurTypeString)
83
- let intensity = mapBlurAmountToIntensity(blurAmount)
84
- blurEffectView.updateBlur(style: blurStyle, intensity: intensity)
85
- blurEffectView.setNeedsDisplay()
86
105
  }
87
106
 
88
107
  public override func didMoveToSuperview() {
@@ -91,10 +110,13 @@ import UIKit
91
110
 
92
111
  public override func didMoveToWindow() {
93
112
  super.didMoveToWindow()
94
- if window != nil {
95
- updateView()
96
- }
97
113
  }
98
114
 
99
- deinit {}
115
+ deinit {
116
+ if let hosting = hostingController {
117
+ hosting.view.removeFromSuperview()
118
+ hosting.removeFromParent()
119
+ }
120
+ hostingController = nil
121
+ }
100
122
  }
@@ -1,72 +1,78 @@
1
- import UIKit
1
+ // BlurEffectView.swift
2
+
2
3
  import SwiftUI
4
+ import UIKit
5
+
6
+ // MARK: - Blur View with proper intensity control
3
7
 
4
8
  class BlurEffectView: UIVisualEffectView {
5
9
  private var animator: UIViewPropertyAnimator?
6
- private var blurStyle: UIBlurEffect.Style = .systemMaterial {
7
- didSet {
8
- visualEffect = UIBlurEffect(style: blurStyle)
9
- }
10
- }
11
- private var intensity: Double = 0.1 {
12
- didSet {
13
- setNeedsDisplay()
14
- }
15
- }
16
- private var visualEffect: UIVisualEffect = UIBlurEffect(style: .systemMaterial) {
17
- didSet {
18
- setNeedsDisplay()
19
- }
20
- }
10
+ private var blurStyle: UIBlurEffect.Style = .systemMaterial
11
+ private var intensity: Double = 1.0
21
12
 
22
13
  override init(effect: UIVisualEffect?) {
23
- super.init(effect: nil)
14
+ super.init(effect: effect)
15
+ setupBlur()
24
16
  }
25
17
 
26
18
  required init?(coder: NSCoder) {
27
- return nil
19
+ super.init(coder: coder)
20
+ setupBlur()
28
21
  }
29
22
 
30
23
  func updateBlur(style: UIBlurEffect.Style, intensity: Double) {
31
- blurStyle = style
32
- self.intensity = min(max(intensity, 0.0), 1.0)
33
- setNeedsDisplay()
24
+ // Skip expensive animator recreation when nothing changed.
25
+ // During FlashList recycling, updateUIView fires on every layout pass
26
+ // even when props are identical, causing jank (issue #100).
27
+ guard style != self.blurStyle || intensity != self.intensity else { return }
28
+ self.blurStyle = style
29
+ self.intensity = intensity
30
+ setupBlur()
34
31
  }
35
32
 
36
- override func draw(_ rect: CGRect) {
37
- super.draw(rect)
38
-
39
- // Avoid animator-based blur during Detox so tests don't hang waiting for app idleness.
40
- if isDetoxPresent() {
41
- effect = intensity > 0 ? visualEffect : nil
42
- return
43
- }
33
+ override func didMoveToWindow() {
34
+ super.didMoveToWindow()
35
+ guard window != nil else { return }
36
+ // UIKit resumes paused CAAnimations when a view re-joins a window
37
+ // (e.g. after modal dismiss + re-present). If the animation plays
38
+ // toward its end state the blur drifts to full intensity. Re-pause
39
+ // and re-set the fraction here to lock it back to our intended value.
40
+ // pausesOnCompletion = true (set in setupBlur) ensures the animator
41
+ // stays .active even if it reaches fraction 1.0, so this is always safe.
42
+ animator?.pauseAnimation()
43
+ animator?.fractionComplete = intensity
44
+ }
44
45
 
45
- if intensity <= 0 {
46
- effect = nil
47
- animator?.stopAnimation(true)
48
- return
46
+ private func setupBlur() {
47
+ if let existing = animator, existing.state == .active {
48
+ existing.stopAnimation(true)
49
49
  }
50
-
51
- let normalizedIntensity = max(0.01, min(1.0, intensity))
50
+ animator = nil
52
51
 
53
52
  effect = nil
54
- animator?.stopAnimation(true)
55
- animator = UIViewPropertyAnimator(duration: 1, curve: .linear) { [unowned self] in
56
- self.effect = visualEffect
53
+
54
+ let newAnimator = UIViewPropertyAnimator(duration: 1, curve: .linear)
55
+ newAnimator.addAnimations { [weak self] in
56
+ self?.effect = UIBlurEffect(style: self?.blurStyle ?? .systemMaterial)
57
57
  }
58
- animator?.fractionComplete = CGFloat(normalizedIntensity)
58
+ // pausesOnCompletion: if UIKit ever resumes and runs this to the end,
59
+ // the animator stays .active (paused at 1.0) instead of going .inactive.
60
+ // This guarantees didMoveToWindow can always call pauseAnimation() safely.
61
+ newAnimator.pausesOnCompletion = true
62
+ newAnimator.startAnimation()
63
+ newAnimator.pauseAnimation()
64
+ newAnimator.fractionComplete = intensity
65
+ animator = newAnimator
59
66
  }
60
67
 
61
68
  deinit {
62
- animator?.stopAnimation(true)
69
+ if let animator = animator, animator.state == .active {
70
+ animator.stopAnimation(true)
71
+ }
63
72
  }
64
73
  }
65
74
 
66
- private func isDetoxPresent() -> Bool {
67
- let args = ProcessInfo.processInfo.arguments
68
- return args.contains("-detoxServer") && args.contains("-detoxSessionId")
69
- }
75
+ // MARK: - SwiftUI Blur Wrapper
70
76
 
71
77
  struct Blur: UIViewRepresentable {
72
78
  var style: UIBlurEffect.Style = .systemMaterial
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sbaiahmed1/react-native-blur",
3
- "version": "4.6.1-beta.6",
3
+ "version": "4.6.2-beta.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",