Skip to main content

Timeline timeline component

Effect demonstration

1. Basic usage

  const steps = [
{
title: 'First Step',
description: 'Test test test test test test test test test test test test test test test test test test test test test test',
date: '12-12',
time: '10:10',
},
{
title: 'Step 2',
description: 'Test',
date: '12-12',
time: '10:11',
},
{
title: 'Step 3',
description: 'Test',
date: '12-12',
time: '10:12',
},
{
title: 'Step 4',
description: 'Test',
date: '12-12',
time: '10:13',
},
];

<Text>Basic:</Text>
<WhiteSpace />
<Timeline data={steps} />
Basic use

2. Horizontal sliding

  const steps = [
{
title: 'First Step',
description: 'Test test test test test test test test test test test test test test test test test test test test test test',
date: '12-12',
time: '10:10',
},
{
title: 'Step 2',
description: 'Test',
date: '12-12',
time: '10:11',
},
{
title: 'Step 3',
description: 'Test',
date: '12-12',
time: '10:12',
},
{
title: 'Step 4',
description: 'Test',
date: '12-12',
time: '10:13',
},
];

<Text>Swipe horizontally:</Text>
<Timeline data={steps} direction="horizontal" />
Swipe horizontally

3. Customize small icons

  const steps = [
{
title: 'First Step',
description: 'Test test test test test test test test test test test test test test test test test test test test test test',
date: '12-12',
time: '10:10',
},
{
title: 'Step 2',
description: 'Test',
date: '12-12',
time: '10:11',
},
{
title: 'Step 3',
description: 'Test',
date: '12-12',
time: '10:12',
},
{
title: 'Step 4',
description: 'Test',
date: '12-12',
time: '10:13',
},
];
<Text>Customized small icon:</Text>
<WhiteSpace />
<Timeline data={steps} customIcon={<SvgIcon name="bells"/>} direction="horizontal" />
custom small icon

4. Customize line style

  const steps = [
{
title: 'First Step',
description: 'Test test test test test test test test test test test test test test test test test test test test test test',
date: '12-12',
time: '10:10',
},
{
title: 'Step 2',
description: 'Test',
date: '12-12',
time: '10:11',
},
{
title: 'Step 3',
description: 'Test',
date: '12-12',
time: '10:12',
},
{
title: 'Step 4',
description: 'Test',
date: '12-12',
time: '10:13',
},
];
<Text>Customized line style:</Text>
<WhiteSpace />
<Timeline data={steps} lineStyle={{backgroundColor: 'red'}} />
Custom line style

API

TimelineProps

PropertiesRequiredDescriptionTypeDefault Value
datatrueTimeline node dataTimelineStepProps[]
directionfalseTimeline sorting directionhorizontal | verticalvertical
customIconfalsecustom iconReactElement
lineStylefalseLine styleStyleProp<ViewStyle>

TimelineStepProps

PropertiesRequiredDescriptionTypeDefault Value
titlefalseThe title of the timeline nodestring
descriptionfalseThe subtitle of the timeline nodestring
datefalseThe date to the left of the timeline nodestring
timefalseThe time to the left of the timeline nodestring