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-autocomplete-tags

v2.0.0

Published

Autocomplete text input with tags

Downloads

1,045

Readme

react-native-autocomplete-tags

A quick and easy solutions for projects that need an input with both autocomplete and tags

Features

  • custom tag and suggestions components
  • separate extractors for tags and for suggestions
  • easy to integrate and use
  • configurable

What's new in version 2?

  • no more mandatory controlled TextInput (although you still can if you want)
  • TypeScript support!
  • no more tag/suggestion styles - if you need custom styles, use renderTag or renderSuggestion instead

Installation

yarn add react-native-autocomplete-tags

or

npm install react-native-autocomplete-tags --save

Dependency

Requires RN >= 0.63 If using RN < 0.63, use v1 instead.

Useage

Also see the demo projects

const suggestions = ['apple', 'orange', 'banana', 'kiwi'];

const SimpleExample = () => {
  const [tags, setTags] = useState<string[]>([]);

  const labelExtractor = (tag: string) => tag;

  return (
    <AutocompleteTags
      tags={tags}
      suggestions={suggestions}
      onChangeTags={setTags}
      labelExtractor={labelExtractor}
    />
  );
};

export default SimpleExample;

Props

| Prop | type | Description | required | default | |---------------------------|---------------------------------------------------------------------------|---------------------------------------------------------------------------------------|----------|----------------------------------------------------------| | tags | Tag[] | The current tags to be rendered | yes | | | labelExtractor | (tag: Tag) => string | Determines what property of tags is displayed | yes | | | onChangeTags | (newTags: Tag[]) => void | called when tags change (i.e. by deleting), should be used to set tags | yes | | | suggestions | Suggestion[] | All possible suggestions | no | [] | | suggestionExtractor | (suggestion: Suggestion) => string | determines which property of suggestions is displayed | no | uses labelExtractor | | onSuggestionPress | (suggestion: Suggestion) => void | called when suggestion is pressed | no | calls onChangeTags with [...tags, pressedSuggestion] | | onTagPress | (tag: Tag) => void | called when tag is pressed | no | calls onChangeTags with the pressed tag removed | | renderSuggestion | (suggestion: Suggestion, onPress: (tag: Suggestion) => void) => Element | renders a custom suggestion component | no | | | renderTag | (tag: Tag, onPress: (tag: Tag) => void) => Element | renders a custom tag component | no | | | filterSuggestions | (text: string) => Suggestion[] | filters suggestions based on users text input | no | | | inputProps | TextInput props | any additional props for TextInput | no | | | flatListProps | FlatList props | any additional props for FlatList | no | | | allowCustomTags | boolean | whether or not to allow the user to create a Tag that doesn't come from suggestions | no | true | | parseChars | string[] | an array of characters that should trigger a new tag and clear the TextInput | no | [',', ' ', ';', '\n'] | | onAddNewTag | (userInput: string) => void | called when the user types a character in parseChars | no | calls onChangeTags with [...tags, userInputText] |

Style Props

No style props are required.

| Prop | Description | |-------------------------|-------------------------------------------------------------------------------------| | containerStyle | style for the outer-most View that houses both the tagContainer and suggestion list | | tagContainerStyle | Container for the tags and the TextInput | | inputStyle | Applied to the TextInput directly | | flatListStyle | Applied to the FlatList which renders suggestions |

Contributing

PRs and issues welcome!