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-awesome-alerts

v2.0.0

Published

Awesome alert for React Native iOS, android and web

Downloads

12,043

Readme

React Native Awesome Alerts

Demo (Watch it on YouTube)

alt text

Getting Started

Installation

$ npm i react-native-awesome-alerts --save

Basic Usage

import React from 'react';
import { StyleSheet, View, Text, TouchableOpacity } from 'react-native';

import AwesomeAlert from 'react-native-awesome-alerts';

export default class App extends React.Component {

  constructor(props) {
    super(props);
    this.state = { showAlert: false };
  };

  showAlert = () => {
    this.setState({
      showAlert: true
    });
  };

  hideAlert = () => {
    this.setState({
      showAlert: false
    });
  };

  render() {
    const {showAlert} = this.state;

    return (
      <View style={styles.container}>

        <Text>I'm AwesomeAlert</Text>
        <TouchableOpacity onPress={() => {
          this.showAlert();
        }}>
          <View style={styles.button}>
            <Text style={styles.text}>Try me!</Text>
          </View>
        </TouchableOpacity>

        <AwesomeAlert
          show={showAlert}
          showProgress={false}
          title="AwesomeAlert"
          message="I have a message for you!"
          closeOnTouchOutside={true}
          closeOnHardwareBackPress={false}
          showCancelButton={true}
          showConfirmButton={true}
          cancelText="No, cancel"
          confirmText="Yes, delete it"
          confirmButtonColor="#DD6B55"
          onCancelPressed={() => {
            this.hideAlert();
          }}
          onConfirmPressed={() => {
            this.hideAlert();
          }}
        />
      </View>
    );
  };
};

const styles = StyleSheet.create({
  container: {
    flex: 1,
    alignItems: 'center',
    justifyContent: 'center',
    backgroundColor: '#fff',
  },
  button: {
    margin: 10,
    paddingHorizontal: 10,
    paddingVertical: 7,
    borderRadius: 5,
    backgroundColor: "#AEDEF4",
  },
  text: {
    color: '#fff',
    fontSize: 15
  }
});

alt text

Props

Basic

| Prop | Type | Description | Default | | :----------------------- | :-------: | :--------------------------------------------: | :------ | | show | boolean | Show / Hide awesome alert | false | | animatedValue | number | Animated value | 0.3 | | useNativeDriver | boolean | Use native driver for animations | false | | showProgress | boolean | Show / Hide progress bar | false | | title | string | Title text to display | hidden | | message | string | Message text to display | hidden | | closeOnTouchOutside | bool | Dismiss alert on clicking outside | true | | closeOnHardwareBackPress | bool | Dismiss alert on hardware back press (android) | true | | showCancelButton | bool | Show a cancel button | false | | showConfirmButton | bool | Show a confirmation button | false | | cancelText | string | Cancel button text | Cancel | | confirmText | string | Confirm button text | Confirm | | onCancelPressed | func | Action to perform when Cancel is pressed | - | | onConfirmPressed | func | Action to perform when Confirm is pressed | - | | onDismiss | func | Callback for when alert is dismissed | - | | customView | object | Custom view to render inside alert | null | | modalProps | object | Additional props to pass for Modal | - | | confirmButtonTestID | string | Confirm button testID | awesome-alert-confirm-btn| | cancelButtonTestID | string | Cancel button testID | awesome-alert-cancel-btn|

Styling

| Prop | Type | Description | Default | | :--------------------- | :------: | :--------------------------: | :------ | | alertContainerStyle | object | Alert parent container style | - | | overlayStyle | object | Overlay style | - | | progressSize | string | Size of activity indicator | - | | progressColor | string | Color of activity indicator | - | | contentContainerStyle | object | Alert popup style | - | | contentStyle | object | Alert popup content style | - | | titleStyle | object | Title style | - | | messageStyle | object | Message style | - | | actionContainerStyle | object | Action container style | - | | cancelButtonColor | string | Background color | #D0D0D0 | | confirmButtonColor | string | Background color | #AEDEF4 | | cancelButtonStyle | object | Cancel button style | - | | cancelButtonTextStyle | object | Cancel button text style | - | | confirmButtonStyle | object | Confirm button style | - | | confirmButtonTextStyle | object | Confirm button text style | - |

Tests

For automated tests, buttons default to data-testid='awesome-alert-cancel-btn' and data-testID='awesome-alert-confirm-btn' properties for the cancel and confirm buttons, respectively. However, feel free to pass in your own via the props.

Inspiration

Pedant: sweet-alert-dialog (Github)

Questions

Feel free to Contact me or Create an issue

License

Released under the Mit License