-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ToggleButtonGroup onChange does not work in version 0.31.1 #2734
Comments
FWIW:
works totally fine on https://react-bootstrap.github.io/components.html |
Right. And in fact your specific example works just fine as well as: class AppointmentModalDemo extends React.Component {
constructor(props) {
super(props);
this.isAppMade = this.isAppMade.bind(this);
}
isAppMade(vals) {
console.log(vals);
}
render() {
return (
<div className="appointment-modal">
<ToggleButtonGroup
type="radio"
name="appointmentMade"
onChange={this.isAppMade}>
<ToggleButton value={1}>Yes</ToggleButton>
<ToggleButton value={2}>No</ToggleButton>
</ToggleButtonGroup>
</div>
);
}
}
ReactDOM.render(<AppointmentModalDemo />, mountNode); There's nothing we can do here without a repro. |
... am I missing some JavaScript on my site, then? Do I need to be including something other than react-bootstrap? |
No, it may be related to a bug with uncontrolled radios/checkbox in React 15.6 though, they tend to not fire change events correctly 😳 |
For the record, I'm on React 15.6.1; are you recommending rolling back to 15.5? |
or controlling your radios. I'm just trying to say you may be running into a React bug not a react-bootstrap one |
I went to 15.5.4 - no improvement. I'm working on publishing a demo of this bug |
I'm sure it could be a React bug, but since I'm not doing anything particularly weird with |
Created a gist here: https://gist.github.com/dancrumb/292ae9ecc3b362a76edcb3414ff3b45a Here's the demo: https://demo.ohanapediatrics.com/bug-demo.html |
Try throwing up a CodeSandbox/CodePen/JSFiddle/&c. |
Problem solved. I was including Tagging @ForwardLabs in case this is their problem too. |
I am not including |
Echoing @corellian comment - we're not including |
We're still debug this issue, but it appears that the |
Didn't debug it, however on webpackbin with same versions of the packages, onChange does work. Inside our app, however, it doesn't. I used a workaround by passing an onClick handler to the individual ToggleButton's instead. |
Same problem here with |
Still have the issue with React 15.5.4. Anyone else? |
Yes, I have the problem with React 15.5.4. What is the best option - installing a onClick handler on the individual ToggleButtons? |
Seeing the same with:
Also the case with 4.0 beta of bootstrap. |
Having the same problem
Has anyone found a workaround to trigger onChange()? |
If anyone can post a functional reproduction in codesandbox or similar we would be happy to help y'all but there is not we can do with out one |
Good news for react & react-bootstrap, bad news for the rest of us: I reproduced the use case with CodePen and everything seems to be working fine https://codepen.io/alexschilpp/pen/PJwdxX. So far I'm quite clueless. Looks like another library is interfering and causing the trouble. |
Found the issue, the problem occurs when bootstrap js file included. |
@kamote That was it, thanks! Now to convert all Bootstrap JS elements on my site to use react-bootstrap... |
So what is the work around? Can I disable the js file just for my react components? |
See arian-swydo commented on Aug 7 above. that worked fine for me. |
|
|
Don't include the Bootstrap JS. React-Bootstrap already takes care of wiring things up. |
Need to put an ID for each input, then it is working fine |
This is the same issue as #2727... I'm not sure why that was closed so quickly.
On Chrome Version 59.0.3071.115, the
onChange
handler of aToggleButtonGroup
just isn't being called.Here's my example:
I would expect something to be dumped on the console each time I press a button, but I'm getting nothing.
The text was updated successfully, but these errors were encountered: