0.0.1 • Published 2 years ago

@irfanwani/react-native-dialog v0.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

React-Native-Dialog

React native dialog library to show dialog boxes

How to thank me ?

Just click on ⭐️ button 😘

Installation:

npm install --save @irfanwani/react-native-dialog
OR
yarn add @irfanwani/react-native-dialog

Basic Usage

import { useState } from "react";
import {
  StyleSheet,
  Text,
  Button,
  View,
  GestureResponderEvent,
} from "react-native";

import Dialog from "@irfanwani/react-native-dialog";

export default () => {
  const [visible, setvisible] = useState(false);

  const showModal: (event: GestureResponderEvent) => void = () => {
    setvisible(true);
  };
  return (
    <View style={styles.container}>
      <Button title="show modal" onPress={showModal} />
      <Dialog
        title="Dialog Title"
        cancelText="Cancel"
        subtitle="Dialog subtitle which is shown under the title"
        confirmText="Confirm"
        visible={visible}
        closeDialog={() => {
          setvisible(false);
        }}
        confirm={() => {
          console.log("confirmed");
        }}
      />
    </View>
  );
};

Props

PropTypeRequiredNote
visiblebooleanTrueDetermines whether the dialog is shown or not
titlestringTrueTitle for the dialog
subtitlestringTrueExtra description about the alert
closeDialog(event: GestureResponderEvent) => voidTrueCallback for the close button
confirm(event: GestureResponderEvent) => voidTrueCallback for the confirm button
confirmTextstringTruetext to be shown on the confirm button
cancelTextstringTruetext to be shown on the cancel button
titleStyle?ObjectFalseStyles object for the title
cancelStyle?ObjectFalseStyles object for the cancel button container
confirmStyle?ObjectFalseStyles object for the confirm button container
subtitleStyle?ObjectFalseStyles object for the subtitle button
cancelTextStyle?ObjectFalseStyles object for the cancel button text
confirmTextStyle?ObjectFalseStyles object for the confirm button text