Quantcast
Channel: Active questions tagged navigation - Stack Overflow
Viewing all articles
Browse latest Browse all 9905

Typing in React Native - "Binding element 'navigation' implicitly has an 'any' type.ts(7031)"

$
0
0

not new to programming but new to app development and reactive native. I have been searching for almost four hours to solve this. I have realised there are many questions like this, but this is not a duplicate as any working code has not worked on mine.

I followed this tutorial and VS code gave me errors. Namely, relating to Text and Button imports in the .tsx screen file. The following code is constantly giving me an error:

const HomeScreen = ({ navigation }) => {    return (<Button        title="Go to Jane's profile"        onPress={() =>          navigation.navigate('Profile', { name: 'Jane' })        }     />   );};

The error: Binding element 'navigation' implicitly has an 'any' type.ts(7031)

From what I gather this is related to typing in the language and because the type has not been declared, I cannot use the code. The problem is, is that I have followed the tutorial, searched many different websites and a few different tutorials, I have not been able to get this working.

I have tried all of these variations for the first line:

const HomeScreen = ({ navigation.navigate ) => {const HomeScreen = ({ navigation } : Navigator) => {const HomeScreen = ({ navigation NavigationContainer}) => {const HomeScreen = ({ navigation = NavigationAction}) => {const HomeScreen = ({ }) => {

So I have tried quite a few different variations to try to solve this. I am honestly really stuck, after trying to follow the tutorial and finding no answers online, I really do not know what to do. I am sure there is something very obvious wrong with the syntax but being new to the language I don't know how to spot it. Thank you.


Viewing all articles
Browse latest Browse all 9905

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>