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

Text cannot be used as a jsx component it instance type 'Text' is not a valid JSX element

$
0
0

Receiving following error:

Text cannot be used as a jsx component it instance type 'Text' is not a valid JSX elementMy file is .tsx as I in a minute need it to be typescript as I will be needing RootState.

I have tried the following so far:

  • Ensured that TS is intalled globally

  • added '"allowSyntheticDefaultImports" : true ' tsconfig.json

  • devDependencies for typescript is there.

  • dependencies: "react": "17.0.2", "react-dom": "17.0.2",

import * as React from 'react';import { View, Text} from 'react-native';export default function ChatScreen({navigation}){    return(<View style={{flex: 1, alignItems: 'center', justifyContent: 'center'}}><Text            onPress={() => navigation.navigate('Chat')}            style={{ fontSize: 26, fontWeight: 'bold'}}>Chat Screen</Text></View>    );}

Can't seem to understand why I'm not allowed to use JSX components inside my TSX file. Hope one can help understand.


Viewing all articles
Browse latest Browse all 6287

Trending Articles



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