Modal will close automatically by clicking field on react-bootstrap@0.29.x
See original GitHub issueHi @AllenFang,
I am creating tables within react-bootstrap Tabs
.
In the table’s modal that appears for adding a new row, when I click on any field to insert data the modal just disappears, the table also disappears and the app freezes showing the grey layer.
At the click on the field in the modal, the Tab’s handleSelect()
is called (probably the select
event on the modal’s input field bubbles up to the Tab?) as it logs what I believe it is the event object itself.
This is my code:
var ReactBsTable = React.createClass({
render: function () {
return (
<BootstrapTable id="table" ref="table"
data={products}
insertRow={true}
striped={true}
hover={true}
deleteRow={true}
selectRow={selectRowProp}
exportCSV={true}
csvFileName={'table.csv'}
options={optionsObj}
>
<TableHeaderColumn
dataField="id"
isKey={true}
autoValue={true}>Product ID</TableHeaderColumn>
<TableHeaderColumn dataField="name">Product Name</TableHeaderColumn>
<TableHeaderColumn dataField="price">Product Price</TableHeaderColumn>
</BootstrapTable>
);
}
});
...
var Menu = React.createClass({
getInitialState: function () {
return {key: 2};
},
handleSelect: function (key) {
console.dir(key);
this.setState({key});
},
render: function () {
return (
<Tabs activeKey={this.state.key}
onSelect={this.handleSelect}
animation={false} >
<Tab eventKey={1} title="Tab 1" id="tab1">Tab 1 content</Tab>
<Tab eventKey={2} title="Tab 2" id="tab2">
<ReactBsTable />
</Tab>
<Tab eventKey={3} title="Tab 3" id="tab3">Tab 3 content</Tab>
</Tabs>
);
}
});
Do you have any suggestion? I am completely new to react so I apologize if it is just some trivial mistake. Thanks!
Issue Analytics
- State:
- Created 7 years ago
- Comments:18 (9 by maintainers)
Top Results From Across the Web
reactjs - Stop modal from closing on outside click
I have a password change screen and I need the Modal to ONLY close when clicking on the submit button. which only becomes...
Read more >How to Open and Close a React-Bootstrap Modal ...
To close the modal, simply call the handleClose() function inside the onLoginFormSubmit() function body.
Read more ><Modal/> Component - React-Bootstrap
A Callback fired when the close button is clicked. If used directly inside a Modal component, the onHide will automatically be propagated up...
Read more >Modal
Clicking on the modal “backdrop” will automatically close the modal. Bootstrap only supports one modal window at a time. Nested modals aren't supported...
Read more >Modal – Carbon Design System
x : The close x icon will close the dialog without submitting any data. ... Clicking outside the passive modal area will automatically...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi @AllenFang --thanks for this truly awesome library, and for getting back to me! I’ve figured out that setState was being called in an infinite loop in my parent component, which was causing the table to reload, and the modal to disappear.
@StefanoGitHub, sorry for lately reply. I’m not sure that
react-bootstrap
does bundlebootstrap.js
(It seems not), I’ll test it in near future. 😃 Thanks 👍