webyonet / react-native-android-location-services-dialog-box

React Native Android Location Services Dialog Box
MIT License
182 stars 50 forks source link

Don't close dialog box if clicked on android back button #26

Closed rhenmark closed 7 years ago

rhenmark commented 7 years ago

Thank you for this package. this is great. But, it is possible not to close the dialog box if I click the close back? Could you help me how to implement it?

webyonet commented 7 years ago

please update v2.2.1

Then implement the following code:

import { BackHandler } from 'react-native';
import LocationServicesDialogBox from "react-native-android-location-services-dialog-box";

componentWillMount(){
   BackHandler.addEventListener('hardwareBackPress', () => {
      LocationServicesDialogBox.forceCloseDialog();
   });  
}
rhenmark commented 7 years ago

hello sir. thank you for the implementation , yet the dialog box still closes when I clicked back button. Is it possible to add a tag like cancelable to false in dialog?

webyonet commented 7 years ago

Write the code below to not close it:

BackHandler.addEventListener('hardwareBackPress', () => {
      return false;
});
rhenmark commented 7 years ago

Thank you. But is it possible to turn on location services without going to the settings?

webyonet commented 7 years ago

no. you can use a different module