rn-fetch-blob
rn-fetch-blob copied to clipboard
how get path for local png image
RN 0.60 rn-fetch-blob 0.11.2 MacOs Tested on iphone 7
Hi, i try with RNFS.readFile to get image from my local folder 'slike' witch is in root project. This is screenshot of my project structure. I need path for sharing image in react-native-share package

this is my code
import RNFetchBlob from 'rn-fetch-blob'
const dirs = RNFetchBlob.fs.dirs
let slik = 'file://' + dirs.DocumentDir + '/slike/page1.png';
let filePath = ''
if (Platform.OS === 'ios') {
let arr = slik.split('/')
filePath = `${dirs.DocumentDir}/${arr[arr.length - 1]}`
console.log('filePath')
} else {
filePath = slik
}
RNFetchBlob.fs.readFile(filePath, 'base64')
.then((data) => {
console.log(data)
})
get error Possible Unhandled Promise Rejection (id: 0): Error: No such file '/var/mobile/Containers/Data/Application/32EF8052-F3C3-4672-A8E6-853C14776EDF/Documents/page1.png'
Same issue
Same issue