rn-fetch-blob icon indicating copy to clipboard operation
rn-fetch-blob copied to clipboard

how get path for local png image

Open IsmetGlumcevic opened this issue 6 years ago • 2 comments

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

Screenshot 2019-10-03 at 12 49 56

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'

IsmetGlumcevic avatar Oct 04 '19 12:10 IsmetGlumcevic

Same issue

andymurakami avatar Jul 27 '20 17:07 andymurakami

Same issue

ZexinW avatar Mar 20 '23 07:03 ZexinW