-
-
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
[Tabs] and containerElement with Link click issue #3997
Comments
@EloB Please provide the issue template |
I think the problem is in |
@EloB - will (Also what was your process to get that bundle? Neat! |
@mbrookes Thanks! I've created a private webservice that I probably will publish soon but the process is pretty easy.
Template require('the');
require('package');
require('you');
require('need');
global.require = require; Please create a lightweight jsfiddle template so people can fork and easier make bug reports and add that to contribute guide. |
Here is my monkey patch workaround... In the initial file that bootstrap everything just import this snippet. This actually works but I would love to see a non monkey patch solution for this 😄 index.js // The first thing that happends in your app
import './monkey-patch-link';
// Rest of your app code monkey-patch-link.js // Look in comment below |
Updated monkey patch that does work with touch devices... Ugly but works perfect! import React, { Component, PropTypes } from 'react';
const ReactRouter = require('react-router');
const { Link } = ReactRouter;
class MonkeyPatchLink extends Component {
static contextTypes = {
router: PropTypes.object,
};
static propTypes = {
onTouchTap: PropTypes.func,
onClick: PropTypes.func,
};
constructor(...args) {
super(...args);
this.handleTouchTap = this.handleTouchTap.bind(this);
this.handleClick = this.handleClick.bind(this);
}
handleTouchTap(e) {
if (this.props.onTouchTap) {
this.props.onTouchTap(e);
}
if ('button' in e.nativeEvent === false) {
// If touch event
e.nativeEvent.button = 0;
}
Link.prototype.handleClick.call(this, e.nativeEvent);
}
handleClick(e) {
if (this.props.onClick) {
this.props.onClick(e);
}
e.preventDefault();
}
render() {
return (
<Link {...this.props} onClick={this.handleClick} onTouchTap={this.handleTouchTap} />
);
}
}
ReactRouter.Link = MonkeyPatchLink; |
I'm running into this same issue on iOS with |
+1 |
I am using tab onActive and push the browser history according to tab.props.index not the best solution but works on every browser. |
I'm closing that issue as quite old now. Hopefully the Tab component on the |
Problem Description
Must double click on the tab else it won't show the new tab content. Works as expected in Chrome but not in Safari and Firefox.
Versions
The text was updated successfully, but these errors were encountered: