带嵌套Popover的react-bootstrap OverlayTrigger无法正常工作react 16

时间:2019-01-11 22:11:21

标签: reactjs react-bootstrap react-16

我正在尝试将我的React应用程序升级到16+。我正在将React-bootstrap与带有CustomPopover的OverlayTrigger一起使用,这只是一个Popover元素。升级之前,一切正常。现在会弹出OverlayTrigger,但是当我单击CustomPopover中的链接时,模态不会出现。 this.state.showConstraintEditorModal正在更新为true,但没有任何渲染。这是相关代码:

            <OverlayTrigger
              ref={c => { this.overlayTrigger = c; }}
              rootClose
              trigger="click"
              placement="top"
              overlay={
                <CustomPopover>
                  <ul className="list-group">
                    <li className="list-group-item">
                      <Button bsStyle="link" id="btn-new-item-constraint" data-type="Item" onClick={this.newConstraint}>Item Constraint</Button>
                    </li>
                    <li className="list-group-item">
                      <Button bsStyle="link" id="btn-new-passage-constraint" data-type="Passage" onClick={this.newConstraint}>Passage Constraint</Button>
                    </li>
                  </ul>
                </CustomPopover>
            </OverlayTrigger>

     {constraint &&
        <Modal
          title="Constraint Editor"
          id="constraint-modal"
          bsSize="large"
          onHide={(e) => this.closeModal('showConstraintEditorModal', e)}
          show={this.state.showConstraintEditorModal}
          showModalFooter={false}
          keyboard
        >
          <p className="pull-right">Apply one or many attribute filters ( <i className="fa fa-filter text-primary" aria-hidden="true"></i> ) to narrow down your results in the table below.</p>

          <Tabs defaultActiveKey={1} id="item-pool-constraint-tabs">
            <Tab eventKey={1} title={this.state.constraintType === 'Item' ? 'Items' : 'Passages'}>
              <ConstraintTable
                filters={constraint.filters}
                headerTypes={this.state.constraintType === 'Item' ? itemHeaders : passageHeaders}
                data={this.state.constraintType === 'Item' ? items : passages}
                saveFilter={this.manageFilterState}
                afterColumnFilter={this.manageQualifiedObjects}
                defaultSortName={this.state.defaultSortName}
                disabled={status === 'f'}
                hiddenColumn={this.state.itemSequence}
              />

              <ConstraintBuilder
                handleClose={(e) => this.closeModal('showConstraintEditorModal')}
                parentHandleSubmit={this.saveConstraint}
                constraint={constraint}
                constraints={constraints}
                constraintId={this.state.constraintId}
                dataType={this.state.constraintType === 'Item' ? 'items' : 'passages'}
                disabled={status === 'f'}
              />
            </Tab>
          </Tabs>

        </Modal>

0 个答案:

没有答案