question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Modal will close automatically by clicking field on react-bootstrap@0.29.x

See original GitHub issue

Hi @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:closed
  • Created 7 years ago
  • Comments:18 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
trishfromtischcommented, Jun 2, 2016

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.

0reactions
AllenFangcommented, Jun 4, 2016

@StefanoGitHub, sorry for lately reply. I’m not sure that react-bootstrap does bundle bootstrap.js(It seems not), I’ll test it in near future. 😃 Thanks 👍

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found