0.0.2 • Published 4 years ago

react-native-select-input-as-modal v0.0.2

Weekly downloads
4
License
MIT
Repository
github
Last release
4 years ago

react-native-select-input-as-modal

React Native Select Input

Installation

npm install react-native-select-input-as-modal
yarn add react-native-select-input-as-modal

Usage

import ModalSelectInput from 'react-native-select-input-as-modal';

// ...
const data = [
    {
      value: '1',
      title: 'One',
    },
    {
      value: '2',
      title: 'Two',
    },
];
// ...

<ModalSelectInput
    data={data}
    isVisible={visibleSelect}
    onClose={() => {/* close modal */}}
    label="Select Your data"
    selected={selected}
    onSelect={setSelected}
    returnObject={true}
/>

List of props

NameTypeDefaultDesc
dataArrayRequireArray of objects
isVisibleBooleanRequireTo show select modal modal
onCloseFunctionnullTrigger when modal closed by user gesture
backgroundColorString#fffbackground color of modal
labelStringLabel of opened modal
itemTextStringtitleThe key of data items to user
itemValueStringvalueThe value of select box when user select an item
returnObjectBooleanfalseTo return whole object when user select it
renderItemFunctionA function that render select item from the parent
selectedObjectSelected value of modal
onSelectFunctionWhen user select an item this callback triggered, it's return whole object when returnObject is true else it's return objectitemValue

cooming soon

list of methods some props for custom view like wrapper style, renderHeader

Run example

cd example
yarn android

Contributing

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

License

MIT