Closed zholmes1 closed 2 weeks ago
It looks like it's handled differently on iOS and Android. (file.path works for iOS, cacheDirectory + file.fileName works for Android)
I wrote up a little piece of code that checks various places hoping that one of them works.
const possiblePaths = [
FS.cacheDirectory + file.fileName,
file.path,
FS.documentDirectory + file.fileName
]
let path
for (const possiblePath of possiblePaths) {
console.log('checking', possiblePath)
try {
const { exists } = await FS.getInfoAsync(possiblePath)
if (exists) {
path = possiblePath
console.log('correct!', Platform.OS)
break
}
} catch (e) {
console.error(e)
}
}
if (!path) {
throw new Error(
`We were unable to read this file. (${file.path} ${file.mimeType} ${file.fileName})`
)
}
ok maybe something to do with the file path returned by share intent on android.
@zholmes1 Android file path fixed in v2.1.1 !
Hey thanks so much for this repo. I was able to add sharing intent to my app, and I can display the shared image in an
Image
component.But I can't figure out how to actually read this file! It's not in the examples anywhere.
I'd like to get the image into memory in Base64. I tried
ExpoFileSystem.readAsStringAsync
but it says thecontent://
schema that I get from the share intent file path is invalid.Any help would be much appreciated!