React:React-bootstrap模式不工作在10

问题描述 投票:0回答:1

使用React-Bootstrap,我有一个有条件地打开的模态。模态在11中工作正常。

这是在ie11中工作的模态。

handleCloseAlert() {
  this.setState({ alertShow: false });
}

handleShowAlert() {
  this.setState({ alertShow: true });
}
noResults() {
  this.setState({alertShow:true})
}

<Modal show={this.state.alertShow} 
          onHide={this.handleCloseAlert}
          {...this.props}
          data-toggle="modal"
          size="sm"
          aria-labelledby="contained-modal-title-vcenter"
          centered>
          <Modal.Header closeButton>
            <Modal.Body>No results found</Modal.Body>
          </Modal.Header>
        </Modal>

当我在ie10中测试时,当模态打开时,屏幕变白。这是我在控制台中得到的错误..

[object Error]{description: "Unable to s...", message: "Unable to s...", name: "TypeError", number: -2146823281, stack:
Unhandled promise rejection TypeError: Unable to set property 'paddingRight' of undefined or null reference

我还使用Bootstrap代码测试,模态使用bootstrap网站上的示例代码。我想我可以使用他们的代码,但我无法确定如何有条件地打开和关闭模态。

以下是bootstrap的示例,该示例未针对条件反应呈现进行编码。

<!-- Button trigger modal -->
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#exampleModal">
  Launch demo modal
</button>

<!-- Modal -->
<div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title" id="exampleModalLabel">Modal title</h5>
        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
      <div class="modal-body">
        ...
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
        <button type="button" class="btn btn-primary">Save changes</button>
      </div>
    </div>
  </div>
</div>

我尝试将show={this.state.alertShow}添加到模态标记,但我在控制台中收到此错误。

Warning: Received `false` for a non-boolean attribute `show`.

If you want to write it to the DOM, pass a string instead: show="false" or show={value.toString()}.

If you used to conditionally omit it with show={condition && value}, pass show={condition ? value : undefined} instead.

有没有办法保留我当前的代码并使其与ie10一起使用?或者我需要在没有React-Bootstrap的情况下重新编码?

我的index.js里也有import 'react-app-polyfill/ie9';

reactjs bootstrap-modal internet-explorer-10 react-bootstrap
1个回答
0
投票

Modal正在使用新的react-bootstrap更新

© www.soinside.com 2019 - 2024. All rights reserved.