最近项目中需要实现类似进度条的仪表盘效果,考虑可能可以通过绘图实现,网上查了不少资料,都是说采用React-Native 自带的 ART模块进行绘图,但按照参照网上的方法,各种报错,后在github 的react-native项目issue中,发现ART模块已经独立出来了,官方推荐采用https://github.com/react-native-community/art进行代替,经尝试,按官网的步骤,但不需进行link( react-native link @react-native-community/art )这一步,否则会报如下错误:
error React Native CLI uses autolinking for native dependencies, but the following modules are linked manually:
- @react-native-community/art (to unlink run: "react-native unlink @react-native-community/art")
拷贝了官网的例子,运行后没有显示仍和图像,从github issue中,发现需要在Group、Shape、Text等组件上添加visible={true} opacity={1.0} 属性,官网没有任何说明,真坑。
具体画图方法可参照https://github.com/react-native-community/art/blob/master/docs/api.md 进行学习,本人也正学习中,暂时不分享了....