mirror of
https://github.com/ecency/ecency-mobile.git
synced 2024-12-19 19:31:54 +03:00
Merge pull request #2389 from ecency/sa/back-nav-bug
Bug Fix: back button exiting/minimizing app
This commit is contained in:
commit
6070de48b2
@ -1,3 +1,4 @@
|
|||||||
|
import { BackHandler } from 'react-native';
|
||||||
import { NavigationActions } from 'react-navigation';
|
import { NavigationActions } from 'react-navigation';
|
||||||
|
|
||||||
let _navigator;
|
let _navigator;
|
||||||
@ -24,6 +25,17 @@ const navigate = (navigationProps) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const navigateBack = () => {
|
||||||
|
if (_navigator) {
|
||||||
|
const { index } = _navigator.state.nav.routes[0];
|
||||||
|
if (index) {
|
||||||
|
_navigator.dispatch(NavigationActions.back());
|
||||||
|
} else {
|
||||||
|
BackHandler.exitApp();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// add other navigation functions that you need and export them
|
// add other navigation functions that you need and export them
|
||||||
|
|
||||||
export { navigate, setTopLevelNavigator };
|
export { navigate, setTopLevelNavigator, navigateBack };
|
||||||
|
@ -49,7 +49,7 @@ import {
|
|||||||
getUnreadNotificationCount,
|
getUnreadNotificationCount,
|
||||||
} from '../../../providers/ecency/ecency';
|
} from '../../../providers/ecency/ecency';
|
||||||
import { fetchLatestAppVersion } from '../../../providers/github/github';
|
import { fetchLatestAppVersion } from '../../../providers/github/github';
|
||||||
import { navigate } from '../../../navigation/service';
|
import { navigate, navigateBack } from '../../../navigation/service';
|
||||||
|
|
||||||
// Actions
|
// Actions
|
||||||
import {
|
import {
|
||||||
@ -566,14 +566,15 @@ class ApplicationContainer extends Component {
|
|||||||
};
|
};
|
||||||
|
|
||||||
_onBackPress = () => {
|
_onBackPress = () => {
|
||||||
|
navigateBack();
|
||||||
|
/*
|
||||||
const { dispatch, nav } = this.props;
|
const { dispatch, nav } = this.props;
|
||||||
|
|
||||||
if (nav && nav[0].index !== 0) {
|
if (nav && nav[0].index !== 0) {
|
||||||
dispatch(NavigationActions.back());
|
dispatch(NavigationActions.back());
|
||||||
} else {
|
} else {
|
||||||
BackHandler.exitApp();
|
BackHandler.exitApp();
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -127,7 +127,7 @@ const TransferView = ({
|
|||||||
|
|
||||||
<KeyboardAwareScrollView
|
<KeyboardAwareScrollView
|
||||||
keyboardShouldPersistTaps
|
keyboardShouldPersistTaps
|
||||||
contentContainerStyle={[styles.grow, { padding: 16 }]}
|
contentContainerStyle={[styles.grow, styles.keyboardAwareScrollContainer]}
|
||||||
>
|
>
|
||||||
<View style={styles.container}>
|
<View style={styles.container}>
|
||||||
<TransferAccountSelector
|
<TransferAccountSelector
|
||||||
|
@ -5,6 +5,10 @@ export default EStyleSheet.create({
|
|||||||
flex: 1,
|
flex: 1,
|
||||||
backgroundColor: '$primaryBackgroundColor',
|
backgroundColor: '$primaryBackgroundColor',
|
||||||
},
|
},
|
||||||
|
keyboardAwareScrollContainer: {
|
||||||
|
backgroundColor: '$primaryBackgroundColor',
|
||||||
|
padding: 16,
|
||||||
|
},
|
||||||
stepOneContainer: {
|
stepOneContainer: {
|
||||||
zIndex: 2,
|
zIndex: 2,
|
||||||
paddingVertical: 16,
|
paddingVertical: 16,
|
||||||
|
Loading…
Reference in New Issue
Block a user