Download file using react native

3

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

The point is that it only works if you have internet.

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

How do I do it?

    
asked by anonymous 16.01.2018 / 03:58

1 answer

2

Have you tried using AsyncStorage?

To save the information:


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

To recover:


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

Hug.

    
01.02.2018 / 22:30