Browse Source

[Glitch] Use withRouter for TabsBar

Port 61e6275781 to glitch-soc
closed-social-glitch-2
Thibaut Girka 6 years ago
committed by ThibG
parent
commit
76a3f373e3
1 changed files with 5 additions and 7 deletions
  1. +5
    -7
      app/javascript/flavours/glitch/features/ui/components/tabs_bar.js

+ 5
- 7
app/javascript/flavours/glitch/features/ui/components/tabs_bar.js View File

@ -1,6 +1,6 @@
import React from 'react';
import PropTypes from 'prop-types';
import { NavLink } from 'react-router-dom';
import { NavLink, withRouter } from 'react-router-dom';
import { FormattedMessage, injectIntl } from 'react-intl';
import { debounce } from 'lodash';
import { isUserTouching } from 'flavours/glitch/util/is_mobile';
@ -24,14 +24,12 @@ export function getLink (index) {
}
@injectIntl
export default class TabsBar extends React.Component {
static contextTypes = {
router: PropTypes.object.isRequired,
}
@withRouter
export default class TabsBar extends React.PureComponent {
static propTypes = {
intl: PropTypes.object.isRequired,
history: PropTypes.object.isRequired,
}
setRef = ref => {
@ -59,7 +57,7 @@ export default class TabsBar extends React.Component {
const listener = debounce(() => {
nextTab.removeEventListener('transitionend', listener);
this.context.router.history.push(to);
this.props.history.push(to);
}, 50);
nextTab.addEventListener('transitionend', listener);

Loading…
Cancel
Save