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

[Android] Crash on screen navigation

Open TommysG opened this issue 2 years ago • 13 comments

The app is crashing without error when i add the BlurView component in my stack screen.

Workaround

<Stack.Navigator screenOptions={{animationEnabled: false}}>
  ...
  ...
</Stack.Navigator>

But i don't have the nice transitions between the screens.

Any solution for this?

Versions

"@react-navigation/native": "^6.0.8", "@react-navigation/stack": "^6.1.1" "@react-native-community/blur": "^3.6.0" "@react-navigation/bottom-tabs": "^6.2.0",

TommysG avatar Feb 26 '22 18:02 TommysG

Update!!!

The problem is not with navigation Stack it's when using bottom Tabs. I placed the screen with the blurview out of the Bottom Tabs, in my initial Stack Screen and it's working fine.

The order of my Navigation (Stack/Tabs) now is like this:

-- Initial Stack
    -- Tabs Navigator 
       - Screen 1
       - Screen 2
       - ...
    -- Stack
       - Screen 1 with blur
       - Screen 2 with blur
       - ...

TommysG avatar Mar 26 '22 17:03 TommysG

same problem

star-heng avatar Mar 27 '22 08:03 star-heng

same here !

YounesKHENIFER avatar Apr 06 '22 10:04 YounesKHENIFER

Hi everyone, I provided a reproduction of this issue in react-native-screens repo. If you check the log, you will find that it's happening because of react native screens.

It seems the author is not responding to the issue.

If you comment in that issue, I think it will catch the attention of the author. The issue link : https://github.com/software-mansion/react-native-screens/issues/1287#issuecomment-1074883686

mjm918 avatar Apr 09 '22 01:04 mjm918

Same problem

JiSikKim avatar May 05 '22 12:05 JiSikKim

Same Problem Here.

Josiahhenry23 avatar May 20 '22 00:05 Josiahhenry23

i have re-written the lib to work correctly on new RN version => https://www.npmjs.com/package/rn-id-blurview need some support so the react community take it to replace this package that seems to not be maintained anymore

idrissakhi avatar May 20 '22 09:05 idrissakhi

i have re-written the lib to work correctly on new RN version => https://www.npmjs.com/package/rn-id-blurview need some support so the react community take it to replace this package that seems to not be maintained anymore

On Android i'm still getting this Exception while using it inside a StackScreen which is wrapped inside BottomTabs and i'm navigating from ScreenA to ScreenB inside the StackScreen.

java.lang.IndexOutOfBoundsException: Index: 1, Size: 0

FATAL EXCEPTION: main
Process: com.awesometsproject, PID: 9847
java.lang.IndexOutOfBoundsException: Index: 1, Size: 0
	at java.util.ArrayList.get(ArrayList.java:437)
	at android.view.ViewGroup.getAndVerifyPreorderedView(ViewGroup.java:3659)
	at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4147)
	at com.facebook.react.views.view.ReactViewGroup.dispatchDraw(ReactViewGroup.java:744)
	at android.view.View.draw(View.java:21293)
	at android.view.ViewGroup.drawChild(ViewGroup.java:4388)
	at com.facebook.react.views.view.ReactViewGroup.drawChild(ReactViewGroup.java:772)
	at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4149)
	at com.facebook.react.views.view.ReactViewGroup.dispatchDraw(ReactViewGroup.java:744)
	at android.view.View.draw(View.java:21424)
	at android.view.View.draw(View.java:21295)
	at android.view.ViewGroup.drawChild(ViewGroup.java:4388)
	at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4149)
	at com.facebook.react.ReactRootView.dispatchDraw(ReactRootView.java:226)
	at android.view.View.draw(View.java:21293)
	at android.view.ViewGroup.drawChild(ViewGroup.java:4388)
	at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4149)
	at android.view.View.draw(View.java:21424)
	at eightbitlab.com.blurview.BlockingBlurController.updateBlur(BlockingBlurController.java:113)
	at eightbitlab.com.blurview.BlockingBlurController$1.onPreDraw(BlockingBlurController.java:53)
	at android.view.ViewTreeObserver.dispatchOnPreDraw(ViewTreeObserver.java:1088)
	at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2745)
	at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1721)
	at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7598)
	at android.view.Choreographer$CallbackRecord.run(Choreographer.java:966)
	at android.view.Choreographer.doCallbacks(Choreographer.java:790)
	at android.view.Choreographer.doFrame(Choreographer.java:725)
	at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:951)
	at android.os.Handler.handleCallback(Handler.java:883)
	at android.os.Handler.dispatchMessage(Handler.java:100)
	at android.os.Looper.loop(Looper.java:214)
	at android.app.ActivityThread.main(ActivityThread.java:7356)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)

TommysG avatar May 20 '22 17:05 TommysG

java.lang.IndexOutOfBoundsException

Hi @TommysG last time we found out that the crash happens because of the Android BlurView & also because of react-native-screens. There was a PR to fix the issue in react-native-screens which can be found here . Use this PR to fix the issue.

I checked the repo of @idrissakhi and noticed that the repo is using the latest version of BlurView. So I think it should solve your crash issue

mjm918 avatar May 20 '22 18:05 mjm918

I can confirm that @idrissakhi fork didn't work for me.

These are the packages I had installed

    "react-native": "0.64.3",
    "@react-navigation/native": "^6.0.2",
    "@react-navigation/native-stack": "^6.1.0",
    "react-native-screens": "^3.13.1",

aaly00 avatar Jun 04 '22 01:06 aaly00

Same here !

devin989 avatar Jun 13 '22 07:06 devin989

I have the same issue but This is cuz of position absolute in style.But if you remove that then blurView is not visible

ZaidQ797 avatar Sep 28 '22 14:09 ZaidQ797

It doesn't crash for me but just doesn't work - it's a solid color on Android (Galaxy S22, Android 12)

<BlurView
  blurType="dark"
  style={StyleSheet.absoluteFill}
  reducedTransparencyFallbackColor={DarkTheme.background.grey80}
  blurAmount={4}
  blurRadius={5}
/>

sekoyo avatar Oct 12 '22 17:10 sekoyo

This patch helped me to resolve this issue.

  • yarn add @[email protected] (the patch is for 4.2.0)
  • in package.json add: "scripts": { "postinstall": "patch-package" }
  • yarn add patch-package postinstall-postinstall
  • create under root "patches" directory
  • copy this patch inside "patches"
  • yarn

chenop avatar Nov 22 '22 12:11 chenop

The problem disappear when I remove the animation on the stack navigator from react-navigation/native-stack :

import { createNativeStackNavigator } from "@react-navigation/native-stack";

const HomeStack = createNativeStackNavigator();

export default function PartiesNavigator() {
  return (
    <HomeStack.Navigator
      initialRouteName="HomeStack"
      screenOptions={{
        presentation: "card",
        animation: "none", // <=====  I ADDED THIS LINE
      }}
    >
      <HomeStack.Screen
        name="Homescreen"
        component={Homescreen}
      />

      <HomeStack.Screen // <=====  THIS IS THE SCREEN USING THE BLURVIEW 
        name="ScreenUsingBlurView"
        component={ScreenUsingBlurView}
      />
    </HomeStack.Navigator>
  );
}

It's still not a fix as I would like to have the default card animation on Android.

samvoults avatar Mar 25 '23 15:03 samvoults

good

leil309 avatar Apr 21 '23 05:04 leil309

Should be fixed on latest

Titozzz avatar May 01 '23 21:05 Titozzz

hmm still experiencing the issue.


react-native-blur version 4.3.2 rn: 0.71.3 react-navigation v6

vlimag avatar May 08 '23 16:05 vlimag

I've tested and the issue was fixed

react-native: 0.71.6 @react-native-community/blur: 4.3.2 @react-navigation: v6

archidigital avatar May 30 '23 14:05 archidigital

Same issue also, not fixed for me

react-native-blur version 4.3.2 rn: 0.71.1 react-navigation v6

bpeyrouBDHIS avatar Jun 05 '23 14:06 bpeyrouBDHIS

I'm facing the same issue, not fixed for me.

zahid502 avatar Jun 15 '23 15:06 zahid502

Also facing the same issue and unable to resolve by removing navigation animations.

MarcusDelvecchio avatar Aug 21 '23 16:08 MarcusDelvecchio

The problem disappear when I remove the animation on the stack navigator from react-navigation/native-stack :

import { createNativeStackNavigator } from "@react-navigation/native-stack";

const HomeStack = createNativeStackNavigator();

export default function PartiesNavigator() {
  return (
    <HomeStack.Navigator
      initialRouteName="HomeStack"
      screenOptions={{
        presentation: "card",
        animation: "none", // <=====  I ADDED THIS LINE
      }}
    >
      <HomeStack.Screen
        name="Homescreen"
        component={Homescreen}
      />

      <HomeStack.Screen // <=====  THIS IS THE SCREEN USING THE BLURVIEW 
        name="ScreenUsingBlurView"
        component={ScreenUsingBlurView}
      />
    </HomeStack.Navigator>
  );
}

It's still not a fix as I would like to have the default card animation on Android.

thx it works

zero19124 avatar May 06 '24 08:05 zero19124