How to download a pdf file in react native?

5.5k Views Asked by At

I am building an app with React Native and Expo, for Android and iOS. I am trying to let the user download a PDF file when clicking on a button. It's a couple of days that I'm working on it and I find tow following packages:

  1. react-native-fetch-blob/rn-fetch-blob
  2. react-native-fs

the first one raises :
undefined is not an object (evaluating 'RNFetchBlob.DocumentDir')
and for second the error is:
undefined is not an object (evaluating 'RNFSManager.RNFSFileTypeRegular')

I've previously tested the npm link , Yarn eject , restart packager and some other workarounds form GitHub and stackoverFlow but my problem is not solved yet.

any help is highly appreciated Thanks.

0

There are 0 best solutions below