mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Show RedBox when reloads fail
Summary: When reloads fail, React Native currently just renders a blank screen. We should provde some sort of feedback to the developer. Hence, this diff makes the RedBox show up. Changelog: [Internal] Reviewed By: mdvacca Differential Revision: D48335851 fbshipit-source-id: 0681cd40f8c83960f9133853481013765634f5cf
This commit is contained in:
committed by
Facebook GitHub Bot
parent
80b665966f
commit
606a92f0b3
+18
-7
@@ -443,16 +443,27 @@ public class ReactHostImpl implements ReactHost {
|
||||
if (ReactFeatureFlags.enableBridgelessArchitectureNewCreateReloadDestroy) {
|
||||
return Task.call(
|
||||
() -> {
|
||||
Task<Void> reloadTask = null;
|
||||
if (mDestroyTask != null) {
|
||||
log(
|
||||
method,
|
||||
"Destroying React Native. Waiting for destroy to finish, before reloading React Native.");
|
||||
return mDestroyTask
|
||||
.continueWithTask(task -> newGetOrCreateReloadTask(reason), mBGExecutor)
|
||||
.makeVoid();
|
||||
log(method, "Waiting for destroy to finish, before reloading React Native.");
|
||||
reloadTask =
|
||||
mDestroyTask
|
||||
.continueWithTask(task -> newGetOrCreateReloadTask(reason), mBGExecutor)
|
||||
.makeVoid();
|
||||
} else {
|
||||
reloadTask = newGetOrCreateReloadTask(reason).makeVoid();
|
||||
}
|
||||
|
||||
return newGetOrCreateReloadTask(reason).makeVoid();
|
||||
return reloadTask.continueWithTask(
|
||||
task -> {
|
||||
if (task.isFaulted()) {
|
||||
mReactHostDelegate.handleInstanceException(task.getError());
|
||||
return newGetOrCreateDestroyTask("Reload failed", task.getError());
|
||||
}
|
||||
|
||||
return task;
|
||||
},
|
||||
mBGExecutor);
|
||||
},
|
||||
mBGExecutor)
|
||||
.continueWithTask(Task::getResult);
|
||||
|
||||
Reference in New Issue
Block a user