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

Type 'typeof class' is not assignable to type 'ComponentType'

$
0
0

I am trying to use react native navigation using typescript and I am getting a Type 'typeof LoginScreen' is not assignable to type 'ComponentType<any>' error when trying to connect my screens.

class App extends React.Component {  render() {    return (<NavigationContainer><Stack.Navigator initialRouteName="Login"><Stack.Screen name="Login" component={LoginScreen} /></Stack.Navigator></NavigationContainer>    );  }}class LoginScreen extends React.Component {  render() {    const {navigate} = this.props.navigation;  }}

This fails at component={LoginScreen}. I understand that it is because my React component 'HomeScreen' isn't expecting any props, however what is the safe way of handling this issue, as I saw many different solutions.


Viewing all articles
Browse latest Browse all 6212

Trending Articles



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