react-native-native-ui-component

How to implement a React Native UI component method in Android

南笙酒味 提交于 2019-12-06 05:12:01
问题 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. 回答1: Ok I

How to implement a React Native UI component method in Android

匆匆过客 提交于 2019-12-04 10:10:27
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 it's constructor: Here's my UI component :