When i try to add this statement
import { useRoute } from "@react-navigation/native";
to my Snack Expo App.js file,i tdisplay this error message:
(5:5) Failed to resolve dependency '@react-navigation/native@*' (Module build failed (from ../../../../../../../app/node_modules/babel-loader/lib/index.js):
This is my App.js:
import { Text, SafeAreaView, StyleSheet } from 'react-native';
import { useRoute } from "@react-navigation/native";
// You can import supported modules from npm
import { Card } from 'react-native-paper';
// or any files within the Snack
import AssetExample from './components/AssetExample';
export default function App() {
return (
<SafeAreaView style={styles.container}>
<Text style={styles.paragraph}>
Change code in the editor and watch it change on your phone! Save to get a shareable url.
</Text>
<Card>
<AssetExample />
</Card>
</SafeAreaView>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
backgroundColor: '#ecf0f1',
padding: 8,
},
paragraph: {
margin: 24,
fontSize: 18,
fontWeight: 'bold',
textAlign: 'center',
},
});
and this is my package.json:
{
"dependencies": {
"@expo/vector-icons": "^13.0.0",
"react-native-paper": "4.9.2",
"@react-navigation/native": "*"
}
}
Why? What is wrong?