rn-draw
rn-draw copied to clipboard
How can i save the image?
I was using updateSVGInfo that I found in another project that includes this one, but it doen't work.
Hi @julianbonomini I recently sent this pull request https://github.com/jayeszee/rn-draw/pull/12
Thanks for contributing! @gaboelnuevo . I'll take a look at it soon, sorry for the delay!
I am using expo. If you use expo, then you can use
import { takeSnapshotAsync } from 'expo';
// ...
onPicture = async () => {
// this.pictureRef is a reference to Component where you draw
const result = await takeSnapshotAsync(this.pictureRef, {
result: 'tmpfile',
// height: pixels,
// width: pixels,
quality: 1.0,
format: 'png',
});
// I made this because in my test iOS don't have file:// before URI and I need this
let uri = (Platform.OS === 'ios') ? ('file://' + result) : result;
// This call my function, you can do anything, this is just for my purpose and example
this.props.onFinish({
uri: uri,
name: (result).split('/').pop(),
type: 'image/png',
});
}