Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-native-dialog-component

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-dialog-component

React Native Dialog Component for IOS & Android.

  • 0.2.17
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
53
decreased by-44.79%
Maintainers
1
Weekly downloads
 
Created
Source

React Native Dialog Component

React Native Dialog Component for iOS & Android.

Pull request are welcomed. Please follow Airbnb JS Style Guide

Preview


Try With Exponent

Exponent

Installation

npm install --save react-native-dialog-component
# OR
yarn add react-native-dialog-component

Exposed Modules

  • DialogManager
  • DialogComponent
  • Dialog
  • DialogContent
  • DialogButton
  • DialogTitle
  • Overlay
  • Animation
  • FadeAnimation
  • ScaleAnimation
  • SlideAnimation

Examples

Example

Usage With DialogManager

import DialogManager, { ScaleAnimation, DialogContent } from 'react-native-dialog-component';
show
DialogManager.show({
  title: 'Dialog',
  titleAlign: 'center',
  animationDuration: 200,
  ScaleAnimation: new ScaleAnimation(),
  children: (
    <DialogContent>
      <View>
        <Text>
          React Native Dialog Component
        </Text>
      </View>
    </DialogContent>
  ),
}, () => {
  console.log('callback - show');
});
update
DialogManager.update({
  title: 'Dialog Updated',
  titleAlign: 'center',
  animationDuration: 200,
  ScaleAnimation: new ScaleAnimation(),
  children: (
    <DialogContent>
      <View>
        <Text>
          New Content
        </Text>
      </View>
    </DialogContent>
  ),
}, () => {
  console.log('callback - update dialog');
});
dismiss
// dismiss dialog
DialogManager.dismiss(() => {
  console.log('callback - dismiss');
});
dismiss all
DialogManager.dismissAll(() => {
  console.log('callback - dismiss all');
});

Usage with DialogComponent

import { DialogComponent }from 'react-native-dialog-component';

<View style={styles.container}>
  <Button
    text="Show Dialog"
    onPress={() => {
      this.dialogComponent.show();
    }}
  />
  <DialogComponent
    ref={(dialogComponent) => { this.dialogComponent = dialogComponent; }}
  >
    <View>
      <Text>Hello</Text>
    </View>
  </DialogComponent>
</View>

Usage - With Animation

import { DialogComponent, SlideAnimation } from 'react-native-dialog-component';

<View style={styles.container}>
  <Button
    text="Show Dialog"
    onPress={() => {
      this.dialogComponent.show();
    }}
  />
  <DialogComponent
    ref={(dialogComponent) => { this.dialogComponent = dialogComponent; }}
    dialogAnimation = { new SlideAnimation({ slideFrom: 'bottom' }) }
  >
    <View>
      <Text>Hello</Text>
    </View>
  </DialogComponent>
</View>

Usage - With Dialog Dialog Title

import { DialogComponent, DialogTitle } from 'react-native-dialog-component';

<View style={styles.container}>
  <Button
    text="Show Dialog"
    onPress={() => {
      this.dialogComponent.show();
    }}
  />
  <DialogComponent
    dialogTitle={<DialogTitle title="Dialog Title" />}
    ref={(dialogComponent) => { this.dialogComponent = dialogComponent; }}
  >
    <View>
      <Text>Hello</Text>
    </View>
  </DialogComponent>
</View>

Usage - Wrape the content use DialogContent

import { DialogComponent, DialogTitle } from 'react-native-dialog-component';

<View style={styles.container}>
  <Button
    text="Show Dialog"
    onPress={() => {
      this.dialogComponent.show();
    }}
  />
  <DialogComponent
    dialogTitle={<DialogTitle title="Dialog Title" />}
    ref={(dialogComponent) => { this.dialogComponent = dialogComponent; }}
  >
    <DialogContent>
      <View>
        <Text>Hello</Text>
      </View>
    </DialogContent>
  </DialogComponent>
</View>

Props

DialogComponent

PropTypeDefaultNote
dialogTitleReact ElementYou can pass a DialogTitle component or pass a View for customizing titlebar
widthNumberYour device widthThe Width of Dialog, you can use fixed width or use percentage
heightNumber300The Width of Dialog, you can use fixed height or use percentage
dialogAnimationFadeAnimationanimation for dialog
dialogStyleObject or Number
animationDurationNumber200
overlayPointerEventsStringAvailable option: auto, none
overlayBackgroundColorString#000
overlayOpacityNumber0.5
dismissOnTouchOutsideBooltrueWhen touch overlay will close dialog, but if haveOverlay is false then the dismissOnTouchOutside won't work
dismissOnHardwareBackPressBooltrueOnly for Android
haveOverlayBooltrueIf false won't show overlay when dialog show
showBoolfalse
onShownFunctionYou can pass onShown function as a aallback function, will call the function while dialog shown
onDismissedFunctionYou can pass onDismissed function as a callback function, will call the function while dialog dismissed
actionsArrayArray of DialogButton component for example: [<DialogButton text="DISMISS", align="center" onPress={this.dismissDialog}/>]

DialogContent

PropTypeDefaultNote
contentStyleDialog's content container

DialogTitle

PropTypeDefaultNote
titleString
titleStyleObject or Number
titleTextStyleObject or Number
titleAlignStringcenter
haveTitleBarBooltrue

DialogButton

PropTypeDefaultNote
textString
alignStringcenterThe position of the button. Available option: left, center, right
onPressFunction
buttonStyleObject or Number
textStyleObject or Number
textContainerStyleObject or Number
disabledBooleanfalse
activeOpacityNumber

Animation

Params for (*)Animation

FadeAnimation

ParamTypeDefaultNote
toValueNumber0
animationDurationNumber150

ScaleAnimation

ParamTypeDefaultNote
toValueNumber0

SlideAnimation

ParamTypeDefaultNote
toValueNumber0
slideFromStringbottomAvailable option: top, bottom, left, right

Keywords

FAQs

Package last updated on 05 Nov 2017

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

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc