Added toHome prop to BackButton
• Added: - toHome prop to BackButton
This commit is contained in:
parent
7de58b5bf5
commit
2316494f58
@ -12,10 +12,11 @@ export default class BackButton extends PureComponent {
|
|||||||
icon: PropTypes.string,
|
icon: PropTypes.string,
|
||||||
iconClassName: PropTypes.string,
|
iconClassName: PropTypes.string,
|
||||||
iconSize: PropTypes.string,
|
iconSize: PropTypes.string,
|
||||||
|
toHome: PropTypes.bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
historyBack = () => {
|
historyBack = () => {
|
||||||
if (window.history && window.history.length === 1) {
|
if (window.history && window.history.length === 1 || this.props.toHome) {
|
||||||
this.context.router.history.push('/home')
|
this.context.router.history.push('/home')
|
||||||
} else {
|
} else {
|
||||||
this.context.router.history.goBack()
|
this.context.router.history.goBack()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user