Upgrade react-router-dom to v5.3
This commit is contained in:
@@ -6,7 +6,7 @@ import React from 'react';
|
||||
import ImmutablePropTypes from 'react-immutable-proptypes';
|
||||
import ImmutablePureComponent from 'react-immutable-pure-component';
|
||||
import { defineMessages, FormattedMessage } from 'react-intl';
|
||||
import { Link } from 'react-router-dom';
|
||||
import { Link, withRouter } from 'react-router-dom';
|
||||
import { length } from 'stringz';
|
||||
|
||||
import Icon from 'soapbox/components/icon';
|
||||
@@ -45,16 +45,13 @@ const messages = defineMessages({
|
||||
schedule: { id: 'compose_form.schedule', defaultMessage: 'Schedule' },
|
||||
});
|
||||
|
||||
export default class ComposeForm extends ImmutablePureComponent {
|
||||
export default @withRouter
|
||||
class ComposeForm extends ImmutablePureComponent {
|
||||
|
||||
state = {
|
||||
composeFocused: false,
|
||||
}
|
||||
|
||||
static contextTypes = {
|
||||
router: PropTypes.object,
|
||||
};
|
||||
|
||||
static propTypes = {
|
||||
intl: PropTypes.object.isRequired,
|
||||
text: PropTypes.string.isRequired,
|
||||
@@ -155,7 +152,7 @@ export default class ComposeForm extends ImmutablePureComponent {
|
||||
return;
|
||||
}
|
||||
|
||||
this.props.onSubmit(this.context.router ? this.context.router.history : null, this.props.group);
|
||||
this.props.onSubmit(this.props.history ? this.props.history : null, this.props.group);
|
||||
}
|
||||
|
||||
onSuggestionsClearRequested = () => {
|
||||
|
||||
@@ -19,10 +19,6 @@ const messages = defineMessages({
|
||||
export default @injectIntl
|
||||
class ReplyIndicator extends ImmutablePureComponent {
|
||||
|
||||
static contextTypes = {
|
||||
router: PropTypes.object,
|
||||
};
|
||||
|
||||
static propTypes = {
|
||||
status: ImmutablePropTypes.map,
|
||||
onCancel: PropTypes.func.isRequired,
|
||||
|
||||
@@ -2,6 +2,7 @@ import classNames from 'classnames';
|
||||
import PropTypes from 'prop-types';
|
||||
import React from 'react';
|
||||
import { defineMessages, injectIntl } from 'react-intl';
|
||||
import { withRouter } from 'react-router-dom';
|
||||
|
||||
import AutosuggestAccountInput from 'soapbox/components/autosuggest_account_input';
|
||||
import Icon from 'soapbox/components/icon';
|
||||
@@ -11,13 +12,9 @@ const messages = defineMessages({
|
||||
action: { id: 'search.action', defaultMessage: 'Search for “{query}”' },
|
||||
});
|
||||
|
||||
export default @injectIntl
|
||||
export default @injectIntl @withRouter
|
||||
class Search extends React.PureComponent {
|
||||
|
||||
static contextTypes = {
|
||||
router: PropTypes.object.isRequired,
|
||||
};
|
||||
|
||||
static propTypes = {
|
||||
value: PropTypes.string.isRequired,
|
||||
submitted: PropTypes.bool,
|
||||
@@ -30,6 +27,7 @@ class Search extends React.PureComponent {
|
||||
autoFocus: PropTypes.bool,
|
||||
autosuggest: PropTypes.bool,
|
||||
intl: PropTypes.object.isRequired,
|
||||
history: PropTypes.object.isRequired,
|
||||
};
|
||||
|
||||
static defaultProps = {
|
||||
@@ -57,7 +55,7 @@ class Search extends React.PureComponent {
|
||||
this.props.onSubmit();
|
||||
|
||||
if (this.props.openInRoute) {
|
||||
this.context.router.history.push('/search');
|
||||
this.props.history.push('/search');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,7 +81,7 @@ class Search extends React.PureComponent {
|
||||
const { onSelected } = this.props;
|
||||
|
||||
if (onSelected) {
|
||||
onSelected(accountId, this.context.router.history);
|
||||
onSelected(accountId, this.props.history);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ import ImmutablePropTypes from 'react-immutable-proptypes';
|
||||
import ImmutablePureComponent from 'react-immutable-pure-component';
|
||||
import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
|
||||
import spring from 'react-motion/lib/spring';
|
||||
import { withRouter } from 'react-router-dom';
|
||||
|
||||
import Blurhash from 'soapbox/components/blurhash';
|
||||
import Icon from 'soapbox/components/icon';
|
||||
@@ -51,13 +52,9 @@ const messages = defineMessages({
|
||||
delete: { id: 'upload_form.undo', defaultMessage: 'Delete' },
|
||||
});
|
||||
|
||||
export default @injectIntl
|
||||
export default @injectIntl @withRouter
|
||||
class Upload extends ImmutablePureComponent {
|
||||
|
||||
static contextTypes = {
|
||||
router: PropTypes.object,
|
||||
};
|
||||
|
||||
static propTypes = {
|
||||
media: ImmutablePropTypes.map.isRequired,
|
||||
intl: PropTypes.object.isRequired,
|
||||
@@ -65,6 +62,7 @@ class Upload extends ImmutablePureComponent {
|
||||
onDescriptionChange: PropTypes.func.isRequired,
|
||||
onOpenFocalPoint: PropTypes.func.isRequired,
|
||||
onSubmit: PropTypes.func.isRequired,
|
||||
history: PropTypes.object.isRequired,
|
||||
};
|
||||
|
||||
state = {
|
||||
@@ -81,7 +79,7 @@ class Upload extends ImmutablePureComponent {
|
||||
|
||||
handleSubmit = () => {
|
||||
this.handleInputBlur();
|
||||
this.props.onSubmit(this.context.router.history);
|
||||
this.props.onSubmit(this.props.history);
|
||||
}
|
||||
|
||||
handleUndoClick = e => {
|
||||
|
||||
Reference in New Issue
Block a user