mirror of
https://github.com/ecency/ecency-mobile.git
synced 2024-11-24 08:55:14 +03:00
Merge pull request #229 from esteemapp/bugfix/android-back-button
Fixed #189
This commit is contained in:
commit
de86f45640
@ -1,9 +1,10 @@
|
||||
import React, { Component } from 'react';
|
||||
import { Platform } from 'react-native';
|
||||
import { Platform, BackHandler } from 'react-native';
|
||||
import { connect } from 'react-redux';
|
||||
import { addLocaleData } from 'react-intl';
|
||||
import Config from 'react-native-config';
|
||||
import AppCenter from 'appcenter';
|
||||
import { NavigationActions } from 'react-navigation';
|
||||
|
||||
// Constants
|
||||
import en from 'react-intl/locale-data/en';
|
||||
@ -54,6 +55,7 @@ class ApplicationContainer extends Component {
|
||||
}
|
||||
|
||||
componentDidMount = async () => {
|
||||
BackHandler.addEventListener('hardwareBackPress', this._onBackPress);
|
||||
await this._getUserData();
|
||||
this._getSettings();
|
||||
};
|
||||
@ -66,6 +68,17 @@ class ApplicationContainer extends Component {
|
||||
}
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
BackHandler.removeEventListener('hardwareBackPress', this.onBackPress);
|
||||
}
|
||||
|
||||
_onBackPress = () => {
|
||||
const { dispatch } = this.props;
|
||||
|
||||
dispatch(NavigationActions.back());
|
||||
return true;
|
||||
};
|
||||
|
||||
_getUserData = async () => {
|
||||
const { dispatch } = this.props;
|
||||
let realmData;
|
||||
|
Loading…
Reference in New Issue
Block a user