1.0.9 • Published 5 years ago

@vivintsolar-oss/native-vs-list v1.0.9

Weekly downloads
-
License
MIT
Repository
github
Last release
5 years ago

@vivintsolar-oss/native-vs-list

yarn add @vivintsolar-oss/native-vs-list
// or
// npm install @vivintsolar-oss/native-vs-list

VSList

A flexible list component

Demo

import { List, ListItem } from '@vivintsolar-oss/native-vs-list';

<List>
  <ListItem
    label="Yoda"
    itemStyle={styles.itemStyle}
    rightIconStyle={styles.icon}
    rightIcon={() => {
      return <RightChevron color={'green'} />;
    }}
    onPress={() => {
      return Alert.alert('Press you did');
    }}
  />
  <ListItem
    label="Vader"
    itemStyle={styles.itemStyle}
    leftIconStyle={styles.icon}
    labelTextStyle={styles.center}
    leftIcon={() => {
      return <LeftChevron color={'red'} />;
    }}
    rightIcon={null}
  />
  <ListItem
    label="Worst Character"
    renderLabel={() => {
      return <Text>Jar Jar</Text>;
    }}
    itemStyle={styles.rightPadding}
    rightIconStyle={styles.icon}
    rightIcon={null}
    onPress={() => {
      return Alert.alert('💩');
    }}
  />
</List>

Props

NameDefaultTypeDescription
labelstringText used within the list item
itemHeight48numberHeight of list item
itemStyleobjectCustom style passed to list item
labelTextStyleobjectCustom style passed to label text
leftIconStyleobjectCustom style passed to left icon
rightIconStyleobjectCustom style passed to right icon
containerStyleobjectCustom style passed to list
bgColorstringBackground color of list
leftIconnullfuncRender prop
rightIcon() => <RightChevron />funcRender prop
renderLabelnullfuncRender prop
onPressfuncEvent that's fired when list item is pressed. If none is passed then list item will not be Touchable