fix ongoing playback when back button pressed
This commit is contained in:
parent
f2b0d3417b
commit
8f28aed662
2 changed files with 8 additions and 4 deletions
|
@ -737,8 +737,8 @@ class FilePage extends React.PureComponent {
|
|||
};
|
||||
|
||||
onBackButtonPressed = () => {
|
||||
const { navigation, drawerStack, popDrawerStack } = this.props;
|
||||
navigateBack(navigation, drawerStack, popDrawerStack);
|
||||
const { navigation, drawerStack, popDrawerStack, setPlayerVisible } = this.props;
|
||||
navigateBack(navigation, drawerStack, popDrawerStack, setPlayerVisible);
|
||||
};
|
||||
|
||||
onOpenFilePressed = () => {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { NavigationActions, StackActions } from 'react-navigation';
|
||||
import { buildURI, isURIValid, normalizeURI } from 'lbry-redux';
|
||||
import { Lbryio } from 'lbryinc';
|
||||
import { doPopDrawerStack, doPushDrawerStack } from 'redux/actions/drawer';
|
||||
import { doPopDrawerStack, doPushDrawerStack, doSetPlayerVisible } from 'redux/actions/drawer';
|
||||
import Constants, { DrawerRoutes, InnerDrawerRoutes } from 'constants'; // eslint-disable-line node/no-deprecated-api
|
||||
|
||||
const tagNameLength = 10;
|
||||
|
@ -151,7 +151,7 @@ export function navigateToUri(navigation, uri, additionalParams, isNavigatingBac
|
|||
}
|
||||
}
|
||||
|
||||
export function navigateBack(navigation, drawerStack, popDrawerStack) {
|
||||
export function navigateBack(navigation, drawerStack, popDrawerStack, setPlayerVisible) {
|
||||
if (drawerStack[drawerStack.length - 1].route === Constants.DRAWER_ROUTE_FILE_VIEW) {
|
||||
// inner file_view (web / image view) is handled differently
|
||||
if (popDrawerStack) {
|
||||
|
@ -163,6 +163,9 @@ export function navigateBack(navigation, drawerStack, popDrawerStack) {
|
|||
if (popDrawerStack) {
|
||||
popDrawerStack();
|
||||
}
|
||||
if (setPlayerVisible) {
|
||||
setPlayerVisible(false);
|
||||
}
|
||||
|
||||
const target = drawerStack[drawerStack.length > 1 ? drawerStack.length - 2 : 0];
|
||||
const { route, params } = target;
|
||||
|
@ -198,6 +201,7 @@ export function dispatchNavigateBack(dispatch, nav, drawerStack) {
|
|||
}
|
||||
|
||||
dispatch(doPopDrawerStack());
|
||||
dispatch(doSetPlayerVisible(false));
|
||||
|
||||
const target = drawerStack[drawerStack.length > 1 ? drawerStack.length - 2 : 0];
|
||||
const { route } = target;
|
||||
|
|
Loading…
Reference in a new issue