6
6 개의 버튼이 있습니다.이 버튼을 클릭하면 모달이 활성화됩니다. 이것은 React에 쓰여 있습니다.반응 부트 스트랩 모달을 이스케이프 키로 닫습니다.
//Since I have 6 different modals, giving each of them an id would distinguish them
onCloseModal(id) {
this.setState({
open: false,
modalShown: id
})
}
render() {
return (
<Modal onHide={this.onCloseModal.bind(this, item.id)} keyboard={true}>
<Modal.Header closeButton={true} onHide={this.onCloseModal.bind(this)}>
</Modal.Header>
</Modal>
)
}
내가 keyboard={true}
을 가지고있는 모달를 종료 할 Esc 키를 눌러 https://react-bootstrap.github.io/components.html#modals-props의 설명서에 따라. 그러나 그것은 작동하지 않습니다. 내 버튼마다 고유 한 ID가 있기 때문에 모든 설정이 완료되었다고 생각합니다. 왜 이스케이프 키가 응답하지 않습니까?
다음은 작동중인 모달 이미지입니다.
죄송합니다'<모달 쇼 = {item.id === this.state.modalShown } onHide = {this.onCloseModal.bind (this, item.id)}>' – patrickhuang94
그러면 JSFiddle/JSBin을 제공 할 수 있습니까? 나는 당신의 문제를 재현 할 수 없다. –