Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

react native access content:// uri fails

Working with the following react native packages in android:

"react-native": "0.47.2"
"react-native-document-picker": "2.0.0" (removing the ovveride to compile with 0.47)
"react-native-fetch-blob": "^0.10.8"

I'm getting a content:// uri while using react-native-document-picker or react-native-contacts (for the avatars). URIs like:

 'content://com.android.providers.media.documents/document/image%3A99'

Trying to access this file fails with "stat error: failed to list path null for it is not exist or it is not a folder'"

const urlDecoded = decodeURIComponent(url);
return new Promise((resolve, reject) => {
  RNFetchBlob.fs.stat(urlDecoded)
    .then(resolve)
    .catch(reject);
});

Any idea how to access the file? access the real path of it?

like image 674
EyalS Avatar asked Sep 26 '17 10:09

EyalS


1 Answers

There is now a solution for this problem in react-native-fs. Enabling access and copy content:// files -https://github.com/itinance/react-native-fs/pull/395

like image 111
EyalS Avatar answered Sep 23 '22 09:09

EyalS