rcdexta / react-event-timeline

A responsive event timeline in React.js
https://rcdexta.com/react-event-timeline
MIT License
536 stars 56 forks source link

React prop warning issue #30

Closed andrew781026 closed 5 years ago

andrew781026 commented 5 years ago

i got a React prop warning , how can i fix it ?

at https://codesandbox.io/s/13k1jjqj64 image

hijarian commented 5 years ago

@rcdexta The spread <div {...otherProps} on this line causes those warnings: https://github.com/rcdexta/react-event-timeline/blob/d35b8330b953faa9791f7689fd9d7ec893c765c4/components/TimelineEvent.js#L91 but the solution is not that simple.

If you actually want users to be able to pass arbitrary props from root TimelineEvent down to this exact div, you have to use something like lodash's _.omit() to exclude contentStyle, cardHeaderStyle and showContent props.

If you don't want that, probably better solution would be to explicitly list what you want passed down to this div.

rcdexta commented 5 years ago

Should be fixed in v1.6.2. Desired props have been whitelisted. Thanks @andrew781026 @hijarian