fix(reat): fix tab currentHref when changing tabs, closes #21834 (#21835)

This commit is contained in:
Ely Lucas
2020-07-29 10:48:45 -06:00
committed by GitHub
parent 2eaab23f38
commit 74468ab797
2 changed files with 21 additions and 1 deletions

View File

@ -110,6 +110,7 @@ class IonTabBarUnwrapped extends React.PureComponent<InternalProps, IonTabBarSta
}
}
});
const { activeTab: prevActiveTab } = state;
if (activeTab && prevActiveTab) {
const prevHref = state.tabs[prevActiveTab].currentHref;
@ -121,7 +122,7 @@ class IonTabBarUnwrapped extends React.PureComponent<InternalProps, IonTabBarSta
originalRouteOptions: tabs[activeTab].originalRouteOptions,
currentRouteOptions: props.routeInfo?.routeOptions
};
if (props.routeInfo.routeAction === 'pop') {
if (props.routeInfo.routeAction === 'pop' && (activeTab !== prevActiveTab)) {
// If navigating back and the tabs change, set the prev tab back to its original href
tabs[prevActiveTab] = {
originalHref: tabs[prevActiveTab].originalHref,