1.0.6 • Published 4 years ago

rn-glt-listview v1.0.6

Weekly downloads
8
License
MIT
Repository
-
Last release
4 years ago

rn-glt-listview

A listview component for ReactJS

NPM JavaScript Style Guide

npm install --save rn-glt-listview
or
yarn add rn-glt-listview

Usage

import ListView from 'rn-glt-listview';



// mock list data
const list = [
  {
    color: "red",
    value: "#f00"
  },
  {
    color: "green",
    value: "#0f0"
  },
  {
    color: "blue",
    value: "#00f"
  },
  {
    color: "cyan",
    value: "#0ff"
  },
  {
    color: "magenta",
    value: "#f0f"
  },
  {
    color: "yellow",
    value: "#ff0"
  },
  {
    color: "black",
    value: "#000"
  }
]

export default class App extends Component {
  state = {
    hasMore: true,
    list: [],
  };


  _renderItem = ({ item }) => {
        return(
            <View style={[styles.listContainer]}>
                <View style={[styles.colorRound, {backgroundColor: item.color}]}></View>
                <View style={styles.titleContainer}>
                          <Text>{item.color}</Text>
                  <Text>{item.value}</Text>
                </View>
            </View>
        )
    }

  render() {
    const { list } = this.state;

    return (
      <ListView data={list} renderItemFun={this._renderItem}></ListView>
    );
  }
}
const styles = StyleSheet.create({
    container: {
        flex: 1,
    },
	listContainer:{
		flex: 1,
		flexDirection: 'row',
		marginBottom: 10,
		alignItems: 'center',
		height: wp(14),
		paddingHorizontal: wp(4),
		backgroundColor: '#FFF',
		shadowColor: "#000",
		shadowOffset: {
			width: 0,
			height: 1,
		},
		shadowOpacity: 0.20,
		shadowRadius: 1.41,

		elevation: 2
	},
	colorRound:{
		width: wp(12),
		height: wp(12),
		borderRadius: 100,
		marginEnd: 15
	},
	titleContainer:{
		width: wp(84),
		height: wp(12),
		justifyContent: 'center'
	}
});

API

Props

PropTypeOptionalDefaultDescription
contentContainerStyleobjectYesStyle of flatlist container.
itemContainerStyleobjectYesStyle of item. Invalid in wrapper mode.
textStyleobjectYesStyle of text of item.
dropdownTextStyleobjectYesStyle of the dropdown option text.
dropdownTextHighlightStyleobjectYesStyle of the dropdown selected option text.
renderItemFunfuncYesCustomize render option rows: function() Will render a default row if undefined.
showsVerticalScrollIndicatorboolYesfalseDefault false if you want to enable scroll do it true.

Example

With custome render

Default Render

License

MIT © gtl_parth

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago