-
Notifications
You must be signed in to change notification settings - Fork 24.3k
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
Use paperTopLevelNameDeprecated in generated EventEmitters if defined #42812
Conversation
This pull request was exported from Phabricator. Differential Revision: D53310654 |
Base commit: 4d07aae |
…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 Differential Revision: D53310654
77e7a0c
to
278211a
Compare
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 Differential Revision: D53310654
278211a
to
376ca7a
Compare
This pull request was exported from Phabricator. Differential Revision: D53310654 |
376ca7a
to
1a5356e
Compare
…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 Differential Revision: D53310654
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
This pull request has been merged in 6974697. |
Are you on a older version of |
Yeah, it was it 😅 On rc1 of screens all is well! |
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
(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.
Differential Revision: D53310654