File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ interface Window {
2+ __DEV__ : boolean ;
3+ }
4+
5+ declare module "react-native" {
6+ export const NativeModules : NativeModules ;
7+ export const DevSettings : DevSettings ;
8+ }
9+
10+ interface NativeModules {
11+ DevSettings : {
12+ setIsDebuggingRemotely : ( isDebuggingRemotely : boolean ) => void ;
13+ } ;
14+ }
15+
16+ interface DevSettings {
17+ addMenuItem : ( title : string , handler : ( ) => void ) => void ;
18+ }
Original file line number Diff line number Diff line change 1+ import { NativeModules , DevSettings } from "react-native" ;
2+
3+ // Tested with React Native 0.71
4+ if ( window . __DEV__ ) {
5+ DevSettings . addMenuItem ( "* Debug with Chrome" , ( ) => {
6+ NativeModules . DevSettings . setIsDebuggingRemotely ( true ) ;
7+ } ) ;
8+ DevSettings . addMenuItem ( "* Stop Debugging" , ( ) => {
9+ NativeModules . DevSettings . setIsDebuggingRemotely ( false ) ;
10+ } ) ;
11+ }
Original file line number Diff line number Diff line change 1+ {
2+ "name" : " react-native-devsettings" ,
3+ "version" : " 1.0.0" ,
4+ "main" : " index.js" ,
5+ "repository" : " git@github.com:gusgard/react-native-devsettings.git" ,
6+ "author" : " Gustavo Gard <gusgard@gmail.com>" ,
7+ "license" : " MIT"
8+ }
You can’t perform that action at this time.
0 commit comments