-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Open
Description
Hi,
I'm using TimelineList
with custom rendering of events via the renderEvent
prop of the Timeline
component (passed through renderItem
).
I would like to pass additional custom properties (e.g., location
, user
) to the event object, and access them in my custom UI inside renderEvent
. However, it seems that the event
object is typed as PackedEvent
, which doesn't include any of my custom fields.
Here is a simplified version of my code:
<TimelineList
events={eventsByDate}
renderItem={(props: TimelineProps) => (
<Timeline
{...props}
renderEvent={(event: PackedEvent) => (
<View style={{ backgroundColor: event.color }}>
<Text>{event.title}</Text>
<Text>{event.location}</Text> {/* custom string field */}
<Text>{event.user.name}</Text> {/* custom object field */}
</View>
)}
/>
)}
/>
My questions
Is there an official way to pass and access custom fields on the event object inside renderEvent?
I noticed that PackedEvent only allows a limited set of fields. Is there another way to make renderEvent accept extended event data safely and cleanly?
Thanks a lot for the great library.
Metadata
Metadata
Assignees
Labels
No labels