From ccb0899658f7796aefe67008fa36cd3f7331bec9 Mon Sep 17 00:00:00 2001 From: Luy Tran Date: Wed, 2 Aug 2017 17:30:54 -0700 Subject: [PATCH] add setNativeProps to SectionList Summary: ```js componentDidMount() { this._list.setNativeProps({scrollEnabled: false}) } render() { const sections = [ {key: 'foo', data: [{name: 'Jone Doe', key: 'a'}, {name: 'Susan Briz', key: 'b'}], {key: 'bar', data: [{name: 'David Mark', key: 'c'}, {name: 'Daniel Campbell', key: 'd'}] ] return ( (this._list = c)} sections={sections} renderItem={({item}) => {item.name}} /> ) } ``` Closes https://github.com/facebook/react-native/pull/15328 Differential Revision: D5546636 Pulled By: javache fbshipit-source-id: 25aec067879be1571db5c3a09b5f0952826220ac --- Libraries/Lists/SectionList.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Libraries/Lists/SectionList.js b/Libraries/Lists/SectionList.js index f56673cbe98..1f5e54f4ee4 100644 --- a/Libraries/Lists/SectionList.js +++ b/Libraries/Lists/SectionList.js @@ -317,6 +317,13 @@ class SectionList> extends React.PureComponent< } } + setNativeProps(props: Object) { + const listRef = this._wrapperListRef && this._wrapperListRef.getListRef(); + if (listRef) { + listRef.setNativeProps(props); + } + } + render() { const List = this.props.legacyImplementation ? MetroListView