Skip to content

Refactor Timeline component to use theme props to support config. #3695

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 24, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/components/timeline/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, {useCallback, useMemo, useEffect, useState, useRef} from 'react';
import {StyleSheet, MeasureOnSuccessCallback, LayoutChangeEvent} from 'react-native';
import {Colors, Spacings} from '../../style';
import {useThemeProps} from '../../hooks';
import View from '../view';
import Point from './Point';
import Line from './Line';
Expand All @@ -17,9 +18,9 @@ export {
const CONTENT_CONTAINER_PADDINGS = Spacings.s2;
const ENTRY_POINT_HEIGHT = 2;


const Timeline = (props: TimelineProps) => {
const {topLine, bottomLine, point, children} = props;
const themeProps = useThemeProps(props, 'Timeline');
const {topLine, bottomLine, point, children} = themeProps;
const [anchorMeasurements, setAnchorMeasurements] = useState<Layout | undefined>();
const [contentContainerMeasurements, setContentContainerMeasurements] = useState<Layout | undefined>();
const [pointMeasurements, setPointMeasurements] = useState<Layout | undefined>();
Expand Down Expand Up @@ -59,7 +60,7 @@ const Timeline = (props: TimelineProps) => {
return Colors.$backgroundDangerHeavy;
case StateTypes.SUCCESS:
return Colors.$backgroundSuccessHeavy;
default:
default:
return Colors.$backgroundPrimaryHeavy;
}
};
Expand Down