feat: update android blurview to 2.0.2 (#478)

* feat: update android blurview to 2.0.2

* chore: release 4.1.0
This commit is contained in:
Thibault Malbranche 2022-07-22 13:40:58 +02:00 committed by GitHub
parent 359231ec81
commit af4974a394
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 19 additions and 11 deletions

View File

@ -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()) {

View File

@ -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<BlurView> {
.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;
}

View File

@ -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 @@
]
]
}
}
}