Skip to content
This repository has been archived by the owner on Jul 1, 2022. It is now read-only.

Commit

Permalink
fix: fixed event prop name regular expression starting 'on'
Browse files Browse the repository at this point in the history
  • Loading branch information
jungeun-cho committed Jan 21, 2020
1 parent 915daf0 commit 1f43156
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,14 +111,14 @@ export default class Calendar extends React.Component {
}

bindEventHandlers = (props) => {
const eventHandlerNames = Object.keys(props).filter((key) => /on[A-Z][a-zA-Z]+/.test(key));
const eventHandlerNames = Object.keys(props).filter((key) => /^on[A-Z][a-zA-Z]+/.test(key));

eventHandlerNames.forEach((key) => {
const eventName = key[2].toLowerCase() + key.slice(3);
this.calendarInst.off(eventName);
this.calendarInst.on(eventName, props[key]);
});
}
};

render() {
return <div ref={this.rootEl} style={{height: this.props.height}} />;
Expand Down

0 comments on commit 1f43156

Please sign in to comment.