/* eslint-disable react-native/no-inline-styles */
import {
View,
Text,
StyleSheet,
TouchableOpacity,
Image,
useAnimatedValue,
Animated,
} from 'react-native';
import { useEffect } from 'react';
import { colors } from './color';
import AccordionContent from './AccordionContent';
import type { StatusItemProps } from './types';
const ChevronOpen = () => (
);
const ChevronClose = () => (
);
const StatusItemProgress = ({
idx,
status,
isLastStick,
showOrder,
accordion = false,
showLastStick,
isSelected,
isPrev,
isFuture,
setIdxOpen,
contentWrapperStyle,
contentHeaderStyle,
accordionTitleViewStyle,
accordionChevronViewStyle,
titleStyle,
subTitleStyle,
getTitleColor,
getSubTitleColor,
getBallColor,
getStickColor,
renderStick,
renderBall,
renderChevron,
}: StatusItemProps) => {
const fadeAnim = useAnimatedValue(0);
useEffect(() => {
Animated.timing(fadeAnim, {
toValue: 1,
duration: 500,
useNativeDriver: true,
delay: 500 + idx * 100,
}).start();
}, [fadeAnim, idx]);
return (
{renderBall ? (
renderBall(status, idx, isPrev, isFuture)
) : (
{isPrev && (
✓
)}
{showOrder && !isPrev && (
{idx + 1}
)}
)}
{showLastStick || !isLastStick ? (
renderStick ? (
renderStick(status, idx, isPrev, isFuture)
) : (
)
) : (
)}
setIdxOpen(isSelected ? null : status.status)}
style={[
{
flexDirection: 'row',
justifyContent: 'space-between',
alignItems: 'center',
width: '100%',
},
contentHeaderStyle,
]}
>
{status.title}
{status.subtitle ? (
{status.subtitle}
) : null}
{accordion ? (
{accordion && isSelected
? renderChevron?.(true, idx) ||
: renderChevron?.(false, idx) || }
) : (
)}
);
};
export default StatusItemProgress;
const pageStyles = StyleSheet.create({
ball: {
width: 16,
height: 16,
borderRadius: 8,
backgroundColor: colors.BRIGHT_TEAL,
alignItems: 'center',
justifyContent: 'center',
},
stick: {
backgroundColor: colors.BRIGHT_TEAL,
width: 2,
borderRadius: 5,
marginVertical: 4,
},
title: {
fontWeight: '800',
fontSize: 14,
color: colors.DARK_BLUE,
},
subtitle: {
fontSize: 12,
color: colors.DARK_BLUE,
},
});