1.0.2 • Published 4 years ago

rn-tagscroll v1.0.2

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

Installation

npm install --save rn-tagscroll

Usage

Example

import React, { Component } from 'react'
import RNTagScroll from 'rn-tagscroll'

export default Example extends Component {
  constructor(props) {
    super(props)

    this.state = {
      list: [{
        id: 0,
        name: 'All'
      }, {
        id: 1,
        name: 'Lorem'
      }, {
        id: 2,
        name: 'Ipsum'
      }, {
        id: 3,
        name: 'Dolor'
      }, {
        id: 4,
        name: 'Sit'
      }, {
        id: 5,
        name: 'Amet'
      }],
    
      selected: {
        id: 0,
        name: 'All'
      }
    }
  }

  onSelect = (selected) => {
    this.setState({ selected })
  }

  render() {
    const { list, selected } = this.state

    return (
      <RNTagScroll
        showScroll={true}
        list={list}
        selected={selected}
        showEmptyState={false}
        onItemPress={this.onSelect.bind(this)}
      />
    )
  }
}
PropDescriptionDefault
contentContainerStyleStyle for container tag scrolldefault styles
showEmptyStateRender empty state if no listfalse
emptyStateStyleStyle for empty statedefault styles
emptyTextLabel text for empty stateNo Data Available
emptyTextStyleStyle for empty label textdefault styles
showScrollShow scroll indicatortrue
listData list (Array of Object width key id and name)null
selectedSelected item list (Object)null
onItemPressWhen item list pressedundefined
itemWrapperStyleStyle for item list wrapperdefault styles
selectedItemWrapperStyleStyle for selected item list wrapperdefault styles
itemTextStyleStyle for item text/labeldefault styles
selectedItemTextStyleStyle for selected item text/labeldefault styles