I recently upgraded Expo to ^44.0.0 and got this error: TypeError: (0, _native.createNavigatorFactory) is not a function. (In '(0, _native.createNavigatorFactory)(StackNavigator)', '(0, _native.createNavigatorFactory)' is undefined)
I searched everywhere and updated everything but I can't seem to get it to work. What am I doing wrong?
This is my package.json
content:
"@react-navigation/core": "^6.1.1",
"@react-navigation/native": "^3.8.4",
"@react-navigation/native-stack": "^6.5.0",
"@react-navigation/stack": "^5.14.2",
"core-js": "^3.4.8",
"expo": "^44.0.0",
"expo-status-bar": "~1.2.0",
"react": "17.0.1",
"react-dom": "17.0.1",
"react-native": "https://github.com/expo/react-native/archive/sdk-44.0.0.tar.gz",
"react-native-gesture-handler": "~2.1.0",
"react-native-safe-area-context": "3.3.2",
"react-native-screens": "~3.10.1",
This is my App.js
:
import { StatusBar } from 'expo-status-bar';
import React from 'react';
import { StyleSheet, Text, View, } from 'react-native';
import { NavigationContainer } from '@react-navigation/native';
import { createNativeStackNavigator } from '@react-navigation/stack';
import HomeScreen from './HomeScreen';
import AddTaskScreen from './AddTaskScreen';
import AddWorkTimeScreen from './AddWorkTimeScreen';
const Stack = createNativeStackNavigator();
export default class App extends React.Component {
render(){
return (
<NavigationContainer>
<Stack.Navigator>
<Stack.Screen options={{headerShown: false}} name="Home" component={HomeScreen}/>
<Stack.Screen name="AddTask" component={AddTaskScreen} options={{ title: 'Task' }}/>
<Stack.Screen name="AddWorkTime" component={AddWorkTimeScreen} options={{ title: 'Work Times' }} />
</Stack.Navigator>
</NavigationContainer>
);
}
}
I also updated typescript to ^4.6.2
CodePudding user response:
the problem is with your @react-navigation/native version, which is ^3.8.4. i see you're using 5.x or 6.x versions for everything else, so i recommend upgrading @react-navigation/native to 6.0.0. this should fix the error.
i would also recommend updating all the 5.x to 6.x versions, but thats your choice.