tajo / react-portal

🎯 React component for transportation of modals, lightboxes, loading bars... to document.body or else.
MIT License
2.14k stars 169 forks source link

openByClickOn Not Displaying The Button In v4 #230

Open padlock98 opened 4 years ago

padlock98 commented 4 years ago

Been trying to migrate from react-portal from v2 to v4, due to recent upgrade of React to 16.8.6.

Having problem with Portal, whereby support to load a button on openByClickOn (as shown below), but nothing appears. Is there any breaking changes on the usage of openByClickOn ?

      <Portal ref={c => this.findDialog = c} closeOnEsc openByClickOn={<div className="header-button" style={{background: `#78808B no-repeat center right`}}>FIND TICKET</div>} style={{width: '480px'}}>
        <DialogTitle style={{fontSize: '25px', color: 'black'}}>Find Ticket</DialogTitle>
        <DialogContent>
          <Field name="ticketNo" component={renderField} type="text" label="Ticket No." onKeyUp={() => this.setState({error: ''})}
                 style={{width: '100%'}}/>
          {this.state.error && <p style={{color: '#d50000'}}>{this.state.error}</p>}
        </DialogContent>
        <DialogActions>
          <Button type='button' onClick={handleSubmit(this.find.bind(this))} disabled={pristine || submitting}>Find</Button>
          <Button type='button' onClick={() => this.close()}>Close</Button>
        </DialogActions>
      </Portal>

Expected Result: To show a div button which can be clicked to launch a Dialog box.