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 (
    <SectionList
      ref={c => (this._list = c)}
      sections={sections}
      renderItem={({item}) => <Text>{item.name}<Text>}
    />
  )
}
```
Closes https://github.com/facebook/react-native/pull/15328

Differential Revision: D5546636

Pulled By: javache

fbshipit-source-id: 25aec067879be1571db5c3a09b5f0952826220ac
This commit is contained in:
Luy Tran 2017-08-02 17:30:54 -07:00 committed by Facebook Github Bot
parent 36c694364f
commit ccb0899658
1 changed files with 7 additions and 0 deletions

View File

@ -317,6 +317,13 @@ class SectionList<SectionT: SectionBase<any>> 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