Examples

Note that some event timeline features are in Early Access, specifically the ones related to venue-type determination.

Install the module

Run the following command to install the module (make sure to install the core module beforehand):

npm i @sentiance-react-native/event-timeline

Import the module

import SentianceEventTimeline from "@sentiance-react-native/event-timeline";

Get timeline updates

const after = new Date();

// returns Promise<Event[]>
const events = await SentianceEventTimeline.getTimelineUpdates(after.getTime());

Get timeline events

const from = new Date(0); // 01/01/1970
const to = new Date(2 ** 31 * 1000);

// returns Promise<Event[]>
const events = await SentianceEventTimeline.getTimelineEvents(
    from.getTime(), to.getTime());

Get a single timeline event

const eventId = 'event_id';

// Returns an Event object if found, undefined otherwise.
const event = await SentianceEventTimeline.getTimelineEvent(eventId);

Listen to timeline updates

const subscription = await SentianceEventTimeline.addTimelineUpdateListener(
  event => {
    // Do something with the event received
});

// Don't forget to unsubscribe, typically in componentWillUnmount
subscription.remove();

You can find a reference to all the types mentioned on this page here.

Last updated