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

React Native - expo/vector-icons typescript type definition for icon name

$
0
0

I'm trying to find out the type definitions for the icon name of expo/vector-icons, since I am intending to use it for a component props.

I am import expo/vector-icons like and and defining interface props like this, I tried type icon name as string.

import Icon from "@expo/vector-icons/FontAwesome"interface Props {    icon: string    value: string    placeholder: string    onChangeText: (text: string) => void    secureTextEntry?: boolean    style: StyleProp<ViewStyle>}

This is how I am using the prop.

<Icon name={icon} size={20} style={styles.icon} />

But I get error from Typescript.enter image description here


Viewing all articles
Browse latest Browse all 6287

Trending Articles



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