acidb / mobiscroll

Cross platform UI controls for progressive web and hybrid apps (plain JS, jQuery, Angular and React)
https://mobiscroll.com
Other
1.54k stars 439 forks source link

Eventcalendar.renderScheduleEventContent no longer works when function returns JSX.Element (broke @mobiscroll/react v.5.22.0) #513

Closed thhermansen closed 1 year ago

thhermansen commented 1 year ago

We have the following code:

    import { Eventcalendar } from '@mobiscroll/react';

    <EventCalendar
      data={calendarEvents}
      renderScheduleEventContent={(event) => {
        return <span>{event.title}</span>;
      }}
      view={{
        timeline: {
          type: 'week',
        },
      }}
    />

Which renders this, without the event.title:

image

In version v.5.21.2 this would rendered the event.title above the event's time. If we alter the code a bit so it returns only a string:

    import { Eventcalendar } from '@mobiscroll/react';

    <EventCalendar
      data={calendarEvents}
      renderScheduleEventContent={(event) => {
        return event.title;
      }}
      view={{
        timeline: {
          type: 'week',
        },
      }}
    />

We get:

image

Which is more in line with what we expect, where the title of the event is rendered.


Btw, we can inject HTML by returning a string, but this is obviously not something we want to do:

    import { Eventcalendar } from '@mobiscroll/react';

    <EventCalendar
      data={calendarEvents}
      renderScheduleEventContent={(event) => {
        return `<span style="color: red;">${event.title}</span>`;
      }}
      view={{
        timeline: {
          type: 'week',
        },
      }}
    />
image
dioslaska commented 1 year ago

Fixed in v5.22.3