0.1.5 • Published 1 year ago

react-native-tags-selector v0.1.5

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

react-native-tags-selector

A ReactNative tag selector that supports single-line sliding, multi-line display, and single-select.

Preview

Gif

Installation

npm install react-native-tags-selector

or

yarn add react-native-tags-selector

Usage

Basic usage

Example

import TagsSelector from 'react-native-tags-selector';

// ...

const dataSource = [
  { id: '1', name: 'Tag1', image: require('../assets/tip_warn.png') },
  { id: '2', name: 'Tag2', image: require('../assets/tip_warn.png') },
  { id: '3', name: 'Tag3', image: require('../assets/tip_warn.png') },
  { id: '4', name: 'Tag4', image: require('../assets/tip_warn.png') },
  { id: '5', name: 'Tag5', image: require('../assets/tip_warn.png') },
  { id: '6', name: 'Tag6', image: require('../assets/tip_warn.png') },
  { id: '7', name: 'Tag7', image: require('../assets/tip_warn.png') },
  { id: '8', name: 'Tag8', image: require('../assets/tip_warn.png') },
];

<TagsSelector
  selectedId={'1'}
  multiLine={false}
  dataSource={dataSource}
/>

Advanced usage

Supports customizing the following attributes

PropNametypeDescriptionDefault
selectedIdstringID is selected by default
multiLinebooleanWhether to display multiple linesfalse
dataSourceDataModel[]Data source used to display tags
onCheckedfunctionCallback when tag is selected
textStyleTextStyleSet the style of tag text
chipStyleViewStyleSet the style of a single tag
selectedTextColorstringSet selected text color#5B00FF
unselectedTextColorstringSet unselected text color#5B00FF
selectedBorderstringSet selected border color#5B00FF
unselectedBorderstringSet unselected border color#E5E7E9
selectedBackgroundColorstringSet selected background color#FFFFFF
unselectedBackgroundColorstringSet unselected background color#F9F9F9
showMoreIconImageSourcePropTypeSet show more icon
showLessIconImageSourcePropTypeSet show less icon
showMoreStyleViewStyleSet the style of show more

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT


Made with create-react-native-library

0.1.1

2 years ago

0.1.5

1 year ago

0.1.0

2 years ago

1.0.0

2 years ago