react-bootstrap-prompt

1.0.1 • Public • Published

react-bootstrap-prompt

prompt dialog for react with bootstrap modal.

Examples

import React, { PropTypes } from 'react'
import Prompt from 'react-bootstrap-prompt'
 
class App extends React.Component {
    componentDidMount() {
        this.refs.prompt
        .show('please enter your reason')
        .then(() => {
            //after sure
        })
        .catch(() => {
            //after cancel
        })
    }
    render () {
        return (
            <div>
                <Prompt.Component ref='prompt' sure='Submit' cancel='Cancel' />
                <Children/>
            </div>
        )
    }
}
 
class Children extends React.Component {
    onClick() {
        Prompt.Actions
        .show('please enter your reason')
        .then(() => {
            //after sure
        })
        .catch(() => {
            //after cancel
        })
    }
    render () {
        return (
            <div>
                <button onClick={this.onClick.bind(this)}>click</button>
            </div>
        )
    }
}
 
export default App;

/react-bootstrap-prompt/

    Package Sidebar

    Install

    npm i react-bootstrap-prompt

    Weekly Downloads

    25

    Version

    1.0.1

    License

    MIT

    Last publish

    Collaborators

    • jackong