Commit a06153c
Use lazy TurboModule lookup for Clipboard in LogBoxInspector (#56199)
Summary:
Pull Request resolved: #56199
D95277489 added a Copy button to LogBoxInspector that imports
`Clipboard`, which calls `TurboModuleRegistry.getEnforcing('Clipboard')`
at module load time. In environments where the native Clipboard module
is not available (e.g., Fantom integration tests), this throws and
crashes the entire test file (`LogBox-itest.fb.js`).
Replace the static `Clipboard` import with a lazy
`TurboModuleRegistry.get()` call at invocation time, which returns
`null` when the module is unavailable instead of throwing.
Changelog: [internal][fixed][LogBox] - Fix crash when Clipboard module is unavailable
Reviewed By: NickGerleman
Differential Revision: D97008263
fbshipit-source-id: 5720ff8fdeb3f187aa7be77b13dc839c024697511 parent 0b1def9 commit a06153c
1 file changed
+3
-1
lines changedLines changed: 3 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
12 | 11 | | |
13 | 12 | | |
14 | 13 | | |
| |||
98 | 97 | | |
99 | 98 | | |
100 | 99 | | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
101 | 103 | | |
102 | 104 | | |
103 | 105 | | |
| |||
0 commit comments