@expo/react-native-action-sheet vs react-native-picker-select vs react-native-dropdown-picker vs react-native-action-sheet
React Native Action and Picker Libraries Comparison
1 Year
@expo/react-native-action-sheetreact-native-picker-selectreact-native-dropdown-pickerreact-native-action-sheetSimilar Packages:
What's React Native Action and Picker Libraries?

These libraries provide various functionalities for displaying action sheets and pickers in React Native applications. They allow developers to create interactive UI elements that enhance user experience by enabling selections and actions in a mobile-friendly manner. Each library has unique features and use cases, catering to different needs in mobile app development.

NPM Package Downloads Trend
Github Stars Ranking
Stat Detail
Package
Downloads
Stars
Size
Issues
Publish
License
@expo/react-native-action-sheet127,0071,434176 kB248 months agoMIT
react-native-picker-select110,2501,77845.8 kB915 months agoMIT
react-native-dropdown-picker70,6171,009161 kB1632 years agoMIT
react-native-action-sheet12,307183239 kB20-MIT
Feature Comparison: @expo/react-native-action-sheet vs react-native-picker-select vs react-native-dropdown-picker vs react-native-action-sheet

Customization

  • @expo/react-native-action-sheet:

    This package offers limited customization options, focusing on simplicity and ease of use. It allows basic styling but does not support extensive customization of the action sheet's appearance.

  • react-native-picker-select:

    Offers basic customization options, allowing developers to style the dropdown and selected item. It is straightforward to implement but may not provide as many customization features as other dropdown libraries.

  • react-native-dropdown-picker:

    This package provides a wide range of customization options, including styles for the dropdown and selected items, as well as the ability to define custom components for rendering items. It supports multi-select and can be styled to match your application's theme.

  • react-native-action-sheet:

    Highly customizable, this package allows developers to modify the appearance and behavior of the action sheet extensively. You can customize buttons, colors, and layouts to fit your app's design requirements.

Ease of Use

  • @expo/react-native-action-sheet:

    Designed for ease of use, this package integrates seamlessly with Expo projects, making it quick to implement without complex configurations. It is ideal for developers seeking a straightforward solution.

  • react-native-picker-select:

    Known for its simplicity, this package is easy to use and implement, with minimal setup required. It is suitable for developers looking for a quick solution for dropdown selections.

  • react-native-dropdown-picker:

    This package is user-friendly and easy to implement, with clear documentation and examples. It simplifies the process of creating dropdowns, making it accessible for developers of all skill levels.

  • react-native-action-sheet:

    While it offers more features, this package may require additional setup and configuration, making it slightly less user-friendly for beginners compared to the Expo version.

Performance

  • @expo/react-native-action-sheet:

    Optimized for performance within the Expo environment, this package ensures smooth interactions and minimal lag when displaying action sheets, making it suitable for high-performance applications.

  • react-native-picker-select:

    Lightweight and efficient, this package provides good performance for simple dropdowns, making it a suitable choice for applications that prioritize speed and responsiveness.

  • react-native-dropdown-picker:

    This package is designed to perform well even with large lists of options. It efficiently manages selections and updates, ensuring a responsive user experience.

  • react-native-action-sheet:

    Performance may vary based on customization and complexity. However, it is generally efficient and can handle multiple action sheets without significant performance degradation.

Integration

  • @expo/react-native-action-sheet:

    This package is specifically designed for Expo applications, ensuring seamless integration with other Expo components and libraries, which simplifies the development process.

  • react-native-picker-select:

    Designed for easy integration, this package can be used in any React Native project without additional dependencies, making it a convenient choice for developers.

  • react-native-dropdown-picker:

    Easily integrates into any React Native project, with no special dependencies required. It works well alongside other libraries and components, making it versatile for various applications.

  • react-native-action-sheet:

    Can be integrated into any React Native project, providing flexibility for developers who are not using Expo. It may require additional setup for linking native modules.

Community Support

  • @expo/react-native-action-sheet:

    As part of the Expo ecosystem, this package benefits from strong community support and documentation, making it easier for developers to find help and resources.

  • react-native-picker-select:

    This package is well-supported with good documentation and community resources, making it easy for developers to get assistance and share knowledge.

  • react-native-dropdown-picker:

    With a growing user base, this package has decent community support and documentation, helping developers troubleshoot and implement features effectively.

  • react-native-action-sheet:

    This package has a robust community and is widely used, providing ample resources, tutorials, and support for developers facing issues or seeking guidance.

How to Choose: @expo/react-native-action-sheet vs react-native-picker-select vs react-native-dropdown-picker vs react-native-action-sheet
  • @expo/react-native-action-sheet:

    Choose this package if you are developing an Expo-managed React Native application and need a simple, easy-to-use action sheet that integrates well with Expo's ecosystem. It is optimized for performance and provides a straightforward API for displaying action sheets with minimal setup.

  • react-native-picker-select:

    Choose this package if you want a simple and lightweight solution for single-select dropdowns. It is easy to implement and provides a native look and feel, making it ideal for applications that require basic selection functionality without the complexity of additional features.

  • react-native-dropdown-picker:

    Select this package if you need a dropdown picker that supports multi-select options and is highly customizable. It is particularly useful for forms where users need to select one or multiple items from a list, and it provides a rich set of features for managing selections and styles.

  • react-native-action-sheet:

    Opt for this package if you require a customizable action sheet that can be used in non-Expo React Native projects. It offers more flexibility in terms of styling and behavior, making it suitable for developers who want to implement a tailored solution for their action sheets.

README for @expo/react-native-action-sheet

@expo/react-native-action-sheet

npm License: MIT Discord

React Native Action Sheet is a cross-platform React Native component that uses the native UIActionSheet on iOS and a pure JS implementation on Android.

| iOS | Android | Web | | -------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------- | | | | |

Check out the example snack here!

Installation

npm install @expo/react-native-action-sheet

or

yarn add @expo/react-native-action-sheet

A basic ActionSheet Setup

1. Wrap your top-level component with <ActionSheetProvider />

ReactNativeActionSheet uses React context to allow your components to invoke the menu. This means your app needs to be wrapped with the ActionSheetProvider component first.

import { ActionSheetProvider } from '@expo/react-native-action-sheet';

export default function AppContainer() {
  return (
    <ActionSheetProvider>
      <App />
    </ActionSheetProvider>
  );
}

2. Call the showActionSheetWithOptions method with a hook or a higher order component.

// Using the provided hook
import { useActionSheet } from '@expo/react-native-action-sheet';

export default Menu() {
  const { showActionSheetWithOptions } = useActionSheet();

  const onPress = () => {
    const options = ['Delete', 'Save', 'Cancel'];
    const destructiveButtonIndex = 0;
    const cancelButtonIndex = 2;

    showActionSheetWithOptions({
      options,
      cancelButtonIndex,
      destructiveButtonIndex
    }, (selectedIndex: number) => {
      switch (selectedIndex) {
        case 1:
          // Save
          break;

        case destructiveButtonIndex:
          // Delete
          break;

        case cancelButtonIndex:
          // Canceled
      }});
  }

  return (
    <Button title="Menu" onPress={onPress}/>
  )
};

Alternatively, any component can use the higher order component to access the context and pass the showActionSheetWithOptions as a prop.

// Using a Higher Order Component to wrap your component
import { connectActionSheet } from '@expo/react-native-action-sheet';

function Menu({ showActionSheetWithOptions }) {
  /* ... */
}

export default connectActionSheet(Menu);

Menu component can now access the actionSheet prop as showActionSheetWithOptions.

Options

The goal of this library is to mimic the native iOS and Android ActionSheets as closely as possible.

This library can also be used in the browser with Expo for web.

Universal Props

| Name | Type | Description | | ------------------------ | -------------------------- | ------------------------------------------------------------- | | options | array of strings | A list of button titles (required) | | cancelButtonIndex | number | Index of cancel button in options | | cancelButtonTintColor | string | Color used for the change the text color of the cancel button | | destructiveButtonIndex | number or array of numbers | Indices of destructive buttons in options | | title | string | Title to show above the action sheet | | message | string | Message to show below the title | | tintColor | string | Color used for non-destructive button titles | | disabledButtonIndices | array of numbers | Indices of disabled buttons in options |

iOS Only Props

| Name | Type | Description | | -------------------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | anchor | number | iPad only option that allows for docking the action sheet to a node. See ShowActionSheetButton.tsx for an example on how to implement this. | | userInterfaceStyle | string | The interface style used for the action sheet, can be set to light or dark, otherwise the default system style will be used. |

Custom Action Sheet Only (Android/Web) Props

The below props allow modification of the Android ActionSheet. They have no effect on the look on iOS as the native iOS Action Sheet does not have options for modifying these options.

| Name | Type | Description | | ------------------ | --------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | icons | array of required images or icons | Show icons to go along with each option. If image source paths are provided via require, images will be rendered for you. Alternatively, you can provide an array of elements such as vector icons, pre-rendered Images, etc. | | tintIcons | boolean | Icons by default will be tinted to match the text color. When set to false, the icons will be the color of the source image. This is useful if you want to use multicolor icons. If you provide your own nodes/pre-rendered icons rather than required images in the icons array, you will need to tint them appropriately before providing them in the array of icons; tintColor will not be applied to icons unless they are images from a required source. | | textStyle | TextStyle | Apply any text style props to the options. If the tintColor option is provided, it takes precedence over a color text style prop. | | titleTextStyle | TextStyle | Apply any text style props to the title if present. | | messageTextStyle | TextStyle | Apply any text style props to the message if present. | | autoFocus | boolean | If true, this will give the first option screen reader focus automatically when the action sheet becomes visible. On iOS, this is the default behavior of the native action sheet. | | showSeparators | boolean | Show separators between items. On iOS, separators always show so this prop has no effect. | | containerStyle | ViewStyle | Apply any view style props to the container rather than use the default look (e.g. dark mode). | | separatorStyle | ViewStyle | Modify the look of the separators rather than use the default look. | | useModal | boolean | Defaults to false (true if autoFocus is also true) Wraps the ActionSheet with a Modal, in order to show in front of other Modals that were already opened (issue reference). | | destructiveColor | string | Modify color for text of destructive option. Defaults to #d32f2f. |

ActionSheetProvider Props

The following props can be set directly on the ActionSheetProvider

| Name | Type | Description | | ---------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | useCustomActionSheet | boolean | iOS only prop that uses the custom pure JS action sheet (Android/Web version) instead of the native ActionSheetIOS component. Defaults to false. | | useNativeDriver | boolean | Windows only option that provides the option to disable the native animation driver for React Native Windows projects targeting Windows 10 Version-1809 ; Build-10.0.17763.0 and earlier. useNativeDriver is supported in Version-1903 and later so if your project is targeting that, you don't need to set this prop. |

// example of using useCustomActionSheet on iOS
export default function AppContainer() {
  return (
    <ActionSheetProvider useCustomActionSheet={true}>
      <App />
    </ActionSheetProvider>
  );
}

Callback

The second parameter of the showActionSheetWithOptions function is a callback for when a button is selected. The callback takes a single argument which will be the zero-based index of the pressed option. You can check the value against your cancelButtonIndex to determine if the action was cancelled or not.

function onButtonPress(selectedIndex: number) {
  // handle it!
}

Try it out

Try it in Expo Snack: https://snack.expo.dev/@expo-action-sheet/example.

Example

See the example app.

Usage

$ cd example
$ yarn

// build simulator
$ yarn ios
$ yarn android

// web
$ yarn web

Development

Setup

$ git clone git@github.com:expo/react-native-action-sheet.git
$ cd react-native-action-sheet
$ yarn

Build

We use bob.

$ yarn build

Lint & Format

// tsc
$ yarn type-check

// ESLint + Prettier
$ yarn lint