更新时间:2023-10-15 08:19:28
我在这里不太了解您的问题:只需删除代码的这一部分
I don't really understand your problem here: Just remove this part of your code
{
Object.keys(this.state.cars).map( (carId, index) => (
<TouchableOpacity key={index} onPress={() => this.setState({ selectedId: carId})}>
<Text>{`${carId}: ${JSON.stringify(this.state.cars[carId])}`}</Text>
</TouchableOpacity>
)
}
并替换为:
{
Object.keys(this.state.cars).map( (carId, index) => (
<Text style={{color: this.state.cars[carId].color}}>hi !</Text>
)
}