Open sudheerpal opened 3 years ago
import ViewShot from "react-native-view-shot";
class ExampleCaptureOnMountManually extends Component {
componentDidMount () {
this.refs.viewShot.capture().then(uri => {
console.log("do something with ", uri);
});
}
render() {
return (
<ViewShot ref="viewShot" options={{ format: "jpg", quality: 0.9 }}>
<Text>...Something to rasterize...</Text>
</ViewShot>
);
}
}
function ExampleCaptureOnMountManually() {
const viewShotRef = useRef(null);
useEffect(() => {
viewShotRef.current.capture().then((uri) => {
console.log('do something with ', uri);
});
}, []);
return (
<ViewShot ref={viewShotRef} options={{ format: 'jpg', quality: 0.9 }}>
<Text>...Something to rasterize...</Text>
</ViewShot>
);
}
It will be great if anybody can give me reference where it is implemented function way (non class).