It's clear to me that for react-native native modules we can use the @ReactMethod
to export a method and call it from JSX, but how do we do the same thing in react-native native UI components?
In the documentation I only see @ReactProp
being mentioned.
If @ReactMethod
is not working, how do I access a property of my native UI component from JSX then? (On iOS this can be done on native ui components with RCT_EXPORT_METHOD
but on Android is something similar possible?)
Thank you.
Ok I ended up creating a Module, and passing a UI Component reference on its constructor:
Here's my UI component:
Here's the Module I created for that component:
and here's how I combine those two together in my Package declaration:
It works like a charm.