1.2.5 • Published 11 months ago

native-react-dialog v1.2.5

Weekly downloads
-
License
MIT
Repository
github
Last release
11 months ago

React Native Dialog


Content

  1. Props
  2. Importing the component
  3. Usage example

Props

The component has multiple props, which two on them are required

  • onClose - A void callback function than executes when dialog will close.
  • open - A boolean variable that indicates when the dialog is open.

An optional children, anything that will be inside your dialog component.

  • children - An any type variable. This will be inside your dialog tag.

The rest of props are dialog tag attributes (HTMLDialogAttributes).


Importing the component

import Dialog from 'native-react-modal';

Usage example

dialog-example

//React
import React from 'react';

//Components
import Dialog from 'native-react-modal';

//Your component
const SomeComponent = () => {

  //...

  //States
  const [isOpen, setIsOpen] = React.useState<boolean>(false);

  //Handlers
  conts closeDialogHandler = () => {
    setIsOpen(false);
  }
  
  conts openDialogHandler = () => {
    setIsOpen(true);
  }

  //...

  return (
    <>
      <button
        onClose={openDialogHandler}
      >
        Open dialog!
      </button>
      <Dialog
        onClose={closeDialogHandler}
        open={isOpen}
      >
        This is a dialog!
      </Dialog>
    </>
  );
}
1.2.5

11 months ago

1.2.4

11 months ago

1.2.3

11 months ago

1.2.2

11 months ago

1.2.1

11 months ago

1.2.0

11 months ago

1.1.1

11 months ago

1.1.0

11 months ago

1.0.0

11 months ago