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 4 years ago
  • Reactions: 12
  • Comments: 33 (1 by maintainers)

Most upvoted comments

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 RenderScriptBlur object? See https://github.com/Dimezis/BlurView/issues/111#issuecomment-582119313

EDIT 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)?

I am getting the NullPointerException as well. I’m only ever rendering one BlurView. It is positioned absolutely.

@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

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

Same here. v4.3.0

it is solved by with the version 3.6.1 but 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”,