mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-03 22:48:25 +08:00
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:
committed by
Facebook Github Bot
parent
36c694364f
commit
ccb0899658
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user