ReactVision / viro

ViroReact: The AR and VR library for React Native ๐Ÿ“ณ๐Ÿ’™๐Ÿ’›๐Ÿค๐Ÿ’š
MIT License
1.41k stars 164 forks source link

Crash during destruction #221

Closed illi-homz closed 1 year ago

illi-homz commented 1 year ago

when I destroy the navigator with the scene, the application crashes (

first I did navigation.goBack() - which took me back to the product detail, then the app started to crash then I decided to hide the navigator by condition, this also crashes the application

Logcat in Android Studio

2023-07-13 10:20:08.139 21129-21129/com.zvet E/libEGL: call to OpenGL ES API with no current context (logged once per thread)
2023-07-13 10:20:08.145 21129-21129/com.zvet E/native: E0000 00:00:1689232808.145230   21129 scheduler.cc:283] INTERNAL: RET_CHECK failure (third_party/mediapipe/framework/scheduler.cc:283) state_ != STATE_NOT_STARTED (0 vs. 0) 
    Stack trace:
2023-07-13 10:20:08.145 21129-21129/com.zvet E/native: E0000 00:00:1689232808.145691   21129 normal_detector_cpu.cc:233] Error graph_->WaitUntilIdle():INTERNAL: RET_CHECK failure (third_party/mediapipe/framework/scheduler.cc:283) state_ != STATE_NOT_STARTED (0 vs. 0) 
    === Source Location Trace: === 
    third_party/mediapipe/framework/scheduler.cc:283
    third_party/mediapipe/framework/calculator_graph.cc:847
2023-07-13 10:20:08.354 21129-23191/com.zvet E/AndroidRuntime: FATAL EXCEPTION: GLThread 16269
    Process: com.zvet, PID: 21129
    java.lang.NullPointerException: Attempt to invoke virtual method 'android.view.SurfaceHolder android.opengl.GLSurfaceView.getHolder()' on a null object reference
        at com.viro.core.ViroViewARCore$ViroARRenderer.onSurfaceChanged(ViroViewARCore.java:300)
        at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1575)
        at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1286)

my package.json

"dependencies": {
    "@gorhom/bottom-sheet": "^4.4.6",
    "@ptomasroos/react-native-multi-slider": "^2.2.2",
    "@react-native-async-storage/async-storage": "^1.15.17",
    "@react-navigation/bottom-tabs": "6.0.9",
    "@react-navigation/native": "6.0.6",
    "@react-navigation/native-stack": "6.2.5",
    "@react-navigation/stack": "6.0.11",
    "@viro-community/react-viro": "2.23.0",
    "intl": "^1.2.5",
    "lottie-react-native": "^5.1.4",
    "mindbox-sdk": "^1.0.2",
    "react": "17.0.2",
    "react-native": "0.66.5",
    "react-native-appsflyer": "6.8.2",
    "react-native-dotenv": "3.2.0",
    "react-native-geolocation-service": "^5.3.0-beta.4",
    "react-native-gesture-handler": "^1.10.3",
    "react-native-get-random-values": "^1.8.0",
    "react-native-image-picker": "^4.1.2",
    "react-native-image-zoom-viewer": "3.0.1",
    "react-native-keyboard-manager": "^6.5.4-4",
    "react-native-linear-gradient": "^2.5.6",
    "react-native-masked-text": "^1.13.0",
    "react-native-modal": "^13.0.0",
    "react-native-reanimated": "2.10.0",
    "react-native-render-html": "^6.3.4",
    "react-native-safe-area-context": "^3.3.2",
    "react-native-screens": "^3.9.0",
    "react-native-shadow": "^1.2.2",
    "react-native-skeleton-content-nonexpo": "^1.0.13",
    "react-native-splash-screen": "3.2.0",
    "react-native-svg": "^12.1.1",
    "react-native-svg-transformer": "^0.14.3",
    "react-native-webview": "^11.23.1",
    "react-native-yamap": "^4.1.17",
    "react-navigation-heavy-screen": "^1.2.1",
    "swr": "^1.3.0",
    "uuid": "^9.0.0"
}

RactNative Navigation navigator

const animation = Platform.select({
    ios: {},
    web: {},
    windows: {},
    native: {},
    macos: {},
    android: {
        presentation: 'modal',
        gestureDirection: 'vertical-inverted',
    },
});

<Stack.Navigator
    screenOptions={{ headerShown: false }}
    // detachInactiveScreens={false}
    initialRouteName={'TabNavigator'}>
    <Stack.Group screenOptions={animation}>
        <Stack.Screen name={'TabNavigator'} component={TabNavigator} />
        <Stack.Screen
            name={'AdditionalStack'}
            component={AdditionalStack}
        />
        <Stack.Screen name={'Chat'} component={Chat} />
        <Stack.Screen name={'AR'} component={AR} />
    </Stack.Group>
</Stack.Navigator>

AR

const Scene = () => {
    return <ViroARScene />;
};

const ARNavigator = useMemo(() => {
    return (
        <ViroARSceneNavigator
            initialScene={{
                scene: Scene,
            }}
            worldAlignment='Gravity'
            autofocus
            style={styles.arView}
            viroAppProps={{
                onObjPress: showRotationUI,
            }}
        />
    );
}, []);

<SafeAreaView style={styles.container}>
    {isShow && <ARNavigator />}
</SafeAreaView>
illi-homz commented 1 year ago

I find error. Layout small node animation (react-native-reanimated) on first screen in navigation stack