New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

react-ios-alert

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-ios-alert

A alert tips for mobile web

latest
Source
npmnpm
Version
1.0.1
Version published
Maintainers
1
Created
Source

react-alert

Alert component imitated iOS build with react

Demo

You can find demo in folder example

demo

Usage with React

1、Install the package

npm install react-alert --save

2、Using as your need

// Example 1:

import React, { Component } from 'react'
import Alert from 'react-alert'

import 'react-ios-alert/dist/react-ios-alert.min.css'

class Main extends Component {
    state = {
        showAlert: false
    }
    render() {
        const alertOpt = {
                title: 'Alert',
                content: 'This is a demo!',
                confirmText: 'Yes',
                cancelText: 'Cancel',
                callback: function(){alert('yes callback called!')},
                cancelCallback: function(){alert('cancel callback called!')},
                close: this.hide.bind(this)
            };
        return (
            <div>
                {
                    !!this.state.showAlert && <Alert {...alertOpt} />
                }
                <button onClick={e=>this.show()}>click me to show Alert</button>
            </div>
        )
    }
    show() {
        this.setState({
            showAlert: true
        })
    }
    hide() {
        this.setState({
            showAlert: false
        })
    }
}

// Example 2:

import { SingleAlert } from 'react-alert'

// You can call SingleAlert.show anywhere and anytime, there will be only one Alert DOM node be added.

SingleAlert.show({
    content: 'Alert实例',
    confirmText: '知道了'
});

setTimeout(() => {
    SingleAlert.hide();
}, 3000)

Configuration

ParamTypeDescription
titlestringThe brief description of purpose
contentstring / JSXThe detail statement of purpose
confirmTextstringThe text in CONFIRM button
cancelTextstringThe text in CANCEL button
confirmAtRightboolThe CONFIRM is at the right of CANCEL button or not
callbackfunctionEvents called after CONFIRM button is clicked
cancelCallbackfunctionEvents called after CANCEL button is clicked
closefunctionUse container's method to close the Alert Dialog
useTapboolUse Tap event as default, not Click

License

Copyright(c) 2016-2017 AlloyTeam. Licensed under MIT license.

FAQs

Package last updated on 28 Dec 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts