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

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

Pressing Cancel on Android crashes the app #78

Closed vialta closed 4 years ago

vialta commented 4 years ago

Pressing the cancel button when running on android will crash the app due to a map mismatch.

I've fixed it by replacing:

.setNegativeButton(configMap.getString("cancel"), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialogInterface, int id) { promise.reject(new Throwable("disabled")); dialogInterface.cancel(); } });

with the following:

.setNegativeButton(configMap.getString("cancel"), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialogInterface, int id) { WritableMap result = Arguments.createMap(); result.putString("status", "disabled"); result.putBoolean("enabled", false); promiseCallback.resolve(result); dialogInterface.cancel(); } }); in the native android code

webyonet commented 4 years ago

can you send pull request for this improvement?

vialta commented 4 years ago

I can send provided I have permission, or you can go ahead and change the methods in the LocationServicesDialogBoxModule file and put them in yourself

webyonet commented 4 years ago

open a new fork from the this project and you can send a pull request