Skip to content

Commit af4974a

Browse files
authored
feat: update android blurview to 2.0.2 (#478)
* feat: update android blurview to 2.0.2 * chore: release 4.1.0
1 parent 359231e commit af4974a

File tree

4 files changed

+19
-11
lines changed

4 files changed

+19
-11
lines changed

android/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,8 @@ dependencies {
127127
//noinspection GradleDynamicVersion
128128
implementation "com.facebook.react:react-native:+"
129129
// From node_modules
130-
131-
implementation 'com.github.Dimezis:BlurView:version-1.6.6'
130+
131+
implementation 'com.github.Dimezis:BlurView:version-2.0.2'
132132
}
133133

134134
if (isNewArchitectureEnabled()) {

android/src/main/java/com/reactnativecommunity/BlurViewManager.java renamed to android/src/main/java/com/reactnativecommunity/blurview/BlurViewManager.java

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
package com.reactnativecommunity.blurview;
22

33
import android.graphics.drawable.Drawable;
4+
import android.os.Build;
45
import android.view.View;
56
import android.view.ViewGroup;
6-
import com.facebook.react.uimanager.SimpleViewManager;
77
import com.facebook.react.uimanager.ThemedReactContext;
88
import com.facebook.react.uimanager.ViewGroupManager;
99
import com.facebook.react.uimanager.annotations.ReactProp;
10+
1011
import eightbitlab.com.blurview.BlurView;
12+
import eightbitlab.com.blurview.RenderEffectBlur;
1113
import eightbitlab.com.blurview.RenderScriptBlur;
14+
1215
import java.util.Objects;
1316
import javax.annotation.Nonnull;
1417

@@ -34,12 +37,17 @@ class BlurViewManager extends ViewGroupManager<BlurView> {
3437
.getDecorView();
3538
ViewGroup rootView = decorView.findViewById(android.R.id.content);
3639
Drawable windowBackground = decorView.getBackground();
37-
blurView
38-
.setupWith(rootView)
39-
.setFrameClearDrawable(windowBackground)
40-
.setBlurAlgorithm(new RenderScriptBlur(ctx))
41-
.setBlurRadius(defaultRadius)
42-
.setHasFixedTransformationMatrix(false);
40+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
41+
blurView
42+
.setupWith(rootView, new RenderEffectBlur())
43+
.setFrameClearDrawable(windowBackground)
44+
.setBlurRadius(defaultRadius);
45+
} else {
46+
blurView
47+
.setupWith(rootView, new RenderScriptBlur(ctx))
48+
.setFrameClearDrawable(windowBackground)
49+
.setBlurRadius(defaultRadius);
50+
}
4351
return blurView;
4452
}
4553

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@react-native-community/blur",
3-
"version": "4.0.0",
3+
"version": "4.1.0",
44
"description": "React Native Blur component",
55
"main": "lib/commonjs/index",
66
"module": "lib/module/index",
@@ -148,4 +148,4 @@
148148
]
149149
]
150150
}
151-
}
151+
}

0 commit comments

Comments
 (0)