Commit 1446900
SurfaceRegistryBinding: Display RedBox when RN$SurfaceRegistry isn't available
Summary:
SurfaceRegistryBinding::startSurface [checks whether global.RN$SurfaceRegistry binding is installed](https://www.internalfb.com/code/fbsource/[7040bef7d4fe43298c5f9dc1fef10f47ec396e79]/xplat/js/react-native-github/ReactCommon/react/renderer/uimanager/SurfaceRegistryBinding.cpp?lines=28-29). If not, control flow goes directly into the bridge path: [callFunctionOnModule](https://www.internalfb.com/code/fbsource/[7040bef7d4fe43298c5f9dc1fef10f47ec396e79]/xplat/js/react-native-github/ReactCommon/react/renderer/uimanager/SurfaceRegistryBinding.cpp?lines=40-46). callMethodOfModule [react_native_asserts, if the requested callable JS module isn't available](https://www.internalfb.com/code/fbsource/[7040bef7d4fe43298c5f9dc1fef10f47ec396e79]/xplat/js/react-native-github/ReactCommon/react/renderer/uimanager/bindingUtils.cpp?lines=29) on the batched bridge. This crashes the app.
We could make this error experience better:
1. We shouldn't crash the app.
2. We should fail fast, and produce an error message that is more descriptive of the actual cause of the error.
3. We can leverage the RedBox infra to display this error on the screen.
## Fixes
This diff modifies the gating inside SurfaceRegistryBinding. Now, in bridgeless mode, if global.RN$SurfaceRegistry isn't instaled, we'll display a RedBox instead, that shows what the error is.
Changelog: [Internal]
Reviewed By: sshic
Differential Revision: D37223640
fbshipit-source-id: 8fbf57f5d9cf359046dc94f0a5f7d66624caee4e1 parent e47d04b commit 1446900
File tree
1 file changed
+28
-8
lines changed- ReactCommon/react/renderer/uimanager
1 file changed
+28
-8
lines changedLines changed: 28 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
32 | 31 | | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
33 | 41 | | |
34 | 42 | | |
35 | 43 | | |
| |||
58 | 66 | | |
59 | 67 | | |
60 | 68 | | |
61 | | - | |
62 | | - | |
63 | | - | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
64 | 81 | | |
65 | 82 | | |
66 | 83 | | |
| |||
83 | 100 | | |
84 | 101 | | |
85 | 102 | | |
86 | | - | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
87 | 107 | | |
88 | 108 | | |
89 | 109 | | |
| |||
0 commit comments