Я только что столкнулся с той же ситуацией, вот как я решил ее:
Я скачал файл, используя rn-fetch-blob
:
let file
RNFetchBlob
.config({
fileCache: true,
appendExt: path.substring(path.lastIndexOf('.')+1, path.length)
//get the file's extension from the URL it's coming from and append to the file name that RNFectchBlob will create locally
})
.fetch('GET', path) //GET request to URL which has your file
.then((res) => {
file = res //var 'file' is the temp object which contains all data from our file
})
с файлом, сохраненным локально в вашем приложении теперь мы можем позвонить CameraRoll
, чтобы сохранить файл:
CameraRoll.saveToCameraRoll(file.path())
.then(Alert.alert("Done!", "Your file has been saved."))