0

I'm new to react native so i might do something really bad but, I have a problem on Expo + React Native after building apk. (I don't have any problem when building) Problem is : When i use react-navigation/native-stack, nothing is shown on the mobile screen with the apk. But everything works fine in dev mode.

here some exemple, i build this with juste a simple text and it is running well. App.tsx :

import 'react-native-gesture-handler';
import {AuthProvider} from "src/Context/AuthContext";
import {RequestInterceptorProvider} from "src/Context/RequestInterceptorContext";
import {Text} from "react-native";


export default function App() {
    return (
        <AuthProvider>
            <RequestInterceptorProvider>
                <Text style={{marginTop: 50}}>Bonjour !</Text>
            </RequestInterceptorProvider>
        </AuthProvider>
    );
}

This exemple is working fine when build.

But if i use a router in my app like this :

App.tsx :

import 'react-native-gesture-handler';
import {AuthProvider} from "src/Context/AuthContext";
import {RequestInterceptorProvider} from "src/Context/RequestInterceptorContext";
import TestSimpleRouter from "./src/Routes/TestSimpleRouter";


export default function App() {

    return (
        <AuthProvider>
            <RequestInterceptorProvider>
                <TestSimpleRouter />
            </RequestInterceptorProvider>
        </AuthProvider>
    );
}

TestSimpleRouter.tsx :

import * as React from "react";
import {createNativeStackNavigator} from '@react-navigation/native-stack';
import {NavigationContainer} from "@react-navigation/native";
import TestOneScreen from "../Screens/TestOne/TestOneScreen";
import TestTwoScreen from "../Screens/TestTwo/TestTwoScreen";

const Stack = createNativeStackNavigator();

export default function TestSimpleRouter() {

    return (
        <NavigationContainer>
            <Stack.Navigator
            initialRouteName={"TestOne"}
            >
                <Stack.Screen
                name={"TestOne"}
                component={TestOneScreen}
                />
                <Stack.Screen
                    name={"TestTwo"}
                    component={TestTwoScreen}
                />
            </Stack.Navigator>
        </NavigationContainer>
    )
}

This exemple is 100% working in dev mode, but i can't make it work after an apk build... Any suggestion ?

I found this topic : App works fine in Expo-Go but doesn't work after EAS-Build

It seems to be the exact same process as me, but no answer

I manage to identified the problem, it's coming from react-navigation / native-stack.

  • did you manage to resolve this issue? I have the same problem, but I have no clue how to deal with it – Canutza Mar 23 '23 at 19:59

0 Answers0