How do you make use of Intrinsic attributes as types in typeScript.
I have a simple tab navigation that looks like:
const getOptions = (iconName: string) => ({ tabBarIcon: ({ color }: { color: string }) => (<MaterialIcons name={iconName} size={24} color={color} /> ), });<Tab.Navigator><Tab.Screen name="HomeScreen" component={HomeScreen} options={() => getOptions("home")} /></Tab.Navigator>
MaterialIcons
from @expo/vector-icons
has a property name
which is of type GLYPHS
.
When I use iconName: string
I get the following error:
The expected type comes from property 'name' which is declared here ontype 'IntrinsicAttributes & IntrinsicClassAttributes
What am I doing wrong?