javascript - 反应原生视图拍摄无法收到空消息
问题描述
我想用React Native View Shot 导出图片,但是有一个问题,图片怎么不想导出,所以出现这样的错误。用英文,就像“shot can't receive empty message”
这是我的代码
import ViewShot, { captureScreen } from 'react-native-view-shot';
const viewShotRef = useRef();
const [handleButton, setHandleButton] = useState(true);
async function captureViewShot() {
setHandleButton(false);
const imageURI = await viewShotRef.current.capture();
console.log(imageURI);
setHandleButton(true);
Share.share({ title: 'Nota', url: imageURI });
}
function captureScreenShot() {
captureScreen({
format: 'jpg',
quality: 0.8,
}).then(
(uri) => {
console.log(uri);
Share.share({ title: 'Nota', url: uri });
},
(error) => console.log('IMage gagal to', error)
);
}
这是我的观点
<ViewShot
ref={viewShotRef}
style={{ flex: 1 }}
options={{ format: 'jpg', quality: 1.0 }}>
<Table borderStyle={styles.tableStyle}>
<Row
data={tableHead}
style={styles.head}
textStyle={styles.text}
flexArr={[1, 2, 1, 1]}
/>
<Rows data={tableData} textStyle={styles.text} flexArr={[1, 2, 1, 1]} />
</Table>
</ViewShot>
在我的情况下,我需要 2 个导出,即仅导出表格并导出整个屏幕,但它们都不起作用
解决方案
推荐阅读
- python-3.x - 如何创建适用于所有日期的时区感知时间对象?
- ansible - 使用 Ansible 监控日志文件的最新条目
- html - 响应式 BootStrap 4 选项卡
- ocaml - 在 parsetree.mli 中使用 Pexp_ident 是什么意思?
- php - 如何向多个收件人发送电子邮件 laravel
- angular - spyOn 在 Angular 6 的 Http 拦截器中不起作用
- python - Quantlib-SWIG 1.12.x for Python 错误,windows 中缺少 Quantlib/quantlib_wrap.cpp
- python - 当安装了 python3 时,如何管理 python2 的模块。在 OSX 中
- javascript - 模块名称字符串的 TypeScript 类型
- angular - 在托管 name.com 错误路由 url 中部署 Angular 6