react-native-blur: Android crash
We see a fair number of these show up in our bug reporting system:
java.lang.NullPointerException
Objects.java:220java.util.Objects.requireNonNull
BlurViewManager.java:35com.cmcewen.blurview.BlurViewManager.createViewInstance
BlurViewManager.java:20com.cmcewen.blurview.BlurViewManager.createViewInstance
ViewManager.java:47com.facebook.react.uimanager.ViewManager.createView
NativeViewHierarchyManager.java:256com.facebook.react.uimanager.NativeViewHierarchyManager.createView
UIViewOperationQueue.java:200com.facebook.react.uimanager.UIViewOperationQueue$CreateViewOperation.execute
UIViewOperationQueue.java:911com.facebook.react.uimanager.UIViewOperationQueue$1.run
UIViewOperationQueue.java:1025com.facebook.react.uimanager.UIViewOperationQueue.flushPendingBatches
UIViewOperationQueue.java:46com.facebook.react.uimanager.UIViewOperationQueue.access$2600
UIViewOperationQueue.java:983com.facebook.react.uimanager.UIViewOperationQueue$2.runGuarded
GuardedRunnable.java:24com.facebook.react.bridge.GuardedRunnable.run
About this issue
- Original URL
- State: open
- Created 6 years ago
- Reactions: 16
- Comments: 41 (1 by maintainers)
This is a pretty common issue. Apparently Android limits the number of BlurViews per activity to 1, this is a limitation of the eightbitlab.com.blurview.BlurView library.
So if you have multiple
<BlurView />views per screen, your app will crash on Android.My advice, don’t render BlurViews for Android, limit it to an iOS only feature. See the current list of Android issues
EDIT: Is this react-native library re-using the
RenderScriptBlurobject? See https://github.com/Dimezis/BlurView/issues/111#issuecomment-582119313EDIT 2: Maybe the library author might be able to help if someone creates a quick (non-react-native) repro for him (see https://github.com/Dimezis/BlurView/issues/110#issuecomment-764922464)
My app is also crashing in some parts or slowing down when using BlurView on Android when setting the position style to absolute.
I have a HOC for a loader when saving changes on my app, the blur is showed up on the entire screen, most of the times it works well but I have two specific pages in which the blur causes problems, either slowing down the app or crashing it
@Kureev any ideas when 3.6.1 will be published on npm? Thank you!
Any timeline for when we’re going to release/publish 3.6.1 to fix this issue?
Same here, latest 4.3.2. Any way I can help (provide logs, other informations)?
Same here. v4.3.0
I created a patch for v4.3.2 based on this PR and it worked like magic. We have applied the patch almost a month ago, and no issues reported since then.
Here is my patch file: @react-native-community+blur+4.3.2.patch
Same here. v4.2.0
I am getting the NullPointerException as well. I’m only ever rendering one BlurView. It is positioned absolutely.
I remember working around this years ago by avoiding multiple instances. But you may want to consider react native skia now for this.
same issue on PlayStore review. I’m gonna delete this library for now
Same as @elgambet, I have this problem too, only happens on prod for some devices. here’s the error in Appcenter Crashlytics
Using:
Still having this problem, it only happens on prod for some devices, receive the following tracktrace on crashlytics:
Using:
@sebas21. It looks like he doesn’t delete the methods, but changes the create View Instance method, adding a null check so that there is no crash
Same here. v4.3.0
When this will be resolved? I’m having v4.3.0 of the package. Still crashes rising up…
it is solved by with the version
3.6.1but not published on npm, add following to your package.json:“@react-native-community/blur”: “https://github.com/Kureev/react-native-blur/archive/refs/tags/v3.6.1.tar.gz”,
Fix: https://github.com/Kureev/react-native-blur/pull/411