Meituan-Dianping / beeshell

React Native 组件库
MIT License
1.8k stars 280 forks source link

使用Icon 组件报动态引用错误 #105

Open silentzone opened 4 years ago

silentzone commented 4 years ago

出现红屏 Error: Dynamic require defined at line 17; not supported by metro

是不是 nativecli 自带的 metro 版本低了?

react-native-cli: 2.0.1 react-native: 0.61.5 设备是小米mix2s 真机android9,和 android虚拟机 android10

skylarklxlong commented 4 years ago

@silentzone 你好我也遇到了这个问题,请问您是如何解决的

skylarklxlong commented 4 years ago

@silentzone 我找到了一种解决方案 将第一种写法改成下面第二种就可以正常了 1、<Icon style={{ marginLeft: 4 }} type='question-circle' size={14} tintColor={variables.mtdGrayLighter}></Icon> 2、<Icon style={{ marginLeft: 4 }} source={require('beeshell/dist/common/images/icons/question-circle.png')} size={14} tintColor={variables.mtdGrayLighter}></Icon>