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-simple-dialogs

v2.0.3

Published

⚛ Cross-platform simple dialogs for React Native based on the Modal component.

Downloads

8,704

Readme

React Native Simple Dialogs

License MIT npm version npm downloads

⚛ Cross-platform React Native dialogs based on the Modal component.

Features

Expo Snack

An Expo Demo Link

Screenshots

| Android | iOS | | - | - | | | | | | | | | |

Requirements

  • React Native >= 0.44.0

NOTES

Install

  yarn add react-native-simple-dialogs

Or

  npm i -S react-native-simple-dialogs

Use

Custom Dialog

import { Dialog } from 'react-native-simple-dialogs';

<Dialog
    visible={this.state.dialogVisible}
    title="Custom Dialog"
    onTouchOutside={() => this.setState({dialogVisible: false})} >
    <View>
        // your content here
    </View>
</Dialog>

Available props

| Name | Type | Default | Description | | --------------------------- | --------------------------------------------------------------------------------------------------- | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | | visible | Boolean | false | Show the modal? | | onRequestClose | Function | null | Callback that's called when users taps the hardware back button on Android | | animationType | Enum('none', 'slide', 'fade') | 'none' | Controls how the modal animates | | onShow | Function | null | Callback that's called once the modal has been shown | | onOrientationChange | Function | null | Callback that's called when the orientation change while the modal is being displayed on iOS | | supportedOrientations | Array of Enum('portrait', 'portrait-upside-down', 'landscape', 'landscape-left', 'landscape-right') | 'portrait' | Allowed orientation while modals is being shown. More info at react-native docs | | statusBarTranslucent | Boolean | null | Determines whether your modal should go under the system statusbar. More info at react-native docs | | onTouchOutside | Function | null | Callbac that's called when users tap outside the shown modal | | title | String | null | Modal's title | | titleStyle | Text StyleSheet | null | Custom text style object for modal's title | | dialogStyle | View StyleSheet | null | Custom view style for dialog box | | contentStyle | View StyleSheet | null | Custom view style for dialog content wrapper | | buttonsStyle | View StyleSheet | null | Custom view style for dialog button wrapper | | overlayStyle | View StyleSheet | null | Custom view style for dialog overlay | | buttons | React Node | null | Modal button component | | keyboardDismissMode | Enum('none', 'on-drag', 'interactive') | null | Determines whether the keyboard gets dismissed in response to a drag. | | keyboardShouldPersistTaps | Enum('always', 'never', 'handled', false, true) | null | Determines when the keyboard should stay visible after a tap. |

Confirm Dialog

import { ConfirmDialog } from 'react-native-simple-dialogs';

// with message
<ConfirmDialog
    title="Confirm Dialog"
    message="Are you sure about that?"
    visible={this.state.dialogVisible}
    onTouchOutside={() => this.setState({dialogVisible: false})}
    positiveButton={{
        title: "YES",
        onPress: () => alert("Yes touched!")
    }}
    negativeButton={{
        title: "NO",
        onPress: () => alert("No touched!")
    }}
/>

// with custom content
<ConfirmDialog
    title="Confirm Dialog"
    visible={this.state.dialogVisible}
    onTouchOutside={() => this.setState({dialogVisible: false})}
    positiveButton={{
        title: "OK",
        onPress: () => alert("Ok touched!")
    }} >
    <View>
        // your content here
    </View>
</ConfirmDialog>

Available props

| Name | Type | Default | Description | | ----------------- | -------------------------------------------------------------------------------- | ------------ | --------------------------------------------------------------------------------------------- | | ...{Dialog.props} | Dialog Props | null | Same props as Dialog Component | | message | String | null | Message shown in the confirm dialog | | messageStyle | Text StyleSheet | null | Custom text style for message | | negativeButton | Button Props | null | Button element object to describe the negative button. See below for detailed shape of button | | positiveButton | Button Props | REQUIRED | Button element object to describe the positive button. See below for detailed shape of button |

Button props

| Name | Type | Default | | ---------- | -------------------------------------------------------------------------------- | ------------ | | title | String | REQUIRED | | onPress | Function | REQUIRED | | disabled | Boolean | null | | titleStyle | Text StyleSheet | null | | style | View StyleSheet | null |

Progress Dialog

import { ProgressDialog } from 'react-native-simple-dialogs';

<ProgressDialog
    visible={this.state.progressVisible}
    title="Progress Dialog"
    message="Please, wait..."
/>

Available props

| Name | Type | Default | Description | | ---------------------- | -------------------------------------------------------------------------------- | ------------ | ------------------------------------------------------- | | ...{Dialog.props} | Dialog Props | null | Same props as Dialog Component | | message | String | null | Message shown in the progress dialog | | messageStyle | Text StyleSheet | null | Custom text style for message | | activityIndicatorColor | color | null | The foreground color of the spinner | | activityIndicatorSize | enum('small', 'large'), number | null | Size of the indicator. Number only supported on Android | | activityIndicatorStyle | View StyleSheet | null | Custom style for the activity indicator |

More info on the sample project.

Contribute

New features, bug fixes and improvements are welcome! For questions and suggestions use the issues.

Donate

Star History

Star History Chart

License

The MIT License (MIT)

Copyright (c) 2017 Douglas Nassif Roma Junior

See the full license file.