-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
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
Event onChange on Tabs never fired... (onTouchTap never fired on tab button) #3465
Comments
Ha, something to precise. When the state change, the tab is changing well, as well as the content.
But I can't make it works with a mouse click... Any idea ? |
Could you try reproducing this with values of 1 and 2 instead of 0 and 1? It might be caused by falsy values. if so it's a bug! 🪲 |
I've tried but it's the same... It's not caused by falsy values... |
@damienfa For now you can do use this workaround: export default class TabsExample extends React.Component {
constructor(props) {
super(props);
this.state = {
slideIndex: 0,
};
}
handleChange = (value) => {
console.log("Tab is changing to ",value);
this.setState({
slideIndex: value,
});
};
render() {
return (
<Tabs value={this.state.slideIndex}>
<Tab label="First Tab" value={0} onActive={() => this.handleChange(0) } >
<div>CONTENT 1</div>
</Tab>
<Tab label="Second Tab" value={1} onActive={() => this.handleChange(1) }>
<div>CONTENT 2</div>
</Tab>
</Tabs>
)
}
} I hope this works out for you. If it does don't close this issue. We should fix onChange! |
Thanks for your answer... but, no, it doesn't change nothing... |
I see... any chance you aren't injecting the |
hohoho... 😰 I missed that ! and it solves my problem ! |
We've had looooong discussions for this. It proves to be harder than it seems 😢 I'm glad your issue is resolved. we'll do our best to provide some sort of warning when the plugin isn't injected. 👍 |
To ease some pain: The react tap plugin was just updated to v1.0.0. It only works with react > 15. In order to use version 1 you need to update your react as well otherwise tabs will not work. |
And if upgrading to React 15 is not an option at this time, depending on |
(I use material-ui@^0.14.4)
I just come to copy this example from your doc (http://www.material-ui.com/#/components/tabs) to my app.
I have no error in the console and neither the "console.log".
When I click on a Tab, the ripple animation works fine, but the selection is never changing. I'm stuck on the first tab.
Have I made something wrong ? Or there is a bug ?
Thanks !
The text was updated successfully, but these errors were encountered: