Use paperTopLevelNameDeprecated in generated EventEmitters if defined#42812
Closed
dmytrorykun wants to merge 1 commit into
Closed
Use paperTopLevelNameDeprecated in generated EventEmitters if defined#42812dmytrorykun wants to merge 1 commit into
dmytrorykun wants to merge 1 commit into
Conversation
Contributor
|
This pull request was exported from Phabricator. Differential Revision: D53310654 |
Base commit: 4d07aae |
77e7a0c to
278211a
Compare
Contributor
|
This pull request was exported from Phabricator. Differential Revision: D53310654 |
278211a to
376ca7a
Compare
Contributor
|
This pull request was exported from Phabricator. Differential Revision: D53310654 |
376ca7a to
1a5356e
Compare
Contributor
|
This pull request was exported from Phabricator. Differential Revision: D53310654 |
…facebook#42812) Summary: There is a way of defining events where you specify additional string type parameter in the EventHandler in the spec. This additional type parameter is an overridden top level event name, that can be completely unrelated to the event handler name. More context here D16042065. Let's say we have ``` onLegacyStyleEvent?: ?BubblingEventHandler<LegacyStyleEvent, 'alternativeLegacyName'> ``` This will produce the following entry in the view config: ``` topAlternativeLegacyName: { phasedRegistrationNames: { captured: 'onLegacyStyleEventCapture', bubbled: 'onLegacyStyleEvent' } } ``` This means that React expects `topAlternativeLegacyName`. But the generated EventEmitter looks like this: ``` void RNTMyNativeViewEventEmitter::onLegacyStyleEvent(OnLegacyStyleEvent $event) const { dispatchEvent("legacyStyleEvent", [$event=std::move($event)](jsi::Runtime &runtime) { auto $payload = jsi::Object(runtime); $payload.setProperty(runtime, "string", $event.string); return $payload; }); } ``` The native component will emit `legacyStyleEvent` (`topLegacyStyleEvent` after normalization) that React will not be able to handle. This issue only happens on iOS because Android doesn't use EventEmitter currently. To address this issue we'll use `paperTopLevelNameDeprecated` for the generated EventEmitters if it is defined. Changelog: [iOS][Fixed] - Fixed support for event name override in component specs. Reviewed By: cortinico, mdvacca, cipolleschi Differential Revision: D53310654
1a5356e to
a7732e6
Compare
Contributor
|
This pull request has been merged in 6974697. |
Contributor
Contributor
Are you on a older version of |
Contributor
|
Yeah, it was it 😅 On rc1 of screens all is well! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary:
There is a way of defining events where you specify additional string type parameter in the EventHandler in the spec. This additional type parameter is an overridden top level event name, that can be completely unrelated to the event handler name.
More context here D16042065.
Let's say we have
This will produce the following entry in the view config:
This means that React expects
topAlternativeLegacyName.But the generated EventEmitter looks like this:
The native component will emit
legacyStyleEvent(topLegacyStyleEventafter normalization) that React will not be able to handle.This issue only happens on iOS because Android doesn't use EventEmitter currently.
To address this issue we'll use
paperTopLevelNameDeprecatedfor the generated EventEmitters if it is defined.Changelog: [iOS][Fixed] - Fixed support for event name override in component specs.
Differential Revision: D53310654