import React, { memo } from 'react' import { View, type TextStyle, type ViewStyle, Text, type ColorValue } from 'react-native' import { WAVEFORM_LINE_WIDTH, formatSeconds, Spacing, TIMELINE_MS_PER_LINE } from '../helpers' const TIMELINE_HEIGHT = Spacing.xl const DEFAULT_COLOR = 'rgba(0, 0, 0, 0.5)' interface TimelineProps { color?: ColorValue gap: number duration: number } export const Timeline = memo(({ color, gap, duration }: TimelineProps) => { const timelineColor = color ?? DEFAULT_COLOR const timeline = Array.from({ length: duration / TIMELINE_MS_PER_LINE + 1 }) return ( {timeline.map((_, index) => { const isSeconds = index % 4 === 0 const height = isSeconds ? Spacing.sm : Spacing.xs return ( {isSeconds && ( {formatSeconds(index / 4)} )} ) })} ) }) const $timelineSeconds: TextStyle = { position: 'absolute', width: Spacing.xxl, fontSize: 12, bottom: 0, } const $container: ViewStyle = { position: 'absolute', flexDirection: 'row', height: TIMELINE_HEIGHT, bottom: -TIMELINE_HEIGHT, }