TIL: RN | React Native FlatList 2줄 출력 (numColumns={2}) 일 경우 일정한 간격으로 출력

Lumpen·2023년 5월 22일
0

ReactNative

목록 보기
21/42
 <FlatList
        columnWrapperStyle={{ justifyContent: 'space-between' }}
        style={{ flex: 1 }}
        data={data}
        renderItem={({ item }) => (
  			<View style={{ width: '47%' }} />
  		)}
   		ItemSeparatorComponent={() => <View style={{ height: 10 }} />}
        contentContainerStyle={{ padding: 20 }}
        numColumns={2}
      />

numColumns 가 2 이상인 경우
columnWrapperStyle 을 between 으로 주고

renderItem 의 width 를 조절하여 간격을 맞춰준다

profile
떠돌이 생활을 하는. 실업자는 아니지만, 부랑 생활을 하는

0개의 댓글