react-native-blur: [Android] Crash on screen navigation

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

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 22
  • Comments: 22

Most upvoted comments

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.

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)

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
       - ...