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

Props declared as interface not available when navigating to a Component

$
0
0

I have Component wherein props are declared as an interface and that component takes in the type as that interface.

For eg ->

import React, { Component } from 'react'import { Text, View } from 'react-native' interface IDummy{    name:string;    age:number;}export default class Dummy extends Component<IDummy,any> {    constructor(props:IDummy){        super(props)        console.log('CHeck the props here ',props)    }    render() {        return (<View><Text> Just Text </Text></View>        )    }}

Now if I use that component as a part of other components such as

<Text>Something</Text><Dummy/>

The props name and age work fine.But when I want to navigate to that component,

navigation.navigate('Dummy')

the props mentioned in the interface are not available.Is there any way I could access them ???


Viewing all articles
Browse latest Browse all 6214

Trending Articles