react-native - 如何从 View 创建 png 文件

标签 react-native

我动态地做了一些 View 。

 <View style={{
    backgroundColor: '#fff',
    width: 300,
    height: 200,
    top: 0,
    left: 0 
    }}      
 />

如何将此 View (其尺寸和颜色)导出到 png 文件中?

最佳答案

如果您有一些操作或情况,何时需要导出图像。 (按钮点击其他任何东西)
使用此截屏 library react-native-view-shot
您可以截取特定的截图 View使用 ref

关于react-native - 如何从 View 创建 png 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50291704/

相关文章:

javascript - 未定义未处理的 Promise Rejection

react-native - .measure 不是函数

ssl - React-native websocket TLS 连接

javascript - 将图标放在占位符中 - React Native

android - firebase 如何自动发送推送通知

reactjs - 在 typescript 的 react-native 中使用 createRef?

react-native - React Native - 具有动态高度子项的 FlatList

ios - iOS 应用角标(Badge)中的随机数

ios - 如何在react-native中制作 map 的iOS底部面板?

react-native - 如何获取对象react-native中的数组大小