Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6214

React Navigation V5 + Typescript Error: Property 'fullName' does not exist on type 'object'

$
0
0

My Goal:

I'm trying to add Typescript typings, but having an issue with route.params.fullName. When I console.log(route.params), the object { fullName: 'John Smith' } is logged. Why is Typescript having an issue with fullName?

The weird part is that the code works and when I navigate to the screen, the header title is updated with route.params.fullName.

Error:

Property 'fullName' does not exist on type 'object'.

Functional Component:

  // React Hooks: React Navigation  const route = useRoute();  // React Hooks: Lifecycle Methods  useEffect(() => {    console.log(route.params);    // React Navigation: Set Options    props.navigation.setOptions({      // ISSUE HERE      title: route.params.fullName,    });  }, [props.navigation, route.params]);

Viewing all articles
Browse latest Browse all 6214

Trending Articles



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