import React from 'react'; import { StyleSheet, View } from 'react-native'; import { renderTextLikeJSX } from '../../core/helpers'; import { StepProps } from './interface'; import createStyle from './styles/step-horizontal.style'; import { useTheme } from '../Theme'; const StepHorizontal: React.VFC< StepProps & { isFirstChild: boolean; isLastChild: boolean; collapse: boolean; } > = ({ status, title, description, isFirstChild, isLastChild, collapse }) => { const token = useTheme(); const styles = createStyle(token); const renderCollapseElement = () => { const statusBackgroundColor = status === 'wait' ? styles.waitCollapsedLineBackgroundColor : styles.activeBackgroundColor; return ( ); }; const renderContent = () => { const statusBackgroundColor = status === 'wait' ? styles.waitBackgroundColor : styles.activeBackgroundColor; const dotStyle = StyleSheet.flatten([styles.dot, statusBackgroundColor]); return ( {renderTextLikeJSX( title, StyleSheet.flatten([ styles.title, status === 'wait' && { color: styles.description.color, }, ]) )} {renderTextLikeJSX( description, StyleSheet.flatten([ styles.description, status !== 'wait' && { color: styles.title.color, }, ]) )} ); }; return collapse ? renderCollapseElement() : renderContent(); }; export default StepHorizontal;