Closed axelclark closed 6 years ago
const Train = ({ train }) => (
<View style={styles.container}>
<Text style={styles.text}>{train.Name}</Text>
<Text style={styles.text}>Destination: {train.DestinationName}</Text>
<Text style={styles.text}>Arrival in {train.Min} minutes</Text>
</View>
)
const TrainList = ({ trains }) => {
if(trains !== []) {
const renderTrains = trains.map(train =>
(<Train
key={`${train.DestinationCode}-${train.Min}`}
train={train}
/>))
return (
<View>
{renderTrains}
</View>
)
} else {
return (
<View style={styles.container}>
<Text style={styles.text}>No trains are currently scheduled</Text>
</View>
)
}
}
When no trains are scheduled, the app renders a blank area. The app should provide a message like "No trains scheduled".