In this post, I will document my learning on downloading remote pdf files on iOS and android.
Setup the project: Let’s first create a blank project by hitting,
npx react-native init DownloadPdf
It will just have one button that will try to download this sample pdf file. This is our initial code,
Download PDF: Now, let’s write our download functionality. Before that, we will need to download 2 modules.
- react-native-blob-util: great library for downloading files.
- react-native-share: for iOS, we would like to save the files on our phone, hence the share library.
here is the gist,https://saadbashar.medium.com/media/3e3449377bf362935f1b5d62f371c3ad
Output of the functionality: