React-Native: Download and download files from android website

I use the bridge module for the React-Native web browser because I need its functions, and now I'm trying to upload and download files. To download, I sent a message from the url of the file, and then, using the Linking package to download in the browser, unfortunately, I received that the download was unsuccessful. Is there a way that I can control how to work on this module?

+4
source share
2 answers

I recently had to face the same issue for Android (albeit for downloading files). You can see my implementation here: https://github.com/martinarroyo/react-native-webview-file-upload/

Perhaps if you add this code to include something like this , you can enable file downloads.

+4
source

fetch(
            _apiRoot+url+'?_format=json&access_token='+this.getAccessToken(),
            {
                method: 'POST',
                headers: {
                    'Accept': 'application/json',
                    'Content-Type': 'application/json'
                },
                body:JSON.stringify(data)
            }).then((response) => response.json())
            .then((response) => {
                success(response.data);
            })
            .catch((errorData) => {
                error(errorData);
            });

//Where data is an object like

let data = {
  images:[responseDataFromImagePicker.data,responseDataFromImagePicker.data]
}
//the picker returns the image encoded in base64
Run code
0
source

Source: https://habr.com/ru/post/1661463/


All Articles