| #
fb3e0f7c |
| 25-Aug-2020 |
Tomasz Sapeta <[email protected]> |
[ios] Fix DevMenu and RedBox behavior when TurboModules are enabled (#9906)
# Why
With TurboModules enabled, the dev menu had all RN's-specific options unavailable — it's been caused by the fact
[ios] Fix DevMenu and RedBox behavior when TurboModules are enabled (#9906)
# Why
With TurboModules enabled, the dev menu had all RN's-specific options unavailable — it's been caused by the fact we used module names to pick instances of some needed modules, whereas with TurboModules we should use `moduleForClass:` method instead.
After fixing this I noticed that toggling some tools sometimes doesn't close the dev menu as it was before — this is probably related with React Native upgrade to 0.63 which might fix an issue that `componentWillUnmount` was not being called after closing the bottom sheet, but `componentDidMount` was called every time when opening it. Previously we fixed this by unsubscribing the listener immediately once the request has come, but looks like we no longer need it.
We also found out some glitches while opening the dev menu for the first time — looks like there is a bug in the new version of reanimated that causes the bottom sheet to call `onCloseEnd` event when it starts opening and where we collapse and close it. I added additional check that prevents collapsing on `onCloseEnd` event when bottom sheet hasn't been expanded yet.
Linking with #9850 to track SDK39 QA issues.
# How
- Replaced `[self _moduleInstanceForBridge:bridge named:moduleName]` calls with `[bridge moduleForClass:ModuleClass.class]`.
- Made `EXDisabledDevMenu` and `EXDisabledRedBox` TurboModules.
- Moved overriding RedBox reload action from `bridgeWillStartLoading` to `bridgeFinishedLoading` to get rid of race conditions where the module is not available yet.
- Removed hacky fix that was unsubscribing close requests immediately.
- Added another hacky fix to prevent collapsing on unnecessary `onCloseEnd` calls.
# Test Plan
Run `home` locally and tested all dev menu's options in various cases. Unfortunately, remote debugger is still unavailable (but it should work once we turn off TurboModules by default).
# To do
- Publish dev home
- Remote debugger is still unavailable because it's explicitly disabled when TurboModules are enabled. We will fix it by making the use of TurboModules optional.
show more ...
|