我试图通过react native将视图保存在android中。在Expo拍摄快照时,React native viewshot在android中引发以下错误。这是我的代码
import React from 'react';
import { View ,Image,Button} from 'react-native';
import ViewShot from "react-native-view-shot"
import { captureRef } from "react-native-view-shot";
export default class App extends React.Component {
constructor(props){
super(props)
this.capture = this.capture.bind(this)
}
capture(){
this.refs.viewShot.capture().then(uri => {
console.log("do something with ", uri);
},(error)=>{console.log("error",error)})
}
render() {
return (
<View style={styles.container}>
<ViewShot ref="viewShot" >
<Image source={require("./batman.jpg")}>
</Image>
</ViewShot>
<Button
title="save"
onPress={this.capture}
>
</Button>
</View>
);
}
}