-
Notifications
You must be signed in to change notification settings - Fork 24.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FlatList] setNativeProps
does not work with FlatList
component
#13501
Comments
i need the setNativeProps support too. |
Btw what are the advantages of using |
It allows you to set the properties on the native component without triggering a set state to happen |
What are the benefits of that? Some use case for example? |
@henrikra the docs are helpful in clarifying this http://facebook.github.io/react-native/releases/0.43/docs/direct-manipulation.html |
There is a PR for this: #13529 |
setNativeProps
does not work with FlatList
componentsetNativeProps
does not work with FlatList
component
Summary: Curently FlatList does not implement setting native props directly like the old ListView did. This pr introduce the `setNativeProps` function which delegates to MetroListView or VirtualizedList. Thos don't have `setNativeProps` handling either, so, I delegated further to the respective ListView and Scroll components, which do have handling for it, thus, allowing to set the native props through FlatList. Create a project with a FlatList and change a native property using `setNativeProps`: ```javascript componentDidMount() { setInterval(() => { this.list.setNativeProps({ style: {backgroundColor:"white"} }) }, 1000) } render() { return ( <View style={styles.container}> <FlatList ref={component => this.list = component} style={{backgroundColor:"black"}} data={[{key: 'a'}, {key: 'b'}]} renderItem={({item}) => <Text>{item.key}</Text>} /> </View> ) } ``` Fixes facebook#13501 Closes facebook#13529 Differential Revision: D5283593 Pulled By: sahrens fbshipit-source-id: 8f96f88e286042d82452fef924689b5a8a783987
setNativeProps
does not work withFlatList
componentthanks in advance。
The text was updated successfully, but these errors were encountered: