What I want is that all the cards that come out I want to change the background color, but when I press another card the color of the other one is removed.
constructor(props){
super(props);
this.state={
presente:'#fff',
ausente:'',
id:''
};
}
cambiarEstilos(id, ausente){
this.setState({ausente:ausente})
this.setState({id:id})
}
render(){
return(
<View>
{ contenidosCartas[0].Cartas.Datos.map(
(item, key)=>{
return(
<TouchableNativeFeedback key={item.Id} onPress={()=>this.cambiarEstilos(item.Id, item.Ausente)}>
<View style={[estilos.cardUser,{backgroundColor:this.state.id==item.Id?item.Ausente:null}]} key={item.Id} >
<Thumbnail square source={{uri: item.Foto}} style={estilos.iconUsers} resizeMode="contain"/>
<Body style={{alignItems:'flex-start',paddingLeft:dimenciones.width/50}}>
<Text style={estilos.txtTituloUser}>{item.Nombre} </Text>
<Text style={estilos.txtInfoUser}>{item.Matricula}</Text>
</Body>
</View>
</TouchableNativeFeedback>
) }
)}
)
}
</View>