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-super-alert

v0.1.0

Published

All in one react native Alerts

Downloads

128

Readme

Screenshot

React Native Super Alert is a component where you can use various types of alerts and notifications without having to import the library on all screens..

downloads

Installation

npm i react-native-super-alert --save
or
yarn add react-native-super-alert
Load the library in Root file of your application (e.g. app.js)
import SuperAlert from "react-native-super-alert";

export default function App() {
    return (
            <View>
                <AppContainer /> 
                <SuperAlert /> {/* <--- Load Super Alert here */}
            </View>
        );
    }
}

NOTE: This component will replace the default (alert) action from React Native

Usage

Default alert

After import Super alert in Root of application, you can call the component using the code bellow

Default

   // alert('Title of alert', 'Message of alert', { Object props })

Example for default alert without confirm

    alert(
        'Hello!!', // This is a title
        "This is a Super Alert" // This is a alert message
    )

Loading alert from the corners of screen

    alert(
        'Hello!!', // This is a title
        "This is a Super Alert", // This is a alert message
        {
            position: 'top' // top, bottom, left or right,
        }
    )

| Prop | Type | Description | Default | | ---------------- | -------- | -------------------------------------------------------- | -------------------------- | | position (Optional) | string | Using alert in corners (Top, Bottom, Left, Right) | '' |


Using confirm and cancel action

Confirm

Example

    alert(
        'Hello!!', // This is a title
        "This is a Super Alert", // This is a alert message
        {
            textConfirm: 'Confirm', // Label of button confirm
            textCancel: 'Cancel', // Label of button cancel
            onConfirm: () => confirmClick(), // Call your confirm function 
            onCancel: () => cancelClick() // Call your cancel function 
        }
    )

Then create the functions to confirm and cancel action

  confirmClick = () => {
    console.log('Confirm Action')
  }

  cancelClick = () => {
    console.log('Cancel Action')
  }

Note: You can use the confirm params in all alert types

Other types

BottomSheet

BottomSheet

    alert(
        'Hello!!', // This is a title
        "This is a Super Alert", // This is a alert message
        {
            type: 'bottomsheet'
        }
    )

Props of BottomSheet

| Prop | Type | Description | Default | | ---------------- | -------- | -------------------------------------------------------- | -------------------------- | | bottomSheetHeight (Optional) | number | Alert BottomSheet height | 180 |


Flash Message

Alt Text

    alert(
        'Title',
        'This is model of default alert, thanks for use the component',
        {
            type: 'flashmessage',
            option: 'danger', // danger | warning | info | success
            timeout: 3
        }
    )

Props of Flash Message

| Prop | Type | Description | Default | | ---------------- | -------- | -------------------------------------------------------- | -------------------------- | | flashMessageHeight (Optional) | number | Flash Message height | 110 | | option (Optional) | string | Select the Color Scheme (danger,warning,info or success)| '' | | timeout (Optional)| number | Total of seconds to close the alert | 5 |

Example with React Navigation Component

Alt Text

Global Props

| Prop | Type | Description | Default | | ---------------- | -------- | -------------------------------------------------------- | -------------------------- | | Type (Optional) | string | Select the type of alert (alert,bottomsheet,flashmessage) | 'alert'| | useNativeDriver (Optional) | boolean | Use native driver | false | | textConfirm (Optional) | string | Button confirm label | 'OK' | | textCancel (Optional) | string | Button cancel label | '' |

Customize de Alerts

You can customize the alert according to your theme

Place your style object in the customStyle props

<SuperAlert customStyle={customStyle} />

Classes of customization

| Prop | Description | | ---------------- | -------------------------------------------------------- | | container | Customize the container style | | buttonCancel | Customize the button cancel style | | buttonConfirm | Customize the button confirm style | | textButtonCancel | Customize the button cancel label style | | textButtonConfirm | Customize the button confirm label style | | title | Customize the title text style | | message | Customize the message text style |

Example of custom style object

  const customStyle = {
    container: {
      backgroundColor: '#e8e8e8',
      borderRadius: 0,
    },
    buttonCancel: {
      backgroundColor: '#b51919',
      borderRadius: 0,
    },
    buttonConfirm: {
      backgroundColor: '#4490c7',
      borderRadius: 0,
    },
    textButtonCancel: {
        color: '#fff',
        fontWeight: 'bold'
    },
    textButtonConfirm: {
        color: '#fff',
        fontWeight: 'bold'
    },
    title: {
      color: '#003d69',
      fontSize: 15
    },
    message: {
      color: '#4f4f4f',
      fontSize: 12
    }
  }

Example App

You can download example app from Example App this link

Author

By Alan Ribeiro

If you think the project is useful, please donate or give me a star!

paypal

License

MIT