react-native-blur: Can't use multiple BlurView on Android

Bug report

Summary

Firstly thank you for this great repo. And sadly, as like the title said, can’t use multiple BlurView on Android devices. Multiple like; FlatList item or another BlurView component on the screen. Same as like https://github.com/react-native-community/react-native-blur/issues/384 issue said, it’s working fine if there is only one BlurView on the screen. If the second one, app crashes.

I think so many people faces with this issue. It would be great if you look at it and check other issue. It’s a very useful library. @Kureev @vonovak @msand

Environment info

react-native info output:

System:
    OS: macOS 10.15.6
    CPU: (6) x64 Intel(R) Core(TM) i5-8500B CPU @ 3.00GHz
    Memory: 46.96 MB / 8.00 GB
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 14.3.0 - /usr/local/bin/node
    Yarn: 1.22.4 - /usr/local/bin/yarn
    npm: 6.14.4 - /usr/local/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  Managers:
    CocoaPods: 1.9.3 - /usr/local/bin/pod
  SDKs:
    iOS SDK:
      Platforms: iOS 13.6, DriverKit 19.0, macOS 10.15, tvOS 13.4, watchOS 6.2
    Android SDK:
      API Levels: 23, 25, 26, 27, 28, 29
      Build Tools: 27.0.3, 28.0.3, 29.0.2
      System Images: android-28 | Intel x86 Atom_64, android-28 | Google Play Intel x86 Atom
      Android NDK: Not Found
  IDEs:
    Android Studio: 3.5 AI-191.8026.42.35.5900203
    Xcode: 11.6/11E708 - /usr/bin/xcodebuild
  Languages:
    Java: 1.8.0_222 - /usr/bin/javac
    Python: 2.7.16 - /usr/bin/python
  npmPackages:
    @react-native-community/cli: Not Found
    react: 16.11.0 => 16.11.0 
    react-native: 0.62.2 => 0.62.2 
  npmGlobalPackages:
    *react-native*: Not Found

Library version:

    "react": "16.11.0",
    "react-native": "0.62.2",
    "@react-native-community/blur": "^3.6.0",

Steps to reproduce

Error output:

	16:21:52.039	AndroidRuntime	FATAL EXCEPTION: main
Process: com.sadelabs.messdfuupdater, PID: 17992
java.lang.IndexOutOfBoundsException: Index: 1, Size: 0
	at java.util.ArrayList.get(ArrayList.java:437)
	at android.view.ViewGroup.getAndVerifyPreorderedView(ViewGroup.java:3622)
	at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4094)
	at android.view.View.draw(View.java:19298)
	at android.view.View.draw(View.java:19165)
	at android.view.ViewGroup.drawChild(ViewGroup.java:4310)
	at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4096)
	at com.facebook.react.views.view.ReactViewGroup.dispatchDraw(ReactViewGroup.java:703)
	at android.view.View.draw(View.java:19163)
	at android.view.ViewGroup.drawChild(ViewGroup.java:4310)
	at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4096)
	at com.facebook.react.views.view.ReactViewGroup.dispatchDraw(ReactViewGroup.java:703)
	at android.view.View.draw(View.java:19298)
	at android.view.View.draw(View.java:19165)
	at android.view.ViewGroup.drawChild(ViewGroup.java:4310)
	at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4096)
	at com.facebook.react.ReactRootView.dispatchDraw(ReactRootView.java:232)
	at android.view.View.draw(View.java:19163)
	at android.view.ViewGroup.drawChild(ViewGroup.java:4310)
	at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4096)
	at android.view.View.draw(View.java:19298)
	at eightbitlab.com.blurview.BlockingBlurController.updateBlur(BlockingBlurController.java:149)
	at eightbitlab.com.blurview.BlockingBlurController.draw(BlockingBlurController.java:225)
	at eightbitlab.com.blurview.BlurView.draw(BlurView.java:51)
	at android.view.View.draw(View.java:19165)
	at android.view.ViewGroup.drawChild(ViewGroup.java:4310)
	at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4096)
	at com.facebook.react.views.view.ReactViewGroup.dispatchDraw(ReactViewGroup.java:703)
	at android.view.View.draw(View.java:19298)
	at android.view.View.draw(View.java:19165)
	at android.view.ViewGroup.drawChild(ViewGroup.java:4310)
	at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4096)
	at com.facebook.react.views.view.ReactViewGroup.dispatchDraw(ReactViewGroup.java:703)
	at android.view.View.draw(View.java:19163)
	at android.view.ViewGroup.drawChild(ViewGroup.java:4310)
	at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4096)
	at com.facebook.react.views.view.ReactViewGroup.dispatchDraw(ReactViewGroup.java:703)
	at android.view.View.draw(View.java:19163)
	at android.view.ViewGroup.drawChild(ViewGroup.java:4310)
	at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4096)
	at android.view.View.draw(View.java:19298)
	at android.widget.ScrollView.draw(ScrollView.java:1777)
	at com.facebook.react.views.scroll.ReactScrollView.draw(ReactScrollView.java:451)
	at android.view.View.draw(View.java:19165)
	at android.view.ViewGroup.drawChild(ViewGroup.java:4310)
	at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4096)
	at android.view.View.draw(View.java:19298)
	at android.view.View.draw(View.java:19165)
	at android.view.ViewGroup.drawChild(ViewGroup.java:4310)
	at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4096)
	at com.facebook.react.views.view.ReactViewGroup.dispatchDraw(ReactViewGroup.java:703)
	at android.view.View.draw(View.java:19163)
	at android.view.ViewGroup.drawChild(ViewGroup.java:4310)
	at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4096)
	at com.facebook.react.views.view.ReactViewGroup.dispatchDraw(ReactViewGroup.java:703)
	at android.view.View.draw(View.java:19298)
	at android.view.View.draw(View.java:19165)
	at android.view.ViewGroup.drawChild(ViewGroup.java:4310)
	at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4096)
	at com.facebook.react.ReactRootView.dispatchDraw(ReactRootView.java:232)
	at android.view.View.draw(View.java:19163)
	at android.view.ViewGroup.drawChild(ViewGroup.java:4310)
	at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4096)
	at android.view.View.draw(View.java:19298)

Reproducible sample code

Code sample:

...
...
    <FlatList
        ...
        ...
        renderItem={renderListItem}
    />
...
...
    const renderListItem =  ({item}) => {
        return(
            <View>
                <Text> Blur view </Text>
                <BlurView style={absolute} ...props />
            </View>
        )
    } 

About this issue

  • Original URL
  • State: open
  • Created 4 years ago
  • Reactions: 32
  • Comments: 25 (1 by maintainers)

Most upvoted comments

This library is garbage

This library is garbage

@sanch941 then do it better and stop hating on other people’s work, which they’ve put countless hours into.

add implementation('com.eightbitlab:blurview:1.6.6') { force = true } in app/build.gradle. It working for me. Something crash app 😦((

Same use case here 🙃

Is there any solution? Facing the same issue here

There is a user-modified version that includes a fix for the Blur library, try it. Use in package: “@react-native-community/blur”: “https://github.com/flyingSAP/react-native-blur”,

I’m having the issue here. It always crashes when the situation involves a BlurView and an animation. Having multiple blurred views is fine for me tho.

I think this is a problem with Dimezis BlurView https://github.com/Dimezis/BlurView/issues/110

Still not able to use multiple BlurView in a single page. Crashes the application for Android whereas works fine with iOS.