Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: event declartion and handler #929

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

rabbitom
Copy link

@rabbitom rabbitom commented Mar 12, 2024

Description

Why

  • 'ReactEvent' is obsolete, it raises error when compiling, change it to 'Action'.
  • 'eventHandler' is a member of the component, it raises render error without 'this.'

Screenshots

ReactEvent error ReactEvent Obsolete eventHandler not defined
Microsoft Reviewers: Open in CodeFlow

@rabbitom rabbitom requested a review from a team as a code owner March 12, 2024 00:28
@chrisglein chrisglein self-assigned this May 13, 2024
Comment on lines 498 to +505
componentDidMount() {
// Subscribing to FancyMath.AddEvent
FancyMathEventEmitter.addListener('AddEvent', eventHandler, this);
FancyMathEventEmitter.addListener('AddEvent', this.eventHandler, this);
}

componentWillUnmount() {
// Unsubscribing from FancyMath.AddEvent
FancyMathEventEmitter.removeListener('AddEvent', eventHandler, this);
FancyMathEventEmitter.removeListener('AddEvent', this.eventHandler, this);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This part doesn't appear in the native sample code in the repo, just in the docs.
@jonthysell Is it expected to appear in https://github.com/microsoft/react-native-windows-samples/tree/main/samples/NativeModuleSample?

@chrisglein chrisglein self-requested a review July 29, 2024 17:52
@chrisglein chrisglein removed their assignment Jul 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants