import React, { PropTypes, Component } from 'react'; import { Button } from 'react-bootstrap'; import Modal from 'react-modal'; const customStyles = { content : { position : 'absolute', top : '40px', left : '10%', right : '10%', bottom : '40px', border : '1px solid #ccc', background : '#fff', overflow : 'auto', WebkitOverflowScrolling : 'touch', borderRadius : '5px', outline : 'none', padding : '20px' } }; class ModalTrigger extends Component { constructor() { super(); this.openModal = this.openModal.bind(this); this.closeModal = this.closeModal.bind(this); this.state = { modalIsOpen: false }; } openModal() { this.setState({modalIsOpen: true}); } closeModal() { this.setState({modalIsOpen: false}); } getChildContext() { const component = this; return { closeCallback: component.closeModal }; } render() { const triggerComponent = React.cloneElement(this.props.component, { onClick: this.openModal }); return (