: , , ? , "VIP", "", , "" ( ), . :
const seatMap = [
[2,2,2,2,2,2,2,1,1,1,1,1,2,2,2,2,2,2,2],
[2,2,2,2,2,2,1,1,1,1,1,1,1,1,1,2,2,2],
...,
[3,3,3,3,3,4,3,3,3,3,3,3,3,3,3,4,3,3,3,3,3],
[3,3,3,3,3,2,3,3,3,3,3,3,3,3,2,3,3,3,3,3],
[3,3,3,3,3,2,3,3,3,3,3,3,3,3,3,2,3,3,3,3,3]
]
render(){
return (
<View>
{
seatMap.map(
(row,rowIndex) => <View>
{
row.map(
(type,colIndex)=><SeatBlock
type={ type }
row={ rowIndex }
col={ colIndex }/>
)
}
</View>
)
}
</View>
)
}
pay attention to type 4, itโs not really a โseat typeโ, itโs a gap, we make it like a gap instead of a seat, and you can define 5 or 6 for a larger or smaller gap. Flexibility.
You can check the full code below.
<div data-snack-id="rJnoL_Xn-" data-snack-platform="ios" data-snack-preview="true" data-snack-theme="dark" style="overflow:hidden;background:#212733;border:1px solid rgba(0,0,0,.16);border-radius:4px;height:505px;width:100%"></div>
<script async src="https://snack.expo.io/embed.js"></script>
Run codeHide result