File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -101,6 +101,32 @@ logoBackgroundColor | backgroundColor | The logo gets a filled quadratic
101101getRef | null | Get SVG ref for further usage
102102
103103
104+ ## Saving generated code to gallery
105+ _ Note: Experimental only ( not tested on iOS) , uses getRef() and needs [ RNFS module] ( https://github.com/itinance/react-native-fs ) _
106+
107+ npm install --save react-native-fs
108+
109+ ### Example for Android:
110+ ```
111+ import { CameraRoll , ToastAndroid } from "react-native"
112+ import RNFS from "react-native-fs"
113+ .....
114+
115+ saveQrToDisk() {
116+ this.svg.toDataURL((data) => {
117+ RNFS.writeFile(RNFS.CachesDirectoryPath+"/some-name.png", data, 'base64')
118+ .then((success) => {
119+ return CameraRoll.saveToCameraRoll(RNFS.CachesDirectoryPath+"/some-name", 'photo')
120+ })
121+ .then(() => {
122+ this.setState({ busy: false, imageSaved: true })
123+ ToastAndroid.show('Saved to gallery !!', ToastAndroid.SHORT)
124+ })
125+ })
126+ }
127+ ```
128+
129+
104130### Dependencies
105131
106132* [ react-native-svg] ( https://github.com/magicismight/react-native-svg )
You can’t perform that action at this time.
0 commit comments