GithubHelp home page GithubHelp logo

admajora / react-native-popup-dialog Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jacklam718/react-native-modals

0.0 1.0 0.0 2.7 MB

A React Native Popup Dialog Easy Use & Support Custom Animation. For IOS & Android.

License: MIT License

JavaScript 100.00%

react-native-popup-dialog's Introduction

React Native Popup Dialog

React Native Popup Dialog for iOS & Android.

Another similar dialog component: react-native-dialog-component the main difference is style.

Pull request are welcomed. Please follow Airbnb JS Style Guide

Try it with Exponent

           


Installation

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

Exposed Modules

  1. Dialog
  2. PopupDialog
  3. DialogButton
  4. DialogTitle
  5. Overlay
  6. Animation
  7. FadeInAnimation
  8. ScaleAnimation
  9. SlideAnimation
  10. PopupDialogType
  11. DialogType
  12. DialogButtonType
  13. DialogTitleType
  14. OverlayType

Examples

Example

Usage

import PopupDialog from 'react-native-popup-dialog';

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

Usage - With Animation

import PopupDialog, { SlideAnimation } from 'react-native-popup-dialog';

<View style={styles.container}>
  <PopupDialog
    ref={(popupDialog) => { this.popupDialog = popupDialog; }}
    dialogAnimation = { new SlideAnimation({ slideFrom: 'bottom' }) }
  >
    <View>
      <Text>Hello</Text>
    </View>
  </PopupDialog>
</View>

Usage - With Dialog Dialog Title

import PopupDialog, { DialogTitle } from 'react-native-popup-dialog';

<View style={styles.container}>
  <PopupDialog
    dialogTitle={<DialogTitle title="Dialog Title" />}
    ref={(popupDialog) => { this.popupDialog = popupDialog; }}
  >
    <View>
      <Text>Hello</Text>
    </View>
  </PopupDialog>
</View>

Methods

show

this.popupDialog.show(() => {
  console.log('callback');
});

dismiss

this.popupDialog.dismiss(() => {
  console.log('callback');
});

Props

PopupDialog

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 FadeInAnimation 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 dismiss 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 while dialog show
show Bool false
onShown Function You can pass shown function as a callback function, will call the function when dialog shown
onDismissed Function You can pass onDismissed function as a callback function, will call the function when dialog dismissed
actions Array Array of DialogButton component for example: [<DialogButton text="DISMISS", align="center" onPress={this.dismiss}/>]

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

FadeInAnimation

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

Development

yarn

yarn run build

react-native-popup-dialog's People

Contributors

jacklam718 avatar aviadhahami avatar dorthwein avatar salttis avatar abbasfreestyle avatar brentvatne avatar sarmad93 avatar rpocaznoi avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.