【发布时间】:2018-01-22 12:48:53
【问题描述】:
我正在尝试使用react-native-fetch-polyfill,因为timeout 功能用于获取请求但无法实现onProgress 事件:
fetch('https://jsonplaceholder.typicode.com/posts', {
method: 'POST',
body: JSON.stringify({
title: 'foo',
body: 'bar',
userId: 1
}),
headers: {
"Content-type": "application/json; charset=UTF-8"
}
})
.then(function(data) {
console.log(data);
})
.catch(function(error) {
console.log('Fetch Error :-S', error);
});
我不知道在哪里添加:
onUploadProgress: function (progressEvent)
【问题讨论】:
标签: react-native fetch