Turbo Module EventEmitters as functions (#44886)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44886

## Changelog:

[General] [Added] - Turbo Module EventEmitters as functions

Reviewed By: javache

Differential Revision: D58429202

fbshipit-source-id: c56793d216f5ecf981e62d3b004f715110903945
This commit is contained in:
Christoph Purrer
2024-06-11 23:35:36 -07:00
committed by Facebook GitHub Bot
parent 6a3a305628
commit 42f136d00d
5 changed files with 9 additions and 18 deletions
@@ -266,22 +266,20 @@ class NativeCxxModuleExampleExample extends React.Component<{||}, State> {
}
if (NativeCxxModuleExample) {
this.eventSubscriptions.push(
NativeCxxModuleExample.onPress.addListener(value =>
console.log('onPress: ()'),
),
NativeCxxModuleExample.onPress(value => console.log('onPress: ()')),
);
this.eventSubscriptions.push(
NativeCxxModuleExample.onClick.addListener(value =>
NativeCxxModuleExample.onClick(value =>
console.log(`onClick: (${value})`),
),
);
this.eventSubscriptions.push(
NativeCxxModuleExample.onChange.addListener(value =>
console.log(`onChange: (${JSON.stringify(value)})`),
NativeCxxModuleExample.onChange(value =>
console.log(`onChange: ${JSON.stringify(value)})`),
),
);
this.eventSubscriptions.push(
NativeCxxModuleExample.onSubmit.addListener(value =>
NativeCxxModuleExample.onSubmit(value =>
console.log(`onSubmit: (${JSON.stringify(value)})`),
),
);