mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-02-09 17:13:46 +08:00
Don't insta-crash when network permission is missing
Summary: public Rename the `ConnectivityModule` to `NetInfoModule` (there's no need to name things differently in two places). Add exception handling to the module in case the network permission is missing. When the permission is missing, throw an actionable error from all calls to `NetInfo`: http://imgur.com/zVIMxOV Without this change, the app immediately crashes on startup: `getCurrentConnectionType` is called from `Activity.onResume`. Reviewed By: andreicoman11, bestander Differential Revision: D2749230 fb-gh-sync-id: 1b752d21a8f28ffeaf60a3322cb76f869dc70a14
This commit is contained in:
committed by
facebook-github-bot-7
parent
4b800e6ce1
commit
f168fc335e
@@ -20,7 +20,7 @@ import com.facebook.react.bridge.ReactApplicationContext;
|
||||
import com.facebook.react.modules.fresco.FrescoModule;
|
||||
import com.facebook.react.modules.intent.IntentModule;
|
||||
import com.facebook.react.modules.location.LocationModule;
|
||||
import com.facebook.react.modules.netinfo.ConnectivityModule;
|
||||
import com.facebook.react.modules.netinfo.NetInfoModule;
|
||||
import com.facebook.react.modules.network.NetworkingModule;
|
||||
import com.facebook.react.modules.storage.AsyncStorageModule;
|
||||
import com.facebook.react.modules.toast.ToastModule;
|
||||
@@ -57,7 +57,7 @@ public class MainReactPackage implements ReactPackage {
|
||||
new IntentModule(reactContext),
|
||||
new LocationModule(reactContext),
|
||||
new NetworkingModule(reactContext),
|
||||
new ConnectivityModule(reactContext),
|
||||
new NetInfoModule(reactContext),
|
||||
new WebSocketModule(reactContext),
|
||||
new ToastModule(reactContext));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user