react-native-blur icon indicating copy to clipboard operation
react-native-blur copied to clipboard

Can't use multiple BlurView on Android

Open ezranbayantemur opened this issue 5 years ago • 25 comments

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>
        )
    } 

ezranbayantemur avatar Aug 31 '20 13:08 ezranbayantemur

Same here

lucaspereirasouzat avatar Sep 03 '20 03:09 lucaspereirasouzat

I'm also getting a lot of crashes like this on my app and i only have 1 BlueView component

32 minutes ago on app version 3145742
Samsung Galaxy M01s (a10s), 2816MB RAM, Android 10
Report 1

java.lang.IndexOutOfBoundsException: 
  at java.util.ArrayList.get (ArrayList.java:437)
  at android.view.ViewGroup.getAndVerifyPreorderedView (ViewGroup.java:4468)
  at android.view.ViewGroup.dispatchDraw (ViewGroup.java:4984)
  at com.facebook.react.views.view.ReactViewGroup.dispatchDraw (ReactViewGroup.java:3)
  at android.view.View.draw (View.java:23060)
  at android.view.ViewGroup.drawChild (ViewGroup.java:5230)
  at android.view.ViewGroup.dispatchDraw (ViewGroup.java:4987)
  at android.view.View.draw (View.java:23060)
  at android.view.ViewGroup.drawChild (ViewGroup.java:5230)
  at android.view.ViewGroup.dispatchDraw (ViewGroup.java:4987)
  at android.view.View.draw (View.java:23060)
  at android.view.ViewGroup.drawChild (ViewGroup.java:5230)
  at android.view.ViewGroup.dispatchDraw (ViewGroup.java:4987)
  at android.view.View.draw (View.java:23060)
  at android.view.ViewGroup.drawChild (ViewGroup.java:5230)
  at android.view.ViewGroup.dispatchDraw (ViewGroup.java:4987)
  at com.facebook.react.views.view.ReactViewGroup.dispatchDraw (ReactViewGroup.java:3)
  at android.view.View.draw (View.java:23060)
  at android.view.ViewGroup.drawChild (ViewGroup.java:5230)
  at android.view.ViewGroup.dispatchDraw (ViewGroup.java:4987)
  at com.facebook.react.views.view.ReactViewGroup.dispatchDraw (ReactViewGroup.java:3)
  at android.view.View.draw (View.java:23193)
  at android.view.View.draw (View.java:23062)
  at android.view.ViewGroup.drawChild (ViewGroup.java:5230)
  at android.view.ViewGroup.dispatchDraw (ViewGroup.java:4987)
  at com.facebook.react.views.view.ReactViewGroup.dispatchDraw (ReactViewGroup.java:3)
  at android.view.View.draw (View.java:23060)
  at android.view.ViewGroup.drawChild (ViewGroup.java:5230)
  at android.view.ViewGroup.dispatchDraw (ViewGroup.java:4987)
  at com.facebook.react.views.view.ReactViewGroup.dispatchDraw (ReactViewGroup.java:3)
  at android.view.View.draw (View.java:23060)
  at android.view.ViewGroup.drawChild (ViewGroup.java:5230)
  at android.view.ViewGroup.dispatchDraw (ViewGroup.java:4987)
  at com.facebook.react.views.view.ReactViewGroup.dispatchDraw (ReactViewGroup.java:3)
  at android.view.View.draw (View.java:23060)
  at android.view.ViewGroup.drawChild (ViewGroup.java:5230)
  at android.view.ViewGroup.dispatchDraw (ViewGroup.java:4987)
  at com.facebook.react.ReactRootView.dispatchDraw (ReactRootView.java)
  at android.view.View.draw (View.java:23060)
  at android.view.ViewGroup.drawChild (ViewGroup.java:5230)
  at android.view.ViewGroup.dispatchDraw (ViewGroup.java:4987)
  at android.view.View.draw (View.java:23193)
  at eightbitlab.com.blurview.BlockingBlurController.b (BlockingBlurController.java:49)
  at eightbitlab.com.blurview.BlockingBlurController$1.onPreDraw (BlockingBlurController.java:2)
  at android.view.ViewTreeObserver.dispatchOnPreDraw (ViewTreeObserver.java:1102)
  at android.view.ViewRootImpl.performTraversals (ViewRootImpl.java:3310)
  at android.view.ViewRootImpl.doTraversal (ViewRootImpl.java:2200)
  at android.view.ViewRootImpl$TraversalRunnable.run (ViewRootImpl.java:9065)
  at android.view.Choreographer$CallbackRecord.run (Choreographer.java:999)
  at android.view.Choreographer.doCallbacks (Choreographer.java:797)
  at android.view.Choreographer.doFrame (Choreographer.java:732)
  at android.view.Choreographer$FrameDisplayEventReceiver.run (Choreographer.java:984)
  at android.os.Handler.handleCallback (Handler.java:883)
  at android.os.Handler.dispatchMessage (Handler.java:100)
  at android.os.Looper.loop (Looper.java:237)
  at android.app.ActivityThread.main (ActivityThread.java:8019)
  at java.lang.reflect.Method.invoke (Method.java)
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:493)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1100)

brunoaduarte avatar Sep 14 '20 15:09 brunoaduarte

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

jong-hui avatar Sep 23 '20 08:09 jong-hui

Is there any solution?

chepicov avatar Nov 14 '20 23:11 chepicov

Is there any solution? Facing the same issue here

mawais78 avatar Nov 21 '20 23:11 mawais78

Same use case here 🙃

peetzweg avatar Nov 25 '20 11:11 peetzweg

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.

JSharles avatar Nov 27 '20 09:11 JSharles

I'm also having the same issue. Please help us. Thanks a lot

anhquan291 avatar Dec 15 '20 02:12 anhquan291

Updates ?

invyctus92 avatar Jan 21 '21 20:01 invyctus92

Someone came up with a solution?

DawidRubch avatar Jan 22 '21 17:01 DawidRubch

Is probably addressed with https://github.com/Kureev/react-native-blur/pull/411 now, waiting for merge though.

ja-ka avatar Feb 27 '21 06:02 ja-ka

Someone came up with a solution?

carlg0020 avatar Mar 16 '21 02:03 carlg0020

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",

invyctus92 avatar Mar 16 '21 09:03 invyctus92

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

prathamnemade avatar May 24 '21 17:05 prathamnemade

Same here

marcoantoni0 avatar Jun 11 '21 03:06 marcoantoni0

same issue here in android

parmarkamlesh avatar Jun 14 '21 07:06 parmarkamlesh

Still same issue on Android

yigithanyucedag avatar Aug 09 '21 15:08 yigithanyucedag

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

phuocantd avatar Aug 13 '21 07:08 phuocantd

This library is garbage

sanch941 avatar Sep 06 '21 05:09 sanch941

This library is garbage

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

mrousavy avatar Sep 06 '21 08:09 mrousavy

when I upgrade to "com.eightbitlab:blurview:1.6.6", it's still crash.

Changcumt avatar Sep 06 '21 08:09 Changcumt

Interested is someone tried to use it in FlatList? On iOS works good, but Android version seems like goes out borders and blurs whole row with blured item. I have 2 lists, one horizontal and one vertical. Horizontal one is completely blured, while vertical with 2 columns blurs only rows with blured item, no matter one or two have BlurView

Newbas avatar Sep 25 '21 10:09 Newbas

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

works for me. thank you!

valeriashpiner avatar Oct 14 '21 18:10 valeriashpiner

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

works for me. thank you!

I'm not sure but sometimes it crashes the app

phuocantd avatar Oct 15 '21 04:10 phuocantd

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

Works for me too, but wondering why it can fix the IndexOutOfBoundsException error?

Iamivan1996 avatar Aug 09 '22 03:08 Iamivan1996