flexWrap 속성을 이용해서 한 줄에 두개씩 View를 보여주고 가운데 구분선 넣기
import React, { Component } from 'react';
import { TouchableOpacity, SectionList, StyleSheet, Text, View } from 'react-native';
export default class App extends Component {
render() {
const data = [
{name: 'ios-car', text: '자동차이름'},
{name: 'cat', text: '고양이'},
{name: 'cat', text: '고양이'},
{name: 'cat', text: '고양이'},
{name: 'cat', text: '고양이'},
{name: 'cat', text: '고양이'},
{name: 'cat', text: '고양이'},
]
const items = data.map( (x)=>{
return (
<View style={{height: 50, width:'50%', borderColor:'green',borderWidth:3, alignItems:'center'}}>
<Text>{x.text}</Text>
</View>
);
});
return (
<View style={{flex: 1,justifyContent:'center', alignItems:'stretch'}}>
<View style={[styles.bd, {flexDirection: 'row', flexWrap:'wrap'}]}>
{items}
<View style={{
position:'absolute',
width:10, height:'90%',
left:'50%', backgroundColor:'blue'}}></View>
</View>
</View>
);
}
}
const styles = StyleSheet.create({
bd : {
borderColor: 'red',
borderWidth:3
},
container: {
flex: 1,
paddingTop: 22
},
sectionHeader: {
paddingTop: 2,
paddingLeft: 10,
paddingRight: 10,
paddingBottom: 2,
fontSize: 14,
fontWeight: 'bold',
backgroundColor: 'rgba(247,247,247,1.0)',
},
item: {
padding: 10,
fontSize: 18,
height: 44,
},
})