2017-01-02 25 views
0

在android上,當我取東西的時候,它會阻止場景中的任何交互,直到抓取完成爲止。我目前正在使用InteractionManagerReact 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() {... 

回答

0

我建議實施redux和學習redux thunk和異步操作一下。

如果你在課堂上使用你的提取器已經死了,我建議爲它創建一個單獨的異步方法。

+0

React Native無法自行處理? –