Permalink
Browse files

Add missing `toggleElementInspector` event send when `jsLoaded`

Summary:
- [x] Explain the **motivation** for making this change.
- [x] Provide a **test plan** demonstrating that the code is solid.
- [x] Match the **code formatting** of the rest of the codebase.
- [x] Target the `master` branch, NOT a "stable" branch.

The PR #11613 (0.43) removed this missing `toggleElementInspector` event send when `jsLoaded` in DevMenu (Now is DevSettings), it should open the inspector if `isElementInspectorShown` is true when we reload JS.

The dev menu text `Show / Hide Inspector` is dependent on `isElementInspectorShown` bool value.

([This behavior in 0.42](https://github.com/facebook/react-native/blob/0.42-stable/React/Modules/RCTDevMenu.mm#L436-L442))

Manual testing in UIExplorer:

* Open the dev menu and click `Show Inspector`
* Open the dev menu and click `Reload JS`
* The built-in inspector should keep open (dev menu text: `Hide Inspector`)
Closes #12999

Differential Revision: D4738959

Pulled By: javache

fbshipit-source-id: b3f584db51aa0e1b463c52003967b00bcd81bc99
  • Loading branch information...
jhen0409 authored and facebook-github-bot committed Mar 20, 2017
1 parent 4398892 commit f352aa129a0264671d7e294a1f895eb1beddc3f1
Showing with 8 additions and 0 deletions.
  1. +8 −0 React/Modules/RCTDevSettings.mm
@@ -454,6 +454,14 @@ - (void)jsLoaded:(NSNotification *)notification
dispatch_async(dispatch_get_main_queue(), ^{
// update state again after the bridge has finished loading
[self _synchronizeAllSettings];
// Inspector can only be shown after JS has loaded
if ([self isElementInspectorShown]) {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
[self.bridge.eventDispatcher sendDeviceEventWithName:@"toggleElementInspector" body:nil];
#pragma clang diagnostic pop
}
});
}

0 comments on commit f352aa1

Please sign in to comment.