npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-native-input-tags

v0.1.5

Published

<!-- @format -->

Downloads

17

Readme

react-native-input-tags

Build Status npm npm version

This project is inspired by react-native-tags.

A React Native component that allows you to input text and formats the text into a tag when a space or comma is entered. Tapping on the tag will remove it.

Demo

Installation

npm install --save react-native-input-tags
yarn add react-native-input-tags

Usage

import { Button, StyleSheet, Text, TextInput, View } from 'react-native';
import InputTag, { useInputTag } from 'react-native-input-tags';

export default function App() {
  const inputTag = useInputTag();
  return (
    <View style={styles.container}>
      <Text style={styles.title}>#Tags:</Text>
      <View style={styles.separator} />
      <InputTag ref={inputTag} />
      <Button
        title="Submit"
        onPress={() => {
          console.log(inputTag.current?.getTags());
        }}
      />
    </View>
  );
}

useInputTag

Is ref object, useInputTag allows you to have access to inputTag values

const inputTag = useInputTag();

// get all tags inputed
inputTag.current?.getTags();

| values | Description | | ------- | ---------------------------------------- | | getTags | function return list of all tags inputed |

Render Props

renderTag

If you would like to add new functionality or modify the way that the tags are rendered then pass in a renderTag prop.

| PropName | Description | | -------- | ---------------------------------------------------- | | tag | the tag item { id:string , name:string } | | onPress | callback when the chip or tag is cliked for deleting | | onPress | callback when the chip or tag is cliked for pressing |

//custom render tag
<InputTag
  ref={inputTag}
  renderTag={({ tag, onPress, onDelete }) => {
    return (
      <Text style={{ margin: 10 }} onPress={onDelete}>
        {tag.name}
      </Text>
    );
  }}
/>

textInputComponent

If you would like to add new functionality or modify the way that the Textinput are rendered then pass in a textInputComponent prop.

| PropName | Description | | ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | value | the tag string value input | | onChangeText | Callback that is called when the text input's text changes. Changed text is passed as an argument to the callback handler. | | onKeyPress | Callback that is called when a key is pressed. This will be called with { nativeEvent: { key: keyValue } } where keyValue is 'Enter' or 'Backspace' for respective keys and the typed-in character otherwise including ' ' for space. |

Fires before onChange callbacks. Note: on Android only the inputs from soft keyboard are handled, not the hardware keyboard inputs. | | onSubmitEditing | Callback that is called when the text input's submit button is pressed. | | style | Text style |

import { TextInput } from 'react-native';
//custom text input
<InputTag
  ref={inputTag}
  textInputComponent={props => {
    return <TextInput placeholder="Tag ici..." {...props} />;
  }}
/>;

Props

| PropName | Description | Default | | ------------------ | ----------------------------------------------------------------------- | --------------- | | initialValue | The input element's text | | | initialTags | intial tags eg.[{id:"yuf", name:"reactjs"}] | [] | | createTagOnString | Triggers new tag creation | [",", ".", " "] | | handlerPressTag | function call when the tag is pressed function handlerPressTag(tag){} | undenfied | | textInputComponent | render TextInput | | | renderTag | Manage the rendering of your own Tag | |