Replies: 1 comment 3 replies
-
Hi @lindboe! In JS, you have to specify your event as a prop: type TestEventType = {
};
export interface NativeProps extends ViewProps {
// ...
onTestEvent?: CodegenTypes.BubblingEventHandler<TestEventType> | null;
} In native, you do this (iOS) // In RCTTestView
// Event emitter convenience method
- (const TestViewEventEmitter &)eventEmitter
{
return static_cast<const TestViewEventEmitter &>(*_eventEmitter);
}
-(void)emitEvent
{
self.eventEmitter.onTestEvent();
} |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Today I learned that while I can add event emitters to my Turbo Module spec (
readonly onTestEvent: CodegenTypes.EventEmitter<void>;
)., the same pattern doesn't work for a Fabric component spec:Is there support for this for Fabric components that I've missed? I'm not finding any docs about this, although I did find this link of an example about how to use EventDispatcher directly on Android: https://github.com/react-native-menu/menu/pull/749/files.
Generally this is hard to sort through myself as there's a lot of event emitting APIs and I'm not sure what I should use, and we seem to not have documentation on them.
Beta Was this translation helpful? Give feedback.
All reactions