This commit is contained in:
Mustafa Buyukcelebi 2018-12-12 16:22:44 +03:00
parent ce1301282d
commit 330786f459

View File

@ -1,9 +1,10 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import { Platform } from 'react-native'; import { Platform, BackHandler } from 'react-native';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { addLocaleData } from 'react-intl'; import { addLocaleData } from 'react-intl';
import Config from 'react-native-config'; import Config from 'react-native-config';
import AppCenter from 'appcenter'; import AppCenter from 'appcenter';
import { NavigationActions } from 'react-navigation';
// Constants // Constants
import en from 'react-intl/locale-data/en'; import en from 'react-intl/locale-data/en';
@ -54,6 +55,7 @@ class ApplicationContainer extends Component {
} }
componentDidMount = async () => { componentDidMount = async () => {
BackHandler.addEventListener('hardwareBackPress', this._onBackPress);
await this._getUserData(); await this._getUserData();
this._getSettings(); 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 () => { _getUserData = async () => {
const { dispatch } = this.props; const { dispatch } = this.props;
let realmData; let realmData;