Вот мой код:
Код: Выделить всё
downLoadFile() {
const Url = 'https://www.shareicon.net/data/128x128/2017/06/05/886719_photo_512x512.png';
let fileDirs = RNFetchBlob.fs.dirs.PictureDir;
const filePathEnd = constants.download_image_path +
Url.substring(Url.lastIndexOf("/") + 1, Url.lastIndexOf(".")+'.png');
RNFetchBlob.config({
fileCache: true,
path: fileDirs + filePathEnd,
addAndroidDownloads: {
notification: true,
title: "Download Successful",
description: "An image file.",
mediaScannable: true
}
})
.fetch("GET", Url, {
Authorization: "Bearer access-token..."
})
.then(res => {
if (res.contentLength === res.bytesWritten) {
console.log("RNFetchBlob.config ok");
}
})
.catch((errorMessage) => {
console.log(" RNFetchBlob.config error", errorMessage);
});
}
ОС: android
react-native: 55.4
react-native-fetch-blob: 0.10.8
Я застрял здесь на 2 дня. Буду признателен, если кто-нибудь сможет мне помочь
Подробнее здесь: https://stackoverflow.com/questions/528 ... -0-b-files
Мобильная версия