# react-native-dialog **Repository Path**: mirrors_jitsi/react-native-dialog ## Basic Information - **Project Name**: react-native-dialog - **Description**: Pure JavaScript React-Native dialog - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2022-06-21 - **Last Updated**: 2025-12-27 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # react-native-dialog [![npm version](https://badge.fury.io/js/react-native-dialog.svg)](https://badge.fury.io/js/react-native-dialog) A flexible pure JavaScript React-Native dialog that follows closely the native UI guidelines. ## Features - Support for iOS and Android (JavaScript API) - A flexible declarative API - Follows closely the UI of native dialogs/alerts - Can be used both as an alert and as an input prompt - Can be injected with any component - Supports light/dark mode ## Demo

## Setup Install the library using npm or yarn: ```bash # Using npm: $ npm install react-native-dialog # Using yarn: $ yarn add react-native-dialog ``` ## Usage React-native-dialog exposes a set of components that can be used to build the UI of the dialog: - **Dialog.Container**: This component is the root component of the dialog and all the other components should be nested inside it. - **Dialog.Title**: A `Text` component styled as a native dialog title. - **Dialog.Description**: A `Text` component styled as a native dialog description. - **Dialog.Button**: A component styled as a native dialog button. - **Dialog.Input**: A `TextInput` component styled as a native dialog input. - **Dialog.CodeInput**: A `TextInput` component styled as one time code input. - **Dialog.Switch**: A native `Switch` component with an optional label. 1. Import react-native-dialog: ```javascript import Dialog from "react-native-dialog"; ``` 2. Create a dialog and nest its content inside of it: ```javascript return ( Account delete Do you want to delete this account? You cannot undo this action. ); ``` 3. Then simply show it by setting the `visible` prop to true: ```javascript return ( Account delete Do you want to delete this account? You cannot undo this action. ); ``` The `visible` prop is the only prop you'll really need to make the dialog work: you should control this prop value by saving it in your state and setting it to `true` or `false` when needed. ## A complete example The following example consists in a component (`DialogTester`) with a button and a dialog. The dialog is controlled by the `dialogVisible` state variable and it is initially hidden since its value is `false`. Pressing the button sets `dialogVisible` to true, making the dialog visible. Inside the dialog there are two buttons that, when pressed, set `dialogVisible` to false, hiding the dialog. ```javascript import React, { useState } from "react"; import { Button, StyleSheet, View } from "react-native"; import Dialog from "react-native-dialog"; export default function App() { const [visible, setVisible] = useState(false); const showDialog = () => { setVisible(true); }; const handleCancel = () => { setVisible(false); }; const handleDelete = () => { // The user has pressed the "Delete" button, so here you can do your own logic. // ...Your logic setVisible(false); }; return (