Skip to content

Commit

Permalink
Move event splitting to renderContainer
Browse files Browse the repository at this point in the history
  • Loading branch information
Hypnosphi committed Nov 25, 2020
1 parent b73951a commit b2b5d7b
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions packages/victory-core/src/victory-util/add-events.js
Original file line number Diff line number Diff line change
Expand Up @@ -238,10 +238,8 @@ export default (WrappedComponent, options) => {
Events.getPartialEvents(baseEvents, key, componentProps),
componentProps.events
);
this.globalEvents = Events.getGlobalEvents(events);
const localEvents = Events.omitGlobalEvents(events);

return assign({}, componentProps, { events: localEvents });
return assign({}, componentProps, { events });
}

return defaults({ index, key: id }, component.props, baseProps, { id });
Expand All @@ -250,6 +248,10 @@ export default (WrappedComponent, options) => {
renderContainer(component, children) {
const isContainer = component.type && component.type.role === "container";
const parentProps = isContainer ? this.getComponentProps(component, "parent", "parent") : {};
if (parentProps.events) {
this.globalEvents = Events.getGlobalEvents(parentProps.events);
parentProps.events = Events.omitGlobalEvents(parentProps.events);
}
return React.cloneElement(component, parentProps, children);
}

Expand Down

0 comments on commit b2b5d7b

Please sign in to comment.