@@ -12,6 +12,7 @@ export interface StepsItemsProps {
1212 title ?: string ;
1313 desc ?: string ;
1414 status ?: statusType ;
15+ render ?: React . ReactNode ;
1516}
1617
1718export interface StepsProps extends ViewProps {
@@ -35,43 +36,56 @@ export default (props: StepsProps) => {
3536
3637 return (
3738 < View style = { styles . steps } { ...others } >
38- { items . map ( ( item , index ) => (
39- < TouchableOpacity style = { [ styles . item ] } key = { index } onPress = { ( ) => onStepsPress ( index ) } >
40- < View style = { styles . wrap } >
41- { index !== 0 && < View style = { styles . leftLine } > </ View > }
42- < View
43- style = { [
44- styles . circular ,
45- {
46- backgroundColor :
47- current >= index && ! item ?. status
48- ? theme . colors . primary_background || '#3578e5'
49- : theme . colors . gray100 || '#e5e5e5' ,
50- } ,
51- ] }
52- >
53- { item ?. status === 'error' && < Icon name = "circle-close" size = { 22 } fill = { theme . colors . func600 } /> }
54- { item ?. status === 'success' && (
55- < Icon name = "circle-check" size = { 22 } fill = { theme . colors . primary_background || '#3578e5' } />
56- ) }
57- { ! item ?. status && (
58- < Text
59- style = { {
60- color : current >= index ? theme . colors . white : theme . colors . gray500 ,
61- } }
62- >
63- { index + 1 }
64- </ Text >
65- ) }
39+ { items . map ( ( item , index ) => {
40+ if ( item . render ) {
41+ return (
42+ < TouchableOpacity style = { [ styles . item ] } key = { index } onPress = { ( ) => onStepsPress ( index ) } >
43+ < View style = { styles . wrap } >
44+ { index !== 0 && < View style = { styles . leftLine } > </ View > }
45+ { item . render }
46+ { index < items . length - 1 && < View style = { styles . rightLine } > </ View > }
47+ </ View >
48+ </ TouchableOpacity >
49+ ) ;
50+ }
51+ return (
52+ < TouchableOpacity style = { [ styles . item ] } key = { index } onPress = { ( ) => onStepsPress ( index ) } >
53+ < View style = { styles . wrap } >
54+ { index !== 0 && < View style = { styles . leftLine } > </ View > }
55+ < View
56+ style = { [
57+ styles . circular ,
58+ {
59+ backgroundColor :
60+ current >= index && ! item ?. status
61+ ? theme . colors . primary_background || '#3578e5'
62+ : theme . colors . gray100 || '#e5e5e5' ,
63+ } ,
64+ ] }
65+ >
66+ { item ?. status === 'error' && < Icon name = "circle-close" size = { 22 } fill = { theme . colors . func600 } /> }
67+ { item ?. status === 'success' && (
68+ < Icon name = "circle-check" size = { 22 } fill = { theme . colors . primary_background || '#3578e5' } />
69+ ) }
70+ { ! item ?. status && (
71+ < Text
72+ style = { {
73+ color : current >= index ? theme . colors . white : theme . colors . gray500 ,
74+ } }
75+ >
76+ { index + 1 }
77+ </ Text >
78+ ) }
79+ </ View >
80+ { index < items . length - 1 && < View style = { styles . rightLine } > </ View > }
6681 </ View >
67- { index < items . length - 1 && < View style = { styles . rightLine } > </ View > }
68- </ View >
69- < Text color = "primary_text" > { item . title } </ Text >
70- < Text color = "text" style = { styles . desc } >
71- { item . desc }
72- </ Text >
73- </ TouchableOpacity >
74- ) ) }
82+ < Text color = "primary_text" > { item . title } </ Text >
83+ < Text color = "text" style = { styles . desc } >
84+ { item . desc }
85+ </ Text >
86+ </ TouchableOpacity >
87+ ) ;
88+ } ) }
7589 </ View >
7690 ) ;
7791} ;
0 commit comments