Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-native-input-select

Package Overview
Dependencies
Maintainers
1
Versions
67
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-input-select

A customizable dropdown selection package for react-native for android and iOS with multiple select and search capabilities.

  • 0.29.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.6K
decreased by-20.59%
Maintainers
1
Weekly downloads
 
Created
Source

CodeQL

react-native-input-select

A fully customizable dropdown selection package for react-native android and iOS with multiple select and search capabilities.

Installation

With npm

npm install react-native-input-select

With yarn

yarn add react-native-input-select

Basic Usage

import React from 'react';
import Dropdown from 'react-native-input-select';

export default function App() {
  const [country, setCountry] = React.useState();

  return (
    <Dropdown
      label="Country"
      placeholder="Select an option..."
      options={[
        { name: 'Albania', code: 'AL' },
        { name: 'Åland Islands', code: 'AX' },
        { name: 'Algeria', code: 'DZ' },
        { name: 'American Samoa', code: 'AS' },
        { name: 'Andorra', code: 'AD' },
        { name: 'Angola', code: 'AO' },
        { name: 'Anguilla', code: 'AI' },
        { name: 'Antarctica', code: 'AQ' },
        { name: 'Antigua and Barbuda', code: 'AG' },
      ]}
      optionLabel={'name'}
      optionValue={'code'}
      selectedValue={country}
      onValueChange={(value) => setCountry(value)}
      primaryColor={'green'}
    />
  );
}

Advanced Usage

import React from 'react';
import Dropdown from 'react-native-input-select';

export default function App() {
  const [country, setCountry] = React.useState();

  return (
    <Dropdown
      label="Customized components in list"
      placeholder="Select multiple options..."
      options={countries.slice(0, 3)}
      optionLabel={'name'}
      optionValue={'code'}
      selectedValue={country}
      onValueChange={(itemValue: any) => setCountry(itemValue)}
      isMultiple
      primaryColor={'orange'}
      dropdownStyle={{
        borderWidth: 0, // To remove border, set borderWidth to 0
      }}
      placeholderStyle={{
        color: 'purple',
        fontSize: 15,
        fontWeight: '500',
      }}
      labelStyle={{ color: 'teal', fontSize: 15, fontWeight: '500' }}
      dropdownHelperTextStyle={{
        color: 'green',
        fontWeight: '900',
      }}
      modalBackgroundStyle={{
        backgroundColor: 'rgba(196, 198, 246, 0.5)',
      }}
      helperText="The placeholder has been styled"
      checkboxSize={20}
      checkboxStyle={{
        backgroundColor: 'purple',
        borderRadius: 30, // To get a circle - add the checkboxSize and the padding size
        padding: 10,
      }}
      checkboxLabelStyle={{ color: 'red', fontSize: 30 }}
      listHeaderComponent={
        <View style={styles.customComponentContainer}>
          <Text style={styles.text}>
            💡 You can add any component to the top of this list
          </Text>
          <View style={styles.fixToText}>
            <Button
              title="Left button"
              onPress={() => Alert.alert('Left button pressed')}
              color="#007AFF"
            />
            <Button
              title="Right button"
              onPress={() => Alert.alert('Right button pressed')}
            />
          </View>
        </View>
      }
      listFooterComponent={
        <View style={styles.customComponentContainer}>
          <Text>You can add any component to the bottom of this list</Text>
        </View>
      }
    />
  );
}

For more examples visit our wiki page

iOS

Screenshot 2023-04-18 at 10 06 15 AMScreenshot 2023-03-23 at 5 00 19 PMScreenshot 2023-03-23 at 5 00 29 PM
Screenshot 2023-03-23 at 5 00 35 PMScreenshot 2023-03-23 at 5 11 54 PMScreenshot 2023-04-06 at 5 26 46 PM

Android

Screenshot 2023-03-23 at 5 25 07 PMScreenshot 2023-03-23 at 5 26 58 PMScreenshot 2023-03-23 at 5 28 49 PM

Props

ProptypesDatatypeExample
labelstringCountries
placeholderstringSelect a country
optionsArray[{ name: 'Albania', code: 'AL' }, { name: 'Åland Islands', code: 'AX' }]
optionLabelstringname
optionValuestringcode
errorstringThis is a required field
helperTextstringOnly few countries are listed
selectedValuestring or ArrayAL or [AL, AX]
onValueChangefunction()=>{}
isMultipleBooleantrue
isSearchableBooleantrue
disabledBooleantrue
labelStyleObject{color: 'red', fontSize: 15, fontWeight: '500'}
placeholderStyleObject{color: 'blue', fontSize: 15, fontWeight: '500'}
dropdownStyleObject{borderColor: 'blue', margin: 5, borderWidth:0 ...}
dropdownContainerStyleObject{backgroundColor: 'red', width: '30%', ...}
searchInputStyleObject{backgroundColor: 'red', borderRadius: 0, ...}
selectedItemStyleObject{fontWeight: '600', color: 'yellow', ...}
multipleSelectedItemStyleObject{backgroundColor: 'red', color: 'yellow', ...}
modalBackgroundStyleObject{backgroundColor: 'rgba(196, 198, 246, 0.5)'}
modalOptionsContainerObject{padding: 5}
dropdownErrorStyleObject{borderWidth: 2, borderStyle: 'solid'}
dropdownErrorTextStyleObject{color: 'red', fontWeight:'500'}
dropdownHelperTextStyleObject{color: 'green', fontWeight:'500'}
primaryColorstringblue
checkboxSizenumber20
checkboxStyleObject{backgroundColor: 'blue', borderRadius: 30, padding: 10}
checkboxLabelStyleObject{color: 'red', fontWeight:'500'}
listHeaderComponentReact Component<Text> You can add any component to the top of this list <Text>
listFooterComponentReact Component<Text> You can add any component to the bottom of this list <Text>

Contributing

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

License

MIT

Video Demo

https://user-images.githubusercontent.com/9849221/232344214-55fa5557-cfdd-42c4-a334-f93c15341b0b.mov

Keywords

FAQs

Package last updated on 20 Apr 2023

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc