I'm working on an option in my React Native app to take data from a Realm database, convert it into csv, and send it via email. I'm planning to use react-native-mail to send the email with the attachment.
How can I save a text file on the user's device, so I can supply it to the native email app with react-native-mail (or for any other purpose)?
Write the content data to it await RNFS. writeFile(filePath, content, "utf8"); console. log("written to file"); } catch (error) { //if the function throws an error, log it out. console.
I haven't tried it out, but have you had a look at: https://github.com/Murriouz/react-native-file-manager? If that doesn't suit your needs, and you cannot find another option out there, your best bet would be to write your own native module. The docs have some details on doing this: http://facebook.github.io/react-native/docs/native-modules-ios.html#content
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With