Giter Site home page Giter Site logo

eriveltonelias / react-native-multiple-tags Goto Github PK

View Code? Open in Web Editor NEW

This project forked from tolucaleb/react-native-multiple-tags

0.0 2.0 0.0 1.07 MB

Multiple Select inform of Tags with search bar for react native

License: MIT License

JavaScript 100.00%

react-native-multiple-tags's Introduction

react-native-multiple-tags

Multiple Select using Tags

Demo

Installation

npm i -S react-native-multiple-tags

Usage

import React, { Component } from 'react';
import {
        View,
        StatusBar,
        ScrollView,
        Text,
} from 'react-native';
import MultipleTags from 'react-native-multiple-tags';

const styles = {
  body: {
    flex: 1,
    backgroundColor: '#fff',
    paddingTop: 80,
    padding: 10,
  },
};

const {
  body,
 } = styles;

const tags = [
  'cherry',
  'mango',
  'cashew',
  'almond',
  'guava',
  'pineapple',
  'orange',
  'pear',
  'date',
  'strawberry',
  'pawpaw',
  'banana',
  'apple',
  'grape',
  'lemon',
];


class WelcomeComponent extends Component {
  constructor(props) {
    super(props);
    this.state = {
      content: [],
    };
  }

  render() {
    return (

      <View style={body}>
        <StatusBar
          translucent
          backgroundColor="rgba(0,0,0,0.1)"
          barStyle="light-content"
        />
        <ScrollView>
          <View style={{ flex: 1 }}>
            <MultipleTags
              tags={tags}
              search
              onChangeItem={(content) => { this.setState({ content }); }}
              title="Fruits"
            />
            {
            (() => {
              const textComponents = this.state.content.map(item => <Text> {item} </Text>);
              return textComponents;
            })()
        }
          </View>
        </ScrollView>
      </View>


    );
  }
}

export default WelcomeComponent;     

Props

Prop Required Purpose
tags Yes List of tags/items to display for selection. tags must be plain array in javascript check example above.
search No set search to false to hide the search bar
onChangeItem Yes JavaScript function passed in as an argument. This function is called whenever items are added or removed in the component
title No The Name or Category of tags
selectCompletedMessage No Text to display when search query hits nothing
defaultMessage No First Message to instruct what to do,
sizeIconTag No Size Icon of add (plus) item,
showIconAdd No Set false if you want hide the Add Icon,
labelActiveTag No custom style for active tag label,
tagActiveStyle No custom style for active tag,

Note

Use this component inside a scrollview for it to maintain its auto height.

Todo

  • Supports array of objects.

PR's are welcome

react-native-multiple-tags's People

Contributors

eriveltonelias avatar tolucaleb avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.