package
Simple custom dialog with multiple list items for android
npm install react-native-android-dialog-pickerGitHub-flavored package documentation.
Across all versions.
Download trend unavailable.
Runtime metadata.
Tagged topics.
Estimated unpacked size across 1 packages.
18.6 kB
Includes dependencies.
A simple custom dialog with multiple list items.
RN 0.59.1+ has a bug with Picker component not rendered as a modal, even when passing props: https://github.com/facebook/react-native/issues/24055 I needed to create a simple Dialog with options (without checkboxes / radio boxes) and didn't wanted to wait until the issue with Picker is fixed. This is a temporary quick solution for the problem.
react-native-android-dialog-picker version | Required React Native Version |
|---|---|
0.1.x | >= 0.60 or >= 0.59 if using Jetifier |
0.0.x | <= 0.59 |
$ yarn add react-native-android-dialog-picker
or
$ npm install react-native-android-dialog-picker --save
Only necessary for React Native <= 0.59
$ react-native link react-native-android-dialog-picker
android/app/src/main/java/[...]/MainActivity.javaimport com.androiddialogpicker.RNAndroidDialogPickerPackage; to the imports at the top of the filenew RNAndroidDialogPickerPackage() to the list returned by the getPackages() methodandroid/settings.gradle:
include ':react-native-android-dialog-picker'
project(':react-native-android-dialog-picker').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-android-dialog-picker/android')android/app/build.gradle:
compile project(':react-native-android-dialog-picker')import React, { Component } from "react";
import {
Platform,
View,
Button,
ActionSheetIOS
} from "react-native";
import AndroidDialogPicker from "react-native-android-dialog-picker";
export default class App extends Component {
showPicker = () => {
if (Platform.OS === "android") {
// only for android
AndroidDialogPicker.show(
{
title: "Title", // title of the dialog
items: ["Item1", "Item2"], // items/options to choose from