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

Arrow function returning component with TypeScript in React Native

$
0
0

I'm trying to build an app in React Native using Typescript, but i'm facing some problems with some of the typescript rules.I just copy and paste an UI Kitten component code and it returns a TypeError

const PersonIcon = (props: any) => ( <Icon {...props} /> );

const BellIcon = (props: any) => ( <Icon {...props} name='bell-outline'/> );

const EmailIcon = (props: any) => ( <Icon {...props} name='email-outline'/> );

And then using it in the component:

const [selectedIndex, setSelectedIndex] = useState(0);return(<TabBar        selectedIndex={selectedIndex}        onSelect={index => setSelectedIndex(index)}><Tab icon={EmailIcon} title='USERS'/><Tab icon={BellIcon} title='ORDERS'/><Tab icon={EmailIcon} title='TRANSACTIONS'/></TabBar>)

And with that I can't procceed because I can't find something like a tutorial which teaches how to use TypeScript in React Native. Could someone help me? I know this is a newbie error, but I really can't find the solution

The error


Viewing all articles
Browse latest Browse all 6213

Trending Articles



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