shirakaba / react-nativescript

React renderer for NativeScript
https://react-nativescript.netlify.com
MIT License
280 stars 14 forks source link

Consider providing generic onPropertyChange() prop to enable listening to any property change #26

Closed shirakaba closed 4 years ago

shirakaba commented 5 years ago

From a discussion with triniwiz, on Slack:

triniwiz: everything that is an instance of the property u can bind to it like propName + change triniwiz: Property is from ui/core/view myself: So can you even listen for events fired in response to styles (e.g. left) changing? triniwiz: I have tried but something like borderRadiusChange

... To be honest, I'm not sure whether such a feature is necessary in React NativeScript, because after all React makes everything declarative to begin with. Want to record this information so that it doesn't become lost, in any case.

shirakaba commented 5 years ago

I've provided all the on<observable property name>Change event handlers that I can see to be relevant, so this may be unimportant at this point. I may well have missed some, though.

shirakaba commented 4 years ago

I believe this is now supported, thanks to:

https://github.com/halfnelson/nativescript-source-to-jsx-def/blob/cff268f010c11fd6001b43ea63ef032c187e9ad9/react-nativescript-defs/react-nativescript-jsx.ts#L332-L335