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

react-native-dropdown-opensource

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-dropdown-opensource

a dropdown component for react native

  • 1.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

React Native Custom Dropdown

A customizable React Native dropdown component with optional styling options.

Installation

Install the package using npm or yarn:

npm i react-native-dropdown-opensource

Usage

import React, { useState } from 'react';
import CustomDropdown from 'react-native-dropdown-opensource';

const App = () => {
  const options = ['Option 1', 'Option 2', 'Option 3', 'Option 5'];
  const [selectedOption, setSelectedOption] = useState('Select an option');

  const handleSelect = (option) => {
    setSelectedOption(option);
  };

  return (
    <View>
      <Text>Selected Option: {selectedOption}</Text>

      <CustomDropdown
        options={options}
        onSelect={handleSelect}
        selectedOption={selectedOption}
        buttonStyle={{}}
        dropdownStyle={{}}
        textStyle={{ color: 'red' }}
        scroll
        itemsVisible={2}
      />
    </View>
  );
};

export default App;

Props

Required Props

  1. options: An array of options to be displayed in the dropdown.
  2. onSelect: A callback function triggered when an option is selected.
  3. selectedOption: The currently selected option.

Optional Props

  1. buttonStyle: Additional styles for the dropdown button.
  2. dropdownStyle: Additional styles for the dropdown container.
  3. textStyle: Additional styles for the text within the dropdown.
  4. scroll: Enable scrolling in the dropdown.
  5. itemsVisible: Number of items visible in the dropdown (if scrolling is enabled).

Example

<CustomDropdown
  options={['Option 1', 'Option 2', 'Option 3', 'Option 5']}
  onSelect={(option) => console.log(`Selected: ${option}`)}
  selectedOption={'Select an option'}
  buttonStyle={{ backgroundColor: 'blue' }}
  dropdownStyle={{ maxHeight: 150 }}
  textStyle={{ color: 'white' }}
  scroll
  itemsVisible={3}
/>

Keywords

FAQs

Package last updated on 12 Feb 2024

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