So am creating a custom component <InputField/> which renders Ionicon icon as one of its children. I want the user of that component to be able to pass the name of the Ionicon icon he/she wants InputField to show via iconName prop.
Am using typescript so I need to type iconName to be one of the icon names that Ionicon supports (probably a union type). There seems not to be a way to do this as I can't find exported types for icon names in this library.
I want to be able to do something like this:
import {IoniconName} from 'somewhere_in_the_library';
export type InputFieldProps = {
iconName: IoniconName;
//...Rest of the props for InputField
}
//...Rest of the code for `InputField`
So am creating a custom component
<InputField/>
which rendersIonicon
icon as one of its children. I want the user of that component to be able to pass the name of theIonicon
icon he/she wants InputField to show viaiconName
prop.Am using typescript so I need to type iconName to be one of the icon names that
Ionicon
supports (probably a union type). There seems not to be a way to do this as I can't find exported types for icon names in this library.I want to be able to do something like this: