React Native Fecth块交互
问题描述:
在android上,当我取东西的时候,它会阻止场景中的任何交互,直到抓取完成为止。我目前正在使用InteractionManager
React Native Fecth块交互
在使用InteractionManager
之前,我试着直接读取,但是它导致了转换滞后。
有没有粘性?
var ProductRender = React.createClass({
getInitialState: function() {
return {
product: null,
modalVisible: false,
description: null,
ready: false
};
},
componentDidMount: function() {
InteractionManager.runAfterInteractions(() => {
fetch(ENDPOINT)
.then((response) => response.json())
.then((responseJson) => {
this.setState({product : responseJson.product, related: responseJson.related});
})
.catch((error) => {
console.error(error);
});
},
});
},
render: function() {...
答
我建议实施redux和学习redux thunk和异步操作一下。
如果你在课堂上使用你的提取器已经死了,我建议为它创建一个单独的异步方法。
React Native无法自行处理? –