SIGN IN SIGN UP
facebook / react-native UNCLAIMED

A framework for building native applications using React

0 0 0 C++

Don't redbox on startup if Metro is not running

Summary:
This fixes a problem that occurs when:

1. You run an Android app with Fast Refresh on
2. Kill the app
3. Start the app again

We used to redbox (on Android only). This is probably because we are missing some check on the native side, and we try to enable the socket anyway.

We could potentially fix this on the native side. But also, there's no good reason why this code needs to ever throw an error if Fast Refresh is disabled.

So I'm unifying it with the existing code path for other Fast Refresh errors. They are ignored when it's off, shown as yellowboxes when it's on, and shown as redboxes if you intentionally try to turn it off and on again.

I'm also adding core to prevent logging more than one Fast Refresh warning. Since they're not super actionable and usually indicate the same problem (e.g. Metro not running). The earliest one wins.

Reviewed By: rickhanlonii

Differential Revision: D16286232

fbshipit-source-id: bf3960f11c767a2352b1282d46950e4ba9e5031d
D
Dan Abramov committed
8e6f2f289b1fda0062d429e527bf5f2e28f9099c
Parent: e9640ae
Committed by Facebook Github Bot <facebook-github-bot@users.noreply.github.com> on 7/17/2019, 1:29:25 PM