相关疑难解决方法(0)

How to use @expo/vector-icons dynamically through props in typescript react native app?

react native app with typescript and I'm trying to create icon button that uses @expo/vector-icons with Fontawesome or MaterialIcon dynamically by trying to pass a name as a string via props.

I think the issue is this, BUT don't know how to solve it. Any ideas? Suggestions? Also feel free to criticize other code.

Below is my IconButton component that receives the name prop

import { Ionicons, MaterialIcons, FontAwesome } from 
 "@expo/vector-icons";

const star = "star";

type Props = { …
Run Code Online (Sandbox Code Playgroud)

typescript react-native expo

8
推荐指数
1
解决办法
6475
查看次数

标签 统计

expo ×1

react-native ×1

typescript ×1