react-native-calendars icon indicating copy to clipboard operation
react-native-calendars copied to clipboard

TimelineList throws an error due to `key` prop being spread instead of explicitly passed

Open SimeonKostov opened this issue 7 months ago • 4 comments

The error below is thrown when using TimelineList.

 (NOBRIDGE) ERROR  Warning: A props object containing a "key" prop is being spread into JSX:
  let props = {key: someKey, format24h: ..., overlapEventsSpacing: ..., rightEdgeSpacing: ..., scrollToFirst: ..., scrollToNow: ..., date: ..., events: ..., initialTime: ..., scrollOffset: ..., onChangeOffset: ..., showNowIndicator: ..., numberOfDays: ..., timelineLeftInset: ...};
  <Timeline {...props} />
React keys must be passed directly to JSX without using spread:
  let props = {format24h: ..., overlapEventsSpacing: ..., rightEdgeSpacing: ..., scrollToFirst: ..., scrollToNow: ..., date: ..., events: ..., initialTime: ..., scrollOffset: ..., onChangeOffset: ..., showNowIndicator: ..., numberOfDays: ..., timelineLeftInset: ...};
  <Timeline key={someKey} {...props} />

The key prop is defined in the _timelineProps and then spread into <Timeline {..._timelineProps} /> https://github.com/wix/react-native-calendars/blob/3a6183815232199befb675e280edd909bcc3a6fc/src/timeline-list/index.tsx#L124-L145

SimeonKostov avatar May 18 '25 15:05 SimeonKostov

I am also seeing this warning.

trizzyanguizzy avatar Jun 14 '25 01:06 trizzyanguizzy

Any solution to this issue?

geoffcfchen avatar Jul 13 '25 08:07 geoffcfchen

+1 (wtf xd?)

kdshop avatar Nov 10 '25 13:11 kdshop