Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
react-native-autocomplete-tags
Advanced tools
Readme
A quick and easy solutions for projects that need an input with both autocomplete and tags
renderTag
or renderSuggestion
insteadyarn add react-native-autocomplete-tags
or
npm install react-native-autocomplete-tags --save
Requires RN >= 0.63 If using RN < 0.63, use v1 instead.
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;
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] |
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 |
PRs and issues welcome!
FAQs
Autocomplete text input with tags
The npm package react-native-autocomplete-tags receives a total of 119 weekly downloads. As such, react-native-autocomplete-tags popularity was classified as not popular.
We found that react-native-autocomplete-tags demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.