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.
@EloB Please provide the issue template
I think the problem is in react-router. The <Link /> doesn't use onTouchTap property. Made some small hacks to it and got it to work but react-router but they won't support react-tap-event-plugin. https://github.com/reactjs/react-router/issues/1795
So I wonder how we could fix this 馃槃
@EloB - will onActive not work for your use case?
(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.
npm install the packages you needindex.js file fill template belowbrowserify on that index.js fileTemplate
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 onTouchTap. Chrome does work great, however.
+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 next branch is not longer affected by that issue.
Most helpful comment
Updated monkey patch that does work with touch devices... Ugly but works perfect!