Is there a reliable way to create a file (specifically via Print.printToFileAsync API), and since it creates the new file in the user’s cacheDirectory, copy it across to their documentDirectory – that works in both Android and iOS?
I’ve come across others trying to do the same thing here, but to no avail.
One solution I’ve seen is to use the MediaLibrary API to download the file to the device’s CameraRoll – but this is hacky and doesn’t work on iPhone since the file I’m trying to copy/download is a PDF, and not an image/movie.
Various solutions are listed here too – but they either don’t work, or only work in one OS.
My end goal is to be able to generate a PDF on the device and save it to the user’s storage, without needing to send information back to the server.
My app is not ejected as it stands.
Any advice/direction would be appreciated!
Considering ejecting at some stage, but due to the nature of the project I’m working on I’d prefer to do that right at the end. Also came across this post which tries to Share the file URI, but this isn’t supported on Android.
Source: React natvie