Reputation: 372
I want to display a pdf in my react-native app. I used documentation from https://www.npmjs.com/package/react-native-pdf. I installed rn-fetch-blob and react-native-pdf. i have linked react-native-pdf . but when i ran command "react-native link rn-fetch-blob" it didn't get linked. and i got the following message in command prompt:
rn-fetch-blob will not automatically add Android permissions after 0.9.4
please run the following command if you want to add default permissions :
RNFB_ANDROID_PERMISSIONS=true react-native link
I tried this command and i got: "'RNFB_ANDROID_PERMISSIONS' is not recognized as an internal or external command, operable program or batch file."
I am using this version: react-native-cli: 2.0.1 react-native: 0.59.8
I also tried to set it manually with the reference https://github.com/wkh237/react-native-fetch-blob/wiki/Manually-Link-Package
I was to set it in 3 files according to the last reference i provided -
I used first: "node_modules/rn-fetch-blob/android/build.gradle" (which is "android/app/build.gradle" in documentation )
I used second: "node_modules/rn-fetch-blob/android/src/main/java/com/RNFetchBlob/RNFetchBlob.java" (which is "MainApplication.java" in documentation )
third file was "android/settings.gradle" which i didn't find in "node_modules/rn-fetch-blob/android/"
so i bacame unable to set it manually.
May be I am using wrong file paths to set it manually. If any one have any idea about it or any suggestions for me to solve it in a better way. please help me out. Or if any other way to solve "displaying a pdf in react-native" please provide me that also.
Upvotes: 0
Views: 4628
Reputation: 372
linking problem is solved after setting it manually and than by using command set RNFB_ANDROID_PERMISSIONS=true
in command prompt.
But now still getting an error after using in code import Pdf from 'react-native-pdf';
. the error is shown below.
anyone having idea about it. or any other way to display a pdf in react-native, kindly let me know.
Upvotes: 2
Reputation: 66
If you run this command "rn-fetch-blob": "^0.10.13",install this version is worked for me,if you install another one your app was crashed/stoped.
Upvotes: 0