Skip to content

BUG: (at least on Android) RN-app crashes, freezes or loses connection to development server when device is roaming and roaming is disabled on device #15305

Closed
@Fonze

Description

@Fonze

Is this a bug report?

Yes

Have you read the Bugs section of the How to Contribute guide?

Yes

Environment

react-native-cli: 2.0.1
react-native: 0.46.2 (tested on 0.44.0 too)
node: 8.2.0
npm -v

  • Target Platform: Android
  • Development Operating System: Windows 10
  • Build tools: Only Android emulators relevant for this bug (tested on 7.1.1 x86 and 6.0 x86)

Steps to Reproduce

  1. Create new RN-project
  2. Run it on Android emulator (not sure if same problem happens on iOS, haven't had the opportunity to test)
  3. Test it responds correctly (double-R pretty much proves the app is working fine, buttons that do something are also viable testers)
  4. Go to the phone's settings and make sure Roaming is turned off
  5. Emulate roaming on the emulator (0.44.0 might crash at this point)
  6. Go to the app an try reloading (is either frozen and does nothing or informs that there is no connection to development server)
  7. If you get the red error screen and the app is not crashed/frozen you can set the emulator's data status back to 'Home' or enable roaming again and double-R will work again.

Expected Behavior

Roaming should just cut the connection if roaming is disabled. Although listening to connection on a native Android app (with roaming disabled) going from connected state to roaming just returns disconnected, but going from disconnected state to roaming makes the connection awkwardly connect and disconnect again, but nothing bad happens to the native app itself.

Native app tested with the code below:
`private class ConnectionChangeReceiver extends BroadcastReceiver {

    @Override
    public void onReceive(Context context, Intent intent) {
        ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
        NetworkInfo activeNetwork = connectivityManager.getActiveNetworkInfo();
        //from connected state to roaming returns 'false'
        //from disconnected state to roaming returns first 'true' and then runs again with 'false'
        System.out.println(activeNetwork != null && activeNetwork.isConnected());
    }
}`

Actual Behavior

At first I tested this bug on a 0.44.0 app with self-made native Android ConnectionChangeListener partially shown above. Every other connection change did what expected (emitted custom event through DeviceEventEmitter and brought up a popup on disconnect and made it disappear on connect) but roaming with roaming disabled has made the app freeze (completely unresponsive to any click, Ctrl+M or double-R) or crashed it completely.

Thought it was the listeners fault at first but after some digging I thought it might be a problem with just RN. After that I created a new project with 'react-native init'-command (having global version 0.46.2 so this test is with that) ran it and emulated roaming. The app doesn't crash or freeze, but on reload throws the red screen with 'Could not connect to development server'-error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions