I want to upload documents in my react native app and for that I am using react-native-document-picker
But to read the base64 content of the file react-native-fs is needed which has a dependency issue (needs react-native v0.59)
I am unable to install it, as I have react-native v 0.63
Getting the following error as I install it:
admin@Salvis-MacBook project % npm install react-native-fs --save
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/react-native
npm ERR! react-native@"0.63.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react-native@"^0.59.5" from [email protected]
npm ERR! node_modules/react-native-fs
npm ERR! react-native-fs@"*" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See /Users/admin/.npm/eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/admin/.npm/_logs/2021-01-25T09_41_08_842Z-debug.log
Please suggest something if you ran onto the same issue.
I tried reading contents using rn-fetch-blob and it's working fine on Android but I am unable to read file in ios simulator (I downloaded some sample pdf file from safari)
Whenever I try to read the file, it says file not found.
I have also tried below methods:
uri.replace('file://', '')
uri.replace('file:', '')
decodeURIComponent(uri)
but still unable to read it on ios
question from:
https://stackoverflow.com/questions/65882109/unable-to-read-file-contents-in-react-native-0-59 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…