question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

FileSystem downloadAsync appearing to download image but the root folder of URI returned is empty

See original GitHub issue

Environment

Environment: OS: macOS Sierra 10.12.6 Node: 8.9.4 Yarn: 1.3.2 npm: 5.6.0 Watchman: 4.9.0 Xcode: Xcode 9.2 Build version 9C40b Android Studio: Not Found

Packages: (wanted => installed) expo: Not Found react: Not Found react-native: ^0.52.0 => 0.52.0

Diagnostics report: https://exp-xde-diagnostics.s3.amazonaws.com/prodigynelson-a7f3cb6e-a870-4487-aae4-0cbee1eba463.tar.gz

Steps to Reproduce

Snack: https://snack.expo.io/rypVQTp_z

Expected Behavior

I am trying to display an image that I downloaded to the cache, but using the URI that is returned by downloadAsync makes the image blank (I am passing it style props).

Actual Behavior

Even though it says that the image was downloaded, I console log the contents of the folder that contains all my caches and it says it’s empty: screenshot 1, screenshot 2, screenshots side by side and the image component returns empty.

Reproducible Demo

See snack link

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:17 (15 by maintainers)

github_iconTop GitHub Comments

4reactions
machester4commented, Mar 7, 2018

I had the same problem and the only temporary solution I found is to move the image to the gallery

let { uri } = await FileSystem.downloadAsync(this.props.item.imgUrl, FileSystem.cacheDirectory + ${this.props.item}.jpg); // here github does not correctly represent the concatenation using ``

const { status } = await Permissions.askAsync(Permissions.CAMERA_ROLL);

if (status === 'granted') {

  CameraRoll.saveToCameraRoll(uri).then((uriGallery) => {
      //here you have the url of the gallery to be able to use it
  });

}
0reactions
dereknelsoncommented, Jun 8, 2018

@joshsiegl1 sorry I missed this, was combing through old issues and found it. IIRC it was an issue with using sagas, I’m not sure if you’re using it for image caching like I am but if you are I have public gists of my caching component which has worked fine for me

Read more comments on GitHub >

github_iconTop Results From Across the Web

FileSystem - Expo Documentation
Download the contents at a remote URI to a file in the app's file system. The directory for a local file uri must...
Read more >
Error When Downloading Image Using Expo File System ...
downloadAsync ( url, FileSystem.documentDirectory + filename ).then(async ({uri}) => { console.log('Finished downloading to ', uri); MediaLibrary ...
Read more >
Image.Source Property (Windows.UI.Xaml.Controls)
This creates a Uniform Resource Identifier (URI) with the ms-appx: scheme and adds the path that is part of the XAML page's location....
Read more >
Nitish Sharma, Author at LogRocket Blog
You can view and download whatever fonts you prefer in .ttf format ... fontSize: 27 }}>Yatra-One</Text> </View> ); } else { return null;...
Read more >
expo sqlite database location - You.com | The AI Search ...
load DB for expo FileSystem.downloadAsync( 'http://example.com/downloads/data.sqlite', FileSystem.documentDirectory + 'data.sqlite' ) .then(({ uri }) ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found