I am trying to capture signature using Expo Pixi. But when i try to get snapshot using Expo.takeSnapshotAsync(), I get inconsistent result. Sometimes the snapshot (imageData) is cropped and sometimes shrunk.
let imageData = '';
const targetPixelCount = 400;
const editorPixelCount = 400;
const pixelRatio = PixelRatio.get();
const pixels = targetPixelCount / pixelRatio;
const editorPixels = editorPixelCount / pixelRatio;
const onDrawChange = async () => {
const options = {
format: 'png',
quality: .1,
result: 'data-uri',
height: pixels,
width: pixels
};
imageData = await Expo.takeSnapshotAsync(this.sketch, options);
};
ExpoPixi in Render:
<ExpoPixi.Signature
ref={ref => (this.sketch = ref)}
onChange={onDrawChange}
style={{ height: editorPixels, width: editorPixels, backgroundColor: '#ffff' }} />
Thanks.