From af4974a394da7662e45c3bbdfb46971aad694f93 Mon Sep 17 00:00:00 2001 From: Thibault Malbranche Date: Fri, 22 Jul 2022 13:40:58 +0200 Subject: [PATCH] feat: update android blurview to 2.0.2 (#478) * feat: update android blurview to 2.0.2 * chore: release 4.1.0 --- android/build.gradle | 4 ++-- .../{ => blurview}/BlurViewManager.java | 22 +++++++++++++------ .../{ => blurview}/BlurViewPackage.java | 0 package.json | 4 ++-- 4 files changed, 19 insertions(+), 11 deletions(-) rename android/src/main/java/com/reactnativecommunity/{ => blurview}/BlurViewManager.java (78%) rename android/src/main/java/com/reactnativecommunity/{ => blurview}/BlurViewPackage.java (100%) diff --git a/android/build.gradle b/android/build.gradle index 3305c6cb..114bd06d 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -127,8 +127,8 @@ dependencies { //noinspection GradleDynamicVersion implementation "com.facebook.react:react-native:+" // From node_modules - - implementation 'com.github.Dimezis:BlurView:version-1.6.6' + + implementation 'com.github.Dimezis:BlurView:version-2.0.2' } if (isNewArchitectureEnabled()) { diff --git a/android/src/main/java/com/reactnativecommunity/BlurViewManager.java b/android/src/main/java/com/reactnativecommunity/blurview/BlurViewManager.java similarity index 78% rename from android/src/main/java/com/reactnativecommunity/BlurViewManager.java rename to android/src/main/java/com/reactnativecommunity/blurview/BlurViewManager.java index 683c5b81..7c2e1dea 100644 --- a/android/src/main/java/com/reactnativecommunity/BlurViewManager.java +++ b/android/src/main/java/com/reactnativecommunity/blurview/BlurViewManager.java @@ -1,14 +1,17 @@ package com.reactnativecommunity.blurview; import android.graphics.drawable.Drawable; +import android.os.Build; import android.view.View; import android.view.ViewGroup; -import com.facebook.react.uimanager.SimpleViewManager; import com.facebook.react.uimanager.ThemedReactContext; import com.facebook.react.uimanager.ViewGroupManager; import com.facebook.react.uimanager.annotations.ReactProp; + import eightbitlab.com.blurview.BlurView; +import eightbitlab.com.blurview.RenderEffectBlur; import eightbitlab.com.blurview.RenderScriptBlur; + import java.util.Objects; import javax.annotation.Nonnull; @@ -34,12 +37,17 @@ class BlurViewManager extends ViewGroupManager { .getDecorView(); ViewGroup rootView = decorView.findViewById(android.R.id.content); Drawable windowBackground = decorView.getBackground(); - blurView - .setupWith(rootView) - .setFrameClearDrawable(windowBackground) - .setBlurAlgorithm(new RenderScriptBlur(ctx)) - .setBlurRadius(defaultRadius) - .setHasFixedTransformationMatrix(false); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) { + blurView + .setupWith(rootView, new RenderEffectBlur()) + .setFrameClearDrawable(windowBackground) + .setBlurRadius(defaultRadius); + } else { + blurView + .setupWith(rootView, new RenderScriptBlur(ctx)) + .setFrameClearDrawable(windowBackground) + .setBlurRadius(defaultRadius); + } return blurView; } diff --git a/android/src/main/java/com/reactnativecommunity/BlurViewPackage.java b/android/src/main/java/com/reactnativecommunity/blurview/BlurViewPackage.java similarity index 100% rename from android/src/main/java/com/reactnativecommunity/BlurViewPackage.java rename to android/src/main/java/com/reactnativecommunity/blurview/BlurViewPackage.java diff --git a/package.json b/package.json index 0f7f4c47..5a9e38b5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@react-native-community/blur", - "version": "4.0.0", + "version": "4.1.0", "description": "React Native Blur component", "main": "lib/commonjs/index", "module": "lib/module/index", @@ -148,4 +148,4 @@ ] ] } -} \ No newline at end of file +}