npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

react-native-modal-dropdown-picker

v1.0.2

Published

A customizable React Native modal dropdown picker component that lets you easily display one or more dropdown pickers in a modal. You can configure linked dropdowns (where the options of the second picker depend on the first) or independent dropdowns with

Downloads

18

Readme

React-Native-Modal-Dropdown-Picker ✨

npm version npm downloads License: MIT

A customizable React Native modal dropdown picker component that lets you easily display one or more dropdown pickers inside a modal. Configure linked dropdowns (where the options of a second picker depend on the first) or independent dropdowns with a rich set of customization options. Perfect for building dynamic forms and interactive UIs!

Simple Example

Below are three demo examples demonstrating the Modal Dropdown Picker in action:

| Single Dropdown Example | Two Linked Dropdowns Example | Two Unlinked Dropdowns Example | | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | | Single Dropdown | Linked Dropdowns | Unlinked Dropdowns |

Features

  • Multiple Modes
    Use a single dropdown picker, two linked dropdowns (where the second's options depend on the first), or two independent dropdowns.

  • Linked Dropdowns
    Easily configure cascading options. For example, selecting a state in the first dropdown dynamically populates the cities in the second dropdown.

  • Customizable UI
    Comes with a set of default styles that can be overridden via props to match your app’s theme.

  • Smooth Animations
    Enjoy smooth open/close animations for a crisp, modern interface.

  • Strict Selection Handling
    In linked mode, prevent users from interacting with a dropdown until a selection has been made in the previous one.

  • Modal Isolation
    When the modal is active, tapping outside the modal does not dismiss it. This ensures that users stay focused on completing the required selections.

Installation

Install via npm:

npm install react-native-modal-dropdown-picker

Or using Yarn:

yarn add react-native-modal-dropdown-picker

How To Use

Below are demo examples of how to integrate and use the Modal Dropdown Picker component in your React Native project.

1. Single Dropdown Picker Example

This example demonstrates a modal with a single dropdown picker.

import React, { useState } from 'react';
import { View, Text, TouchableOpacity } from 'react-native';
import ModalDropdownPicker, { DropdownData } from 'react-native-modal-dropdown-picker';

const singleDropdownData: DropdownData[] = [
  {
    placeholder: 'Select Food',
    options: {
      'Food 1': ['food 1'],
      'Food 2': ['food 2'],
      'Food 3': ['food 3'],
    },
  },
];

const SingleDropdownExample: React.FC = () => {
  const [modalVisible, setModalVisible] = useState<boolean>(false);
  const [selectedValue, setSelectedValue] = useState<string>('');

  return (
    <View>
      <TouchableOpacity onPress={() => setModalVisible(true)}>
        <Text>Open Modal Dropdown Picker</Text>
      </TouchableOpacity>
      <Text>Selected: {selectedValue}</Text>
      <ModalDropdownPicker
        visible={modalVisible}
        onConfirm={(value: string) => {
          setSelectedValue(value);
          setModalVisible(false);
        }}
        onCancel={() => setModalVisible(false)}
        dropdownData={singleDropdownData}
        layoutDirection="horizontal"
      />
    </View>
  );
};

export default SingleDropdownExample;

2. Two Linked Dropdown Pickers Example

This example demonstrates a modal with two linked dropdowns.

The second dropdown’s options depend on the selection of the first.

import React, { useState } from 'react';
import { View, Text, TouchableOpacity } from 'react-native';
import ModalDropdownPicker, { DropdownData } from 'react-native-modal-dropdown-picker';

const linkedDropdownData: DropdownData[] = [
  {
    placeholder: 'Select Food',
    options: {
      'New York': ['New York'],
      California: ['California'],
      Texas: ['Texas'],
    },
  },
  {
    placeholder: 'Select City',
    options: {
      'New York': ['New York City', 'Buffalo', 'Rochester'],
      California: ['Los Angeles', 'San Francisco', 'San Diego'],
      Texas: ['Houston', 'Dallas', 'Austin'],
    },
  },
];

const LinkedDropdownExample: React.FC = () => {
  const [modalVisible, setModalVisible] = useState<boolean>(false);
  const [selectedValue, setSelectedValue] = useState<string>('');

  return (
    <View>
      <TouchableOpacity onPress={() => setModalVisible(true)}>
        <Text>Open Linked Dropdown Picker</Text>
      </TouchableOpacity>
      <Text>Selected: {selectedValue}</Text>
      <ModalDropdownPicker
        visible={modalVisible}
        onConfirm={(value: string) => {
          setSelectedValue(value);
          setModalVisible(false);
        }}
        onCancel={() => setModalVisible(false)}
        dropdownData={linkedDropdownData}
        layoutDirection="horizontal"
        isLinked={true}
      />
    </View>
  );
};

export default LinkedDropdownExample;

3. Two Unlinked Dropdown Pickers Example

This example demonstrates a modal with two independent dropdowns that function separately.

import React, { useState } from 'react';
import { View, Text, TouchableOpacity } from 'react-native';
import ModalDropdownPicker, { DropdownData } from 'react-native-modal-dropdown-picker';

const unlinkedDropdownData: DropdownData[] = [
  {
    placeholder: 'Select State',
    options: {
      'New York': ['New York'],
      California: ['California'],
      Texas: ['Texas'],
    },
  },
  {
    placeholder: 'Select Menu',
    options: {
      Food: ['F1', 'F2', 'F3', 'F4'],
    },
  },
];

const UnlinkedDropdownExample: React.FC = () => {
  const [modalVisible, setModalVisible] = useState<boolean>(false);
  const [selectedValue, setSelectedValue] = useState<string>('');

  return (
    <View>
      <TouchableOpacity onPress={() => setModalVisible(true)}>
        <Text>Open Unlinked Dropdown Picker</Text>
      </TouchableOpacity>
      <Text style={styles.selectedText}>Selected: {selectedValue}</Text>
      <ModalDropdownPicker
        visible={modalVisible}
        onConfirm={(value: string) => {
          setSelectedValue(value);
          setModalVisible(false);
        }}
        onCancel={() => setModalVisible(false)}
        dropdownData={unlinkedDropdownData}
        layoutDirection="horizontal"
        isLinked={false}
      />
    </View>
  );
};

export default UnlinkedDropdownExample;

API Reference

Props

  • visible: boolean
    Determines whether the modal is visible.

  • onConfirm: (value: string) => void
    Callback that receives the aggregated string of selected options when the Confirm button is pressed.

  • onCancel: () => void
    Callback executed when the Cancel button is pressed.

  • dropdownData: DropdownData[]
    An array of dropdown objects. Each object includes:

    • placeholder: string – The default text displayed when no selection is made.
    • options: string[] | Record<string, string[]>
      • For independent dropdowns: an array of options.
      • For linked dropdowns: an object mapping keys to arrays of options.
    • ordered: boolean (optional) – Indicates whether the dropdown options should be rendered in a specific order.
  • layoutDirection: 'horizontal' | 'vertical'
    Specifies how the dropdowns are arranged within the modal. Defaults to 'horizontal'.

  • isLinked: boolean

    • If true, the dropdowns are linked (i.e., the options of subsequent dropdowns depend on previous selections).
    • If false, each dropdown functions independently. Defaults to true.

Types

Below are examples of the different DropdownData configurations you can pass to the component:

Example 1: Single Dropdown Picker

const dropdownData: DropdownData[] = [
  {
    placeholder: 'Select Food',
    options: {
      'Food 1': ['food 1'],
      'Food 2': ['food 2'],
      'Food 3': ['food 3'],
    },
  },
];

Example 2: Two Linked Dropdown Pickers (isLinked = true)

const dropdownData: DropdownData[] = [
  {
    placeholder: 'Select Food',
    options: {
      'New York': ['New York'],
      California: ['California'],
      Texas: ['Texas'],
    },
  },
  {
    placeholder: 'Select City',
    options: {
      'New York': ['New York City', 'Buffalo', 'Rochester'],
      California: ['Los Angeles', 'San Francisco', 'San Diego'],
      Texas: ['Houston', 'Dallas', 'Austin'],
    },
  },
];

Example 3: Two Unlinked Dropdown Pickers (isLinked = false)

const dropdownData: DropdownData[] = [
  {
    placeholder: 'Select State',
    options: {
      'New York': ['New York'],
      California: ['California'],
      Texas: ['Texas'],
    },
  },
  {
    placeholder: 'Select Menu',
    options: {
      Food: ['F1', 'F2', 'F3', 'F4'],
    },
  },
];

Note: We recognize that using a single dropdown picker might feel a bit cumbersome.

Our goal is to keep the package lightweight while providing essential features.

If you have any ideas for improvements or additional features, please feel free to submit an issue or a pull request.😊

Contributing

Contributions are very welcome!

If you have ideas for improvements, bug fixes, or new features, please feel free to submit an issue or a pull request on GitHub.

You can also leave your feedback via issues. Let's build something awesome together! 🎉

License

This project is licensed under the MIT License.