Thanks for the info! Any sample code? Just wanted to get screenshot, get the image and display it on <Image source={{uri : this.state.imageURI}} /> convert to base64 then save it to db. Will be using “react-native-fs”. Just wondering if RNFS will work on Expo?
There is a code snippet at the bottom of that docs page Brent linked showing the Snapshot API in use. react-native-fs also requires native code configurations so you won’t be able to use it with a standard Expo project. We do have our FileSystem API that usually covers most use cases where one would use rn-fs. A good rule of thumb is that if the library you are looking at requires you to run react-native link or make any manual changes in the android or ios directories, you will not be able to use it in a standard Expo project. If you need to use such a library, you’ll have to eject and use ExpoKit.
here’s an example of using takeSnapshotAsync to screenshot and get a base64: privileged strawberries - Snack. read the docs for more info on other options
you should definitely read over the expo docs @ryanjayford before reaching out to external libraries. as @adamjnav mentioned, there is also a FileSystem API built into expo, so no need for react-native-fs.
Thank you so much Brent for patiently answering my inquiry. Your sample help me a lot. Thanks also Adam for your inputs. I have seen the sample but its not so clear for a beginner like me.
Just have a question though, why is it that takeSnapshotAsync cant capture signature (ExpoPixi.Sketch ). Main reason I wanted to get screenshot is to capture the whole screen with two signatures. Right now it can only capture my canvas but not the signatures. I have made use of your code and added 2 ExpoPixi.Sketch for 2 signature, adjusted delay to 10 sec before it can capture, so that will have time to put signature in. I have put the whole code here. Hope you’ll not get tired on answering my inquiry. Thanks again!