0.3.3 • Published 4 months ago

rn-multipicker v0.3.3

Weekly downloads
-
License
MIT
Repository
github
Last release
4 months ago

rn-multipicker

This package will provide features to select and search multiple dropdown items gracefully

RNMultiSelect

rn-multipicker-v0 3 2-demo1-ezgif com-video-to-gif-converter

RNMultiSelect.Sectioned

sectioned-rn-multipicker-v0 3 2-demo1-ezgif com-video-to-gif-converter

Please refer for full documentation.

Installation

npm install rn-multipicker

or

yarn add rn-multipicker

Usage

import { RNMultiSelect } from 'rn-multipicker';
import { COUNTRIES, SECTIONED_COUNTRIES } from './constants';

// ...

const App() {
  const [selectedItems, setSelectedItems] = useState<string[]>([]);

  return (
    <View style={{flex: 1}}>
      <RNMultiSelect
        placeholder="Countries"
        data={COUNTRIES}
        onSelectedItemsChange={(value) => setSelectedItems(value)}
        selectedItems={selectedItems}
      />
      <View style={{ height: 22 }} />
      <RNMultiSelect.Sectioned
        placeholder="Sectioned Countries"
        data={SECTIONED_COUNTRIES}
        onSelectedItemsChange={(val) => setSelectedItems2(val)}
        selectedItems={selectedItems2}
      />
    </View>
  );
}

RNMultiSelect API

Properties

PropTypeDescription
placeholderstringPlaceholder text displayed in the multi-select input field.
datastring[]Array of strings representing selectable items.
onSelectedItemsChange(selectedItems: string[]) => voidCallback triggered when selected items change.
selectedItemsstring[]Array of strings representing currently selected items.
styles (deprecated)StyleProp<ViewStyle>Deprecated: Use inputStyle instead.
renderCheckedItem(value: string, i: number) => JSX.ElementCustom renderer for checked items.
renderCheckBox(value: string, active: boolean, onCheck: (item: string) => void) => JSX.ElementCustom renderer for checkboxes.
searchBarStyleStyleProp<TextStyle>Styling for the search bar.
clearButtonStyleStyleProp<ViewStyle>Styling for the clear button.
saveButtonStyleStyleProp<ViewStyle>Styling for the save button.
renderClearButton(onClearAll: () => void, disabled: boolean) => JSX.ElementCustom renderer for the clear button.
renderSaveButton(onApply: () => void, disabled: boolean) => JSX.ElementCustom renderer for the save button.
modalTitleStyleStyleProp<TextStyle>Styling for the picker modal title.
searchBarPlaceholderstringPlaceholder text for the search bar.
inputStyleStyleProp<ViewStyle>Styling for the input field.
maxCheckedItemsVisiblenumberMaximum number of checked items visible in the selection.
renderViewMoreButton(showAll: () => void, remainingCount: number) => JSX.ElementCustom renderer for "View More" button.
renderViewLessButton(showLess: () => void) => JSX.ElementCustom renderer for "View Less" button.
checkedItemsColorstringChange the background color of the checked items visible on the input box.
checkedItemsContentColorstringChange the color of the title and cross icon on the checked items visible on the input box.
onSearchTextChange(searchText: string, setLoader: (value: boolean) => void) => voidCallback function triggered when user enters search value.
onEndReached(iteration: number, setLoader: (value: boolean) => void) => voidCallback function triggered when user scrolls to the last item in the not selected list. This can be used to make dynamic fetch calls by pages.

RNMultiSelect.Sectioned API

Can be used to display Multiple items with Section headers

Properties

PropTypeDescription
dataSectionedMultiSelectData[]Array of data representing sectioned items in the multi-picker.
selectedItemsSectionedSelectedItems[]Array of selected items with section information.
onSelectedItemsChange(selectedItems: SectionedSelectedItems[]) => voidCallback triggered when selected items change.
renderCheckedItem(value: SectionedSelectedItems, onRemove: () => void, i: number) => JSX.ElementCustom renderer for checked items in the picker.
renderCheckBox(value: SectionedSelectedItems, active: boolean, onCheck: (item: SectionedSelectedItems) => void) => JSX.ElementCustom renderer for checkboxes in the picker.
placeholderstringPlaceholder text displayed in the multi-select input field.
styles (deprecated)StyleProp<ViewStyle>Deprecated: Use inputStyle instead.
searchBarStyleStyleProp<TextStyle>Styling for the search bar.
clearButtonStyleStyleProp<ViewStyle>Styling for the clear button.
saveButtonStyleStyleProp<ViewStyle>Styling for the save button.
renderClearButton(onClearAll: () => void, disabled: boolean) => JSX.ElementCustom renderer for the clear button.
renderSaveButton(onApply: () => void, disabled: boolean) => JSX.ElementCustom renderer for the save button.
modalTitleStyleStyleProp<TextStyle>Styling for the picker modal title.
searchBarPlaceholderstringPlaceholder text for the search bar.
inputStyleStyleProp<ViewStyle>Styling for the input field.
maxCheckedItemsVisiblenumberMaximum number of checked items visible in the selection.
renderViewMoreButton(showAll: () => void, remainingCount: number) => JSX.ElementCustom renderer for "View More" button.
renderViewLessButton(showLess: () => void) => JSX.ElementCustom renderer for "View Less" button.
checkedItemsColorstringChange the color of the checked items visible on the input box.
checkedItemsContentColorstringChange the color of the title and cross icon on the checked items visible on the input box.
renderSelectedSectionHeaderstringCustom renderer for Section title headers in the Selected item.
renderNotSelectedSectionHeaderstringCustom renderer for Section title headers in the Not Selected items.
onSearchTextChange(searchText: string, setLoader: (value: boolean) => void) => voidCallback function triggered when user enters search value.
onEndReached(iteration: number, setLoader: (value: boolean) => void) => voidCallback function triggered when user scrolls to the last item in the not selected list. This can be used to make dynamic fetch calls by pages.

Contributing

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

Feel free to dive in! Open an issue or submit PRs.

License

MIT


0.3.2

4 months ago

0.3.3

4 months ago

0.3.1

4 months ago

0.3.0

4 months ago

0.2.4

4 months ago

0.2.2

4 months ago

0.2.1

4 months ago

0.2.0

4 months ago