I'm trying to type a button component where all of them have to get a title, but some don't get an icon.This icon comes from "@expo/vector-icons". What should I do when I put the component display an icon too?
Like: <Button icon={<FontAwesome name="icon-name" size={24} colo="color"} title="Title here" />
My actual code:
type IButtonProps = TouchableOpacityProps & { title: string; icon?: any;}function Button({ title, icon }: IButtonProps) { return(<Container><Text> {title}</Text></Container> );}export default Button;
and here is when the component is used for display
<Button title="Login with Github" icon={`${<FontAwesome name="github" size={24} color="#FFFFFF" /> }`} />