-
Notifications
You must be signed in to change notification settings - Fork 945
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(reactotron-react-native): only set DevMenu when in __DEV__ (#1527 …
…by @frankcalise and @joshuayoes) ## Please verify the following: - [x] `yarn build-and-test:local` passes - [ ] I have added tests for any new features, if relevant - [ ] `README.md` (or relevant documentation) has been updated with your changes ## Describe your PR - Closes #1513 - Before we improperly included the DevMenu module in both debug and release builds, this checks the `__DEV__` flag - Now we access the module using `TurboModuleRegistry.get` instead of `TurboModuleRegistry.getEnforcing` to avoid throwing a top level JS error when it does not exist --------- Co-authored-by: Joshua Yoes <37849890+joshuayoes@users.noreply.github.com>
- Loading branch information
1 parent
ed7c16e
commit 5f692ac
Showing
4 changed files
with
75 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
types/react-native/Libraries/NativeModules/specs/NativeDevMenu.d.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
declare module "react-native/Libraries/NativeModules/specs/NativeDevMenu" { | ||
import type { TurboModule } from "react-native" | ||
/** | ||
* @see https://github.com/facebook/react-native/blob/main/packages/react-native/Libraries/NativeModules/specs/NativeDevMenu.js | ||
* @see https://github.com/facebook/react-native/blob/main/packages/react-native/src/private/specs/modules/NativeDevMenu.js#L15-L21 | ||
*/ | ||
export interface Spec extends TurboModule { | ||
show: () => void | ||
reload: () => void | ||
debugRemotely: (enableDebug: boolean) => void | ||
setProfilingEnabled: (enabled: boolean) => void | ||
setHotLoadingEnabled: (enabled: boolean) => void | ||
} | ||
|
||
const DevMenu: Spec | ||
export default DevMenu | ||
} |