@@ -12,6 +12,7 @@ export interface StepsItemsProps {
12
12
title ?: string ;
13
13
desc ?: string ;
14
14
status ?: statusType ;
15
+ render ?: React . ReactNode ;
15
16
}
16
17
17
18
export interface StepsProps extends ViewProps {
@@ -35,43 +36,56 @@ export default (props: StepsProps) => {
35
36
36
37
return (
37
38
< 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 > }
66
81
</ 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
+ } ) }
75
89
</ View >
76
90
) ;
77
91
} ;
0 commit comments