How can I get the default style props from inside my React Native app or with a debugging tool? I tried with React Devtools, but they only show the props that I set, not the default ones. But I am interested in the default values. How can I watch them? I do not want to depend on the documentation and want to really check it in my running app. I am using functional components.
You can get and modify default props by importing that component. For example, I used the following code to modify FlatList behavior globally including node modules that I am using:
if (FlatList.defaultProps == null) {
FlatList.defaultProps = {}
}
FlatList.defaultProps.initialNumToRender = 10
FlatList.defaultProps.maxToRenderPerBatch = 10
FlatList.defaultProps.scrollEventThrottle = 15
FlatList.defaultProps.bounces = false
I believe that you can use console.warn or console.log inside render method of a scene to see its content.
Inside render block place following code:
render(){
console.warn(FlatList.defaultProps)
return (
<View>
...
</View>
)
}

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With