2017-06-10 31 views
2

我新來react-native並嘗試使用SectionList。到目前爲止,一切正常。但是,我似乎無法使用facebook的文檔中定義的scrollToLocation函數。任何人嘗試使用它或類似的東西?基本上,我想滾動到特定的部分和項目。react-native SectionList scrollTo

 return Promise.all([ 
     props.orderActions.set(orders, true), 
     props.orderActions.set(orders, false), 
    ]).then(() => { 
     return this._ordersList.scrollToLocation({ 
     animated: false, 
     sectionIndex: 0, 
     itemIndex: historyItems.length - 1 
     }) 
    }) 

_ordersList是對SectionList組件的引用。

謝謝!

+0

每當你發佈一個問題,請確保你添加的代碼,以便讀者可以給一個密切的答案。 – Codesingh

+0

@Codesingh感謝您的反饋。我已經更新了 – justelouise

+0

react-native版本的問題? – Codesingh

回答

1

升級到0.45做到了。有性能問題,但設法解決它通過使用PureComponent

+0

感謝@Codesingh!歡迎使用 – justelouise

+0

..總是使用最新的react-native版本:) – Codesingh