Skip to content

Commit 176f887

Browse files
authored
Refactor Timeline component to use theme props to support config. (#3695)
1 parent fe1c10c commit 176f887

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/components/timeline/index.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React, {useCallback, useMemo, useEffect, useState, useRef} from 'react';
22
import {StyleSheet, MeasureOnSuccessCallback, LayoutChangeEvent} from 'react-native';
33
import {Colors, Spacings} from '../../style';
4+
import {useThemeProps} from '../../hooks';
45
import View from '../view';
56
import Point from './Point';
67
import Line from './Line';
@@ -17,9 +18,9 @@ export {
1718
const CONTENT_CONTAINER_PADDINGS = Spacings.s2;
1819
const ENTRY_POINT_HEIGHT = 2;
1920

20-
2121
const Timeline = (props: TimelineProps) => {
22-
const {topLine, bottomLine, point, children} = props;
22+
const themeProps = useThemeProps(props, 'Timeline');
23+
const {topLine, bottomLine, point, children} = themeProps;
2324
const [anchorMeasurements, setAnchorMeasurements] = useState<Layout | undefined>();
2425
const [contentContainerMeasurements, setContentContainerMeasurements] = useState<Layout | undefined>();
2526
const [pointMeasurements, setPointMeasurements] = useState<Layout | undefined>();
@@ -59,7 +60,7 @@ const Timeline = (props: TimelineProps) => {
5960
return Colors.$backgroundDangerHeavy;
6061
case StateTypes.SUCCESS:
6162
return Colors.$backgroundSuccessHeavy;
62-
default:
63+
default:
6364
return Colors.$backgroundPrimaryHeavy;
6465
}
6566
};

0 commit comments

Comments
 (0)