A Customizable React Native Select
npm install react-native-sselect
--- or ---
yarn add react-native-sselect
Currently you have to wrap your form with SelectProvider
this will handle to toggle selects when you have more than one.
import { Select, SelectProvider } from 'react-native-sselect';
export default function App() {
return (
<View style={styles.container}>
<SelectProvider>
<Select
name="sample"
options={[
{ label: "Option 1", value: "option1" },
{ label: "Option 2", value: "option2" },
]} />
</SelectProvider>
</View>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: "#fff",
alignItems: "center",
justifyContent: "center",
},
});
Name | Type | Required |
---|---|---|
name | string | yes |
options | {name: string; value: string }[] | yes |
onChange | ({name: string; value: string }) ⇒ void | yes |
defaultValue | {name: string; value: string } | |
selectedValue | {name: string; value: string } | |
optionsPlaceholder | string | |
optionsHeight | number | |
color | string | |
backgroundColor | string | |
placeholder | string | |
selectedOptionContainerStyle | style | |
optionsContainerStyle | ||
optionsStyle |
See the contributing guide to learn how to contribute to the repository and the development workflow.
MIT
Made with create-react-native-library