npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-native-dialog-component

v0.2.17

Published

React Native Dialog Component for IOS & Android.

Downloads

318

Readme

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

| Prop | Type | Default | Note | |---|---|---|---| | dialogTitle | React Element | | You can pass a DialogTitle component or pass a View for customizing titlebar | | width | Number | Your device width | The Width of Dialog, you can use fixed width or use percentage | height | Number | 300 | The Width of Dialog, you can use fixed height or use percentage | dialogAnimation | | FadeAnimation | animation for dialog | | | dialogStyle | Object or Number | | | | | animationDuration | Number | 200 | | | | overlayPointerEvents | String | | Available option: auto, none | | overlayBackgroundColor | String | #000 | | overlayOpacity | Number | 0.5 | | dismissOnTouchOutside | Bool | true | When touch overlay will close dialog, but if haveOverlay is false then the dismissOnTouchOutside won't work| | | dismissOnHardwareBackPress | Bool | true | Only for Android | | | haveOverlay | Bool | true | If false won't show overlay when dialog show | | | show | Bool | false | | | | onShown | Function | | You can pass onShown function as a aallback function, will call the function while dialog shown | | | onDismissed | Function | | You can pass onDismissed function as a callback function, will call the function while dialog dismissed | | | actions | Array | | Array of DialogButton component for example: [<DialogButton text="DISMISS", align="center" onPress={this.dismissDialog}/>] | |

DialogContent

| Prop | Type | Default | Note | |---|---|---|---| | contentStyle | | | Dialog's content container| |

DialogTitle

| Prop | Type | Default | Note | |---|---|---|---| | title | String | | | | | titleStyle | Object or Number | | | | | titleTextStyle | Object or Number | | | | | titleAlign | String | center | | | | haveTitleBar | Bool | true | | |

DialogButton

| Prop | Type | Default | Note | |---|---|---|---| | text | String | | | | | align | String | center | The position of the button. Available option: left, center, right | | | onPress | Function | | | | | buttonStyle | Object or Number | | | | | textStyle | Object or Number | | | | | textContainerStyle | Object or Number | | | | | disabled | Boolean | false | | | | activeOpacity | Number | | | |

Animation

Params for (*)Animation

FadeAnimation

| Param | Type | Default | Note | |---|---|---|---| | toValue | Number | 0 | | | animationDuration | Number | 150 | |

ScaleAnimation

| Param | Type | Default | Note | |---|---|---|---| | toValue | Number | 0 | |

SlideAnimation

| Param | Type | Default | Note | |---|---|---|---| | toValue | Number | 0 | | | slideFrom | String | bottom | Available option: top, bottom, left, right |