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;

Package Sidebar

Install

npm i react-bootstrap-prompt

Weekly Downloads

4

Version

1.0.1

License

MIT

Last publish

Collaborators

  • jackong