'Giving Error : Attempting to change the getter of an unconfigurable property in React native
I am working on the project in react-native but this is throwing an error
Attempting to change the getter of an unconfigurable property
import * as React from 'react';
import { Text, View, StyleSheet } from 'react-native';
import 'react-native-gesture-handler';
import { createStackNavigator } from '@react-navigation/stack';
import { NavigationContainer } from '@react-navigation/native';
import LogInScreen from './screens/loginScreen';
import SignUpScreen from './screens/singupScreen';
import ActivitiesScreen from './screens/activitiesScreen';
import StackNavigator from './navigation/WelcomeStackNavigation';
import StackNavigator2 from './navigation/Stack2';
import { AppLoading } from 'expo';
import { createAppContainer, createSwitchNavigator } from 'react-navigation';
function App() {
return (
<NavigationContainer>
</NavigationContainer>
);
}
export default App;
When you remove the code snippet which is 'import { createAppContainer, createSwitchNavigator } from 'react-navigation';'
Then, the error will not show.
If you insert that again the error will be showing.
You can check the package.json file:
{
"dependencies": {
"firebase": "7.9.0",
"react-is": "^16.8.0",
"expo-font": "~8.4.0",
"@firebase/app": "0.x.0",
"styled-system": "*",
"react-native-svg": "12.1.0",
"react-navigation": "4.4.1",
"styled-components": "*",
"@firebase/app-types": "0.x.0",
"@firebase/firestore": "*",
"react-native-screens": "~2.15.2",
"@react-navigation/stack": "^5.14.4",
"react-native-reanimated": "~1.13.0",
"@react-navigation/native": "^5.9.4",
"react-native-size-matters": "*",
"react-native-gesture-handler": "~1.8.0",
"react-native-safe-area-context": "3.1.9",
"react-native-floating-label-input": "*",
"@react-native-community/masked-view": "0.1.10"
}
}
I am confused.
You can check this snack
Solution 1:[1]
You mix up @react-navigation/native and react-navigation.
Change your import as below:
import { createAppContainer, createSwitchNavigator } from '@react-navigation/native';
Solution 2:[2]
I was getting same error. I just changed to expo version 43 on snack and then extracted the file on VSC, and it worked.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Michael Bahl |
| Solution 2 | ouflak |
