Socket
Book a DemoInstallSign in
Socket

@rn-common/dialog

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rn-common/dialog

The `Dialog` component is a customizable modal dialog built with React Native and Reanimated. It provides smooth animations, a backdrop overlay, and the ability to handle user interactions like hardware back button presses.

53.0.3
latest
npmnpm
Version published
Weekly downloads
9
28.57%
Maintainers
1
Weekly downloads
 
Created
Source

Dialog Component

The Dialog component is a customizable modal dialog built with React Native and Reanimated. It provides smooth animations, a backdrop overlay, and the ability to handle user interactions like hardware back button presses.

Features

  • Customizable Backdrop: Set the backdrop color and transparency.
  • Cancelable: Allow users to close the dialog by tapping the backdrop or pressing the back button.
  • Smooth Animations: Powered by react-native-reanimated for seamless transitions.
  • Keyboard Avoidance: Automatically adjusts for keyboard appearance.

Installation

Install using:

yarn @rn-common/dialog

Usage

import React from 'react'
import { Button, Text, View } from 'react-native'
import { Dialog } from './Dialog'

export default function App() {
  const [visible, setVisible] = React.useState(false)

  return (
    <View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
      <Button title="Show Dialog" onPress={() => setVisible(true)} />
      <Dialog
        show={visible}
        onRequestClose={() => setVisible(false)}
        backdropColor="rgba(0, 0, 0, 0.7)"
      >
        <View
          style={{
            padding: 20,
            backgroundColor: 'white',
            borderRadius: 10,
            alignItems: 'center',
          }}
        >
          <Text>Hello, this is a dialog!</Text>
          <Button title="Close" onPress={() => setVisible(false)} />
        </View>
      </Dialog>
    </View>
  )
}

Props

PropTypeDefaultDescription
cancelablebooleantrueWhether the dialog can be dismissed by tapping the backdrop or back button.
childrenReactNodeRequiredThe content to display inside the dialog.
showbooleanfalseControls the visibility of the dialog.
onRequestClose() => voidundefinedCallback invoked when the dialog is requested to close.
backdropColorstring'rgba(0,0,0,0.5)'Color of the backdrop overlay.

Customization

You can customize the dialog further by modifying the styles or providing additional props to the children.

License

This project is licensed under the MIT License.

FAQs

Package last updated on 24 May 2025

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.