-
I got my Android Fabric Component to be displayed correctly by following the fabric-native-components doc, and now I'm trying to fire a callback on JS side from my Kotlin ViewManager. For this, I'm using the Here's what I did so far: In my override fun getExportedCustomBubblingEventTypeConstants(): MutableMap<String, Any> {
return MapBuilder.of(
"onPressKey",
MapBuilder.of("phasedRegistrationNames", MapBuilder.of("bubbled", "onPressKey"))
) I send the event from the val event: Event<MyKeyboardEvent> = MyKeyboardEvent(
UIManagerHelper.getSurfaceId(mReactContext),
mViewTag,
eventName,
primaryCode,
character
)
val dispatcher = UIManagerHelper.getEventDispatcherForReactTag(mReactContext, mViewTag)
dispatcher?.dispatchEvent(event) On the component spec I defined the props for my event: interface NativeProps extends ViewProps {
onPressKey: BubblingEventHandler<MyKeyboardEvent>;
} And on the component declaration I attach a callback that never gets called: <MyKeyboard onPressKey={onPressKey} /> Am I missing something? Are there any docs that I could use to check if some part is not setup correctly? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Small update: I've stepped into the execution of the |
Beta Was this translation helpful? Give feedback.
-
The problem was that my |
Beta Was this translation helpful? Give feedback.
The problem was that my
reactTag
was -1. I modified the way the event gets thereactTag
and it worked fine.The react-native-menu repo is the best reference I could find for implementing Fabric components so far.