I have a multi-step form and in the top header I want to show some kind if breadcumbs, I'm trying to make it so between each breadcumb there's a line but currently I can only show a line for the last case in my condition (in this case, between 3 and 4, when it should look something like:
1 - 2 - 3- 4
while currently I have:
1 2 3 - 4
Have a look at my image to know what I'm talking about:
My code is as follows:
const [ steps, setSteps ] = useState([ { title:'Detalles' }, { title:'Horario' }, { title:'Fotos' }, { title:'Menu' } ]);
<View style={{ width:'100%', backgroundColor:'white',flexDirection:'row', alignItems:'center', justifyContent:'space-around', position:'relative' }}>
{steps.map((step,index) => {return (
<>
<TouchableOpacity onPress={ ()=>{ onStepPressed(index+1) } } style={{ width:30,height:30,borderRadius:30/2, ...venueStore.currentStep == index+1 ? { backgroundColor:'rgb(3,91,150)' } : { backgroundColor:'rgb(150,150,150)' }, alignItems:'center',justifyContent:'center' }}>
<Text style={{ fontSize:14, color:'white' }}>{index+1}</Text>
</TouchableOpacity>
{ index == 0 || index == 1 || index == 2 && (<View style={{ width:45,height:2,backgroundColor:'rgb(68,68,68)' }}></View>)}
</>
)})}
</View>
Any idea how I can achieve my desired result
question from:
https://stackoverflow.com/questions/65891589/react-native-issue-when-rendering-with-map-and-index 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…