-
Notifications
You must be signed in to change notification settings - Fork 46.9k
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
Add skipBubbling property to dispatch config #23366
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -73,6 +73,7 @@ export type ViewConfig = $ReadOnly<{ | |
phasedRegistrationNames: $ReadOnly<{ | ||
captured: string, | ||
bubbled: string, | ||
skipBubble?: ?boolean, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @lunaleaps seems like this property name is (accidentally?) different here, flow check during React sync caught this There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh my mistake! How should I address? Can we fix forward on the sync? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Submitting a fix now: #24109 -- waiting for tests to pass. If anyone knows what I should've run to check this .. let me know! |
||
}>, | ||
}>, | ||
..., | ||
|
Original file line number | Diff line number | Diff line change | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -19,6 +19,7 @@ const customBubblingEventTypes: { | |||||||||||||||||||
phasedRegistrationNames: $ReadOnly<{| | ||||||||||||||||||||
captured: string, | ||||||||||||||||||||
bubbled: string, | ||||||||||||||||||||
skipBubbling?: ?boolean, | ||||||||||||||||||||
|}>, | ||||||||||||||||||||
Comment on lines
19
to
23
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This type implies the possibility of a nonsensical value:
Could you have accomplished the same by making
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yea I thought about this but we still need a way to define what the bubbled event listener name is. Because even if we don't bubble, we still need to dispatch that listener on the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess clarification -- the bubbled listener is still dispatched on the target even if the event is non-bubbling There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ahh, right. This really reveals how terrible the current event config is at describing the events, heh. Thanks for the explanation. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I may be missing some previous discussions on this, but what do we think about calling this Long term, the event config could match even closer to the Web spec for dispatching custom events, something like: {
type: string,
bubbles: boolean,
// Not in web spec, but could be implemented in React.
captures: boolean,
} Which would turn this: {
bubblingEventTypes: {
topDefaultBubblingEvent: {
phasedRegistrationNames: {
captured: 'onDefaultBubblingEventCapture',
bubbled: 'onDefaultBubblingEvent',
},
},
}
directEventTypes: {
topDirectEvent: {
registrationName: 'onDirectEvent',
},
}
} Into this: [
{
// Bubbling phase is onDefaultBubblingEvent
// Capture phase is onDefaultBubblingEventCapture
// Top is topDefaultBubblingEvent
// Captures and bubbles
type: 'DefaultBubblingEvent',
bubbles: true,
captures: true,
},
{
// Direct event name is onDirectEvent, no capture, no bubble.
type: 'DirectEvent',
bubbles: false,
captures: false,
}
] Notice that there's only one config (instead of bubbling vs direct), and all of the event names like |
||||||||||||||||||||
|}>, | ||||||||||||||||||||
..., | ||||||||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can use
?.
here?