Download file using React Native

Asked

Viewed 766 times

3

I have an Android app that when running accesses a file and lists some information on the screen.

The point is, it only works if there’s an Internet.

What I need is to download the information and save on the device to be accessed offline.

How should I do?

1 answer

2

Already tried using Asyncstorage?

To store the information:


AsyncStorage.setItem("chave", "valor");

To recover:


AsyncStorage.getItem("chave").then((value) => {
    // salvar no "this.state".
    this.setState({"chave": value});
}).done();

Hug.

  • The saved file gets stored to be accessed other times, even after the user closes the app?

  • works with images?

  • 1

    It is saved. For image you can try using this project: https://github.com/wkh237/react-native-fetch-blob

Browser other questions tagged

You are not signed in. Login or sign up in order to post.