react-native-debug-toolkit 3.2.1 → 3.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -2
- package/README.zh-CN.md +13 -2
- package/android/build.gradle +34 -0
- package/android/src/main/AndroidManifest.xml +1 -0
- package/android/src/main/java/com/reactnativedebugtoolkit/DebugToolkitDevConnectModule.java +70 -0
- package/android/src/main/java/com/reactnativedebugtoolkit/ReactNativeDebugToolkitPackage.java +25 -0
- package/ios/DebugToolkitDevConnect.mm +67 -0
- package/lib/commonjs/features/devConnect/DevConnectQrScanner.js +18 -7
- package/lib/commonjs/features/devConnect/DevConnectQrScanner.js.map +1 -1
- package/lib/commonjs/features/devConnect/DevConnectTab.js +232 -161
- package/lib/commonjs/features/devConnect/DevConnectTab.js.map +1 -1
- package/lib/commonjs/features/devConnect/devConnectPreferences.js +35 -5
- package/lib/commonjs/features/devConnect/devConnectPreferences.js.map +1 -1
- package/lib/commonjs/features/devConnect/devConnectUtils.js +99 -15
- package/lib/commonjs/features/devConnect/devConnectUtils.js.map +1 -1
- package/lib/commonjs/features/devConnect/index.js +39 -2
- package/lib/commonjs/features/devConnect/index.js.map +1 -1
- package/lib/commonjs/features/devConnect/nativeDevConnect.js +110 -0
- package/lib/commonjs/features/devConnect/nativeDevConnect.js.map +1 -0
- package/lib/commonjs/features/devConnect/platformDetect.js +7 -11
- package/lib/commonjs/features/devConnect/platformDetect.js.map +1 -1
- package/lib/commonjs/utils/debugPreferences.js +43 -6
- package/lib/commonjs/utils/debugPreferences.js.map +1 -1
- package/lib/module/features/devConnect/DevConnectQrScanner.js +18 -7
- package/lib/module/features/devConnect/DevConnectQrScanner.js.map +1 -1
- package/lib/module/features/devConnect/DevConnectTab.js +235 -164
- package/lib/module/features/devConnect/DevConnectTab.js.map +1 -1
- package/lib/module/features/devConnect/devConnectPreferences.js +33 -6
- package/lib/module/features/devConnect/devConnectPreferences.js.map +1 -1
- package/lib/module/features/devConnect/devConnectUtils.js +94 -15
- package/lib/module/features/devConnect/devConnectUtils.js.map +1 -1
- package/lib/module/features/devConnect/index.js +11 -3
- package/lib/module/features/devConnect/index.js.map +1 -1
- package/lib/module/features/devConnect/nativeDevConnect.js +104 -0
- package/lib/module/features/devConnect/nativeDevConnect.js.map +1 -0
- package/lib/module/features/devConnect/platformDetect.js +8 -12
- package/lib/module/features/devConnect/platformDetect.js.map +1 -1
- package/lib/module/utils/debugPreferences.js +43 -6
- package/lib/module/utils/debugPreferences.js.map +1 -1
- package/lib/typescript/src/features/devConnect/DevConnectQrScanner.d.ts +3 -2
- package/lib/typescript/src/features/devConnect/DevConnectQrScanner.d.ts.map +1 -1
- package/lib/typescript/src/features/devConnect/DevConnectTab.d.ts.map +1 -1
- package/lib/typescript/src/features/devConnect/devConnectPreferences.d.ts +6 -0
- package/lib/typescript/src/features/devConnect/devConnectPreferences.d.ts.map +1 -1
- package/lib/typescript/src/features/devConnect/devConnectUtils.d.ts +18 -1
- package/lib/typescript/src/features/devConnect/devConnectUtils.d.ts.map +1 -1
- package/lib/typescript/src/features/devConnect/index.d.ts +2 -2
- package/lib/typescript/src/features/devConnect/index.d.ts.map +1 -1
- package/lib/typescript/src/features/devConnect/nativeDevConnect.d.ts +17 -0
- package/lib/typescript/src/features/devConnect/nativeDevConnect.d.ts.map +1 -0
- package/lib/typescript/src/features/devConnect/platformDetect.d.ts.map +1 -1
- package/lib/typescript/src/features/devConnect/types.d.ts +3 -0
- package/lib/typescript/src/features/devConnect/types.d.ts.map +1 -1
- package/lib/typescript/src/utils/debugPreferences.d.ts +2 -0
- package/lib/typescript/src/utils/debugPreferences.d.ts.map +1 -1
- package/package.json +4 -1
- package/react-native-debug-toolkit.podspec +18 -0
- package/src/features/devConnect/DevConnectQrScanner.tsx +20 -9
- package/src/features/devConnect/DevConnectTab.tsx +227 -105
- package/src/features/devConnect/devConnectPreferences.ts +50 -5
- package/src/features/devConnect/devConnectUtils.ts +122 -15
- package/src/features/devConnect/index.ts +13 -0
- package/src/features/devConnect/nativeDevConnect.ts +128 -0
- package/src/features/devConnect/platformDetect.ts +8 -13
- package/src/features/devConnect/types.ts +3 -0
- package/src/utils/debugPreferences.ts +49 -4
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { type ParsedComputerTarget } from './devConnectUtils';
|
|
2
3
|
interface DevConnectQrScannerProps {
|
|
3
4
|
visible: boolean;
|
|
4
5
|
onClose: () => void;
|
|
5
|
-
|
|
6
|
+
onScanTarget: (target: ParsedComputerTarget) => void;
|
|
6
7
|
}
|
|
7
|
-
export declare function DevConnectQrScanner({ visible, onClose,
|
|
8
|
+
export declare function DevConnectQrScanner({ visible, onClose, onScanTarget }: DevConnectQrScannerProps): React.JSX.Element | null;
|
|
8
9
|
export {};
|
|
9
10
|
//# sourceMappingURL=DevConnectQrScanner.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DevConnectQrScanner.d.ts","sourceRoot":"","sources":["../../../../../src/features/devConnect/DevConnectQrScanner.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8D,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"DevConnectQrScanner.d.ts","sourceRoot":"","sources":["../../../../../src/features/devConnect/DevConnectQrScanner.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8D,MAAM,OAAO,CAAC;AAgBnF,OAAO,EAAuB,KAAK,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAmCnF,UAAU,wBAAwB;IAChC,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,YAAY,EAAE,CAAC,MAAM,EAAE,oBAAoB,KAAK,IAAI,CAAC;CACtD;AAED,wBAAgB,mBAAmB,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,EAAE,wBAAwB,4BAiG/F"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DevConnectTab.d.ts","sourceRoot":"","sources":["../../../../../src/features/devConnect/DevConnectTab.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4D,MAAM,OAAO,CAAC;AAYjF,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"DevConnectTab.d.ts","sourceRoot":"","sources":["../../../../../src/features/devConnect/DevConnectTab.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4D,MAAM,OAAO,CAAC;AAYjF,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AA0B3D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AA2B/C,wBAAgB,aAAa,CAAC,EAAE,QAAQ,EAAE,EAAE,uBAAuB,CAAC,eAAe,CAAC,qBA8XnF"}
|
|
@@ -1,7 +1,13 @@
|
|
|
1
|
+
import { type ParsedComputerTarget } from './devConnectUtils';
|
|
1
2
|
export interface DevConnectPreferences {
|
|
2
3
|
computerHost: string;
|
|
4
|
+
metroPort: string;
|
|
5
|
+
daemonPort: string;
|
|
3
6
|
}
|
|
4
7
|
export declare function loadDevConnectPreferences(): Promise<DevConnectPreferences>;
|
|
8
|
+
export declare function saveComputerTarget(value: string): Promise<ParsedComputerTarget | null>;
|
|
5
9
|
export declare function saveComputerHost(value: string): Promise<string | null>;
|
|
10
|
+
export declare function saveMetroPort(value: string): Promise<string | null>;
|
|
11
|
+
export declare function saveDaemonPort(value: string): Promise<string | null>;
|
|
6
12
|
export declare function restoreDevConnectSettingsToDaemon(): Promise<void>;
|
|
7
13
|
//# sourceMappingURL=devConnectPreferences.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"devConnectPreferences.d.ts","sourceRoot":"","sources":["../../../../../src/features/devConnect/devConnectPreferences.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"devConnectPreferences.d.ts","sourceRoot":"","sources":["../../../../../src/features/devConnect/devConnectPreferences.ts"],"names":[],"mappings":"AAEA,OAAO,EAOL,KAAK,oBAAoB,EAC1B,MAAM,mBAAmB,CAAC;AAG3B,MAAM,WAAW,qBAAqB;IACpC,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,wBAAsB,yBAAyB,IAAI,OAAO,CAAC,qBAAqB,CAAC,CAShF;AAED,wBAAsB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC,CAS5F;AAED,wBAAsB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAG5E;AAED,wBAAsB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAQzE;AAED,wBAAsB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAQ1E;AAED,wBAAsB,iCAAiC,IAAI,OAAO,CAAC,IAAI,CAAC,CAWvE"}
|
|
@@ -1,12 +1,29 @@
|
|
|
1
|
+
export declare const DEFAULT_METRO_PORT = "8081";
|
|
2
|
+
export declare const DEFAULT_DAEMON_PORT = "3799";
|
|
1
3
|
export interface MetroUrls {
|
|
2
4
|
expUrl: string;
|
|
3
5
|
httpUrl: string;
|
|
4
6
|
}
|
|
7
|
+
export interface MetroTarget {
|
|
8
|
+
host: string;
|
|
9
|
+
port: string;
|
|
10
|
+
hostPort: string;
|
|
11
|
+
statusUrl: string;
|
|
12
|
+
}
|
|
13
|
+
export interface ParsedComputerTarget {
|
|
14
|
+
computerHost: string;
|
|
15
|
+
metroPort: string;
|
|
16
|
+
}
|
|
5
17
|
export interface ParsedMetroQrPayload {
|
|
6
18
|
computerHost: string;
|
|
19
|
+
metroPort: string;
|
|
7
20
|
source: string;
|
|
8
21
|
}
|
|
9
22
|
export declare function normalizeComputerHost(raw: string): string | null;
|
|
10
|
-
export declare function
|
|
23
|
+
export declare function normalizePort(raw: string): string | null;
|
|
24
|
+
export declare function parseComputerTarget(raw: string): ParsedComputerTarget | null;
|
|
25
|
+
export declare function buildMetroTarget(rawHost: string, rawPort?: string): MetroTarget | null;
|
|
26
|
+
export declare function buildMetroUrls(rawHost: string, rawPort?: string): MetroUrls | null;
|
|
11
27
|
export declare function parseMetroQrPayload(payload: string): ParsedMetroQrPayload | null;
|
|
28
|
+
export declare function buildDaemonDeviceHost(computerHost: string, daemonPort: string): string;
|
|
12
29
|
//# sourceMappingURL=devConnectUtils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"devConnectUtils.d.ts","sourceRoot":"","sources":["../../../../../src/features/devConnect/devConnectUtils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"devConnectUtils.d.ts","sourceRoot":"","sources":["../../../../../src/features/devConnect/devConnectUtils.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,kBAAkB,SAAS,CAAC;AACzC,eAAO,MAAM,mBAAmB,SAAS,CAAC;AAE1C,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,oBAAoB;IACnC,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,oBAAoB;IACnC,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;CAChB;AA0CD,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAOhE;AAED,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAWxD;AAED,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,oBAAoB,GAAG,IAAI,CAiB5E;AAaD,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,SAAqB,GAAG,WAAW,GAAG,IAAI,CAiBlG;AAED,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,SAAqB,GAAG,SAAS,GAAG,IAAI,CAU9F;AAED,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,oBAAoB,GAAG,IAAI,CAMhF;AAED,wBAAgB,qBAAqB,CAAC,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CAQtF"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { DebugFeature } from '../../types';
|
|
2
2
|
import type { DevConnectState } from './types';
|
|
3
3
|
export type { DevConnectState } from './types';
|
|
4
|
-
export { buildMetroUrls, normalizeComputerHost, parseMetroQrPayload, } from './devConnectUtils';
|
|
5
|
-
export { loadDevConnectPreferences, restoreDevConnectSettingsToDaemon, saveComputerHost, } from './devConnectPreferences';
|
|
4
|
+
export { buildMetroUrls, normalizeComputerHost, normalizePort, parseComputerTarget, parseMetroQrPayload, } from './devConnectUtils';
|
|
5
|
+
export { loadDevConnectPreferences, restoreDevConnectSettingsToDaemon, saveComputerHost, saveComputerTarget, saveDaemonPort, saveMetroPort, } from './devConnectPreferences';
|
|
6
6
|
export declare const createDevConnectFeature: () => DebugFeature<DevConnectState>;
|
|
7
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/devConnect/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/devConnect/index.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,YAAY,EAAwB,MAAM,aAAa,CAAC;AACtE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE/C,YAAY,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAC/C,OAAO,EACL,cAAc,EACd,qBAAqB,EACrB,aAAa,EACb,mBAAmB,EACnB,mBAAmB,GACpB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,yBAAyB,EACzB,iCAAiC,EACjC,gBAAgB,EAChB,kBAAkB,EAClB,cAAc,EACd,aAAa,GACd,MAAM,yBAAyB,CAAC;AAEjC,eAAO,MAAM,uBAAuB,QAAO,YAAY,CAAC,eAAe,CAiDtE,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
type MetroBundleFailureReason = 'invalid_target' | 'native_unavailable' | 'fetch_unavailable' | 'metro_unreachable' | 'native_error';
|
|
2
|
+
export type MetroBundleResult = {
|
|
3
|
+
ok: true;
|
|
4
|
+
hostPort: string;
|
|
5
|
+
} | {
|
|
6
|
+
ok: false;
|
|
7
|
+
reason: MetroBundleFailureReason;
|
|
8
|
+
error?: string;
|
|
9
|
+
statusUrl?: string;
|
|
10
|
+
};
|
|
11
|
+
export declare function isNativeDevConnectAvailable(): boolean;
|
|
12
|
+
export declare function applyMetroBundle(host: string, port: string): Promise<MetroBundleResult>;
|
|
13
|
+
export declare function resetMetroBundle(): Promise<MetroBundleResult | {
|
|
14
|
+
ok: true;
|
|
15
|
+
}>;
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=nativeDevConnect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nativeDevConnect.d.ts","sourceRoot":"","sources":["../../../../../src/features/devConnect/nativeDevConnect.ts"],"names":[],"mappings":"AAUA,KAAK,wBAAwB,GACzB,gBAAgB,GAChB,oBAAoB,GACpB,mBAAmB,GACnB,mBAAmB,GACnB,cAAc,CAAC;AAEnB,MAAM,MAAM,iBAAiB,GACzB;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,GAC9B;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,wBAAwB,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAsBxF,wBAAgB,2BAA2B,IAAI,OAAO,CAErD;AAmCD,wBAAsB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC,CA8B7F;AAED,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,iBAAiB,GAAG;IAAE,EAAE,EAAE,IAAI,CAAA;CAAE,CAAC,CAiBlF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"platformDetect.d.ts","sourceRoot":"","sources":["../../../../../src/features/devConnect/platformDetect.ts"],"names":[],"mappings":"AAEA,wBAAgB,WAAW,IAAI,OAAO,
|
|
1
|
+
{"version":3,"file":"platformDetect.d.ts","sourceRoot":"","sources":["../../../../../src/features/devConnect/platformDetect.ts"],"names":[],"mappings":"AAEA,wBAAgB,WAAW,IAAI,OAAO,CAkBrC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/features/devConnect/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe;IAC9B,WAAW,EAAE,OAAO,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,OAAO,CAAC;IACrB,SAAS,EAAE,OAAO,CAAC;CACpB"}
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/features/devConnect/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe;IAC9B,WAAW,EAAE,OAAO,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,OAAO,CAAC;IACrB,oBAAoB,EAAE,OAAO,CAAC;IAC9B,SAAS,EAAE,OAAO,CAAC;CACpB"}
|
|
@@ -7,5 +7,7 @@ export declare const KEYS: {
|
|
|
7
7
|
readonly networkLogs: "@react_native_debug_toolkit/network_logs";
|
|
8
8
|
readonly trackLogs: "@react_native_debug_toolkit/track_logs";
|
|
9
9
|
readonly computerHost: "@react_native_debug_toolkit/computer_host";
|
|
10
|
+
readonly metroPort: "@react_native_debug_toolkit/metro_port";
|
|
11
|
+
readonly daemonPort: "@react_native_debug_toolkit/daemon_port";
|
|
10
12
|
};
|
|
11
13
|
//# sourceMappingURL=debugPreferences.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"debugPreferences.d.ts","sourceRoot":"","sources":["../../../../src/utils/debugPreferences.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"debugPreferences.d.ts","sourceRoot":"","sources":["../../../../src/utils/debugPreferences.ts"],"names":[],"mappings":"AAkCA,wBAAsB,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAoB7E;AAED,wBAAsB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CA0BvE;AAED,eAAO,MAAM,IAAI;;;;;;;;;CASP,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-debug-toolkit",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.2",
|
|
4
4
|
"description": "A local-first React Native debug toolkit with Web Console, HTTP API, and MCP support for AI-readable app logs",
|
|
5
5
|
"main": "lib/commonjs/index.js",
|
|
6
6
|
"module": "lib/module/index.js",
|
|
@@ -10,6 +10,9 @@
|
|
|
10
10
|
"lib",
|
|
11
11
|
"bin",
|
|
12
12
|
"node",
|
|
13
|
+
"ios",
|
|
14
|
+
"android",
|
|
15
|
+
"react-native-debug-toolkit.podspec",
|
|
13
16
|
"README.md",
|
|
14
17
|
"LICENSE",
|
|
15
18
|
"!**/__tests__",
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
require 'json'
|
|
2
|
+
|
|
3
|
+
package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
|
|
4
|
+
|
|
5
|
+
Pod::Spec.new do |s|
|
|
6
|
+
s.name = 'react-native-debug-toolkit'
|
|
7
|
+
s.version = package['version']
|
|
8
|
+
s.summary = package['description']
|
|
9
|
+
s.description = package['description']
|
|
10
|
+
s.homepage = package['homepage']
|
|
11
|
+
s.license = package['license']
|
|
12
|
+
s.author = package['author']
|
|
13
|
+
s.source = { :git => package['repository']['url'], :tag => s.version.to_s }
|
|
14
|
+
|
|
15
|
+
s.platforms = { :ios => '12.0' }
|
|
16
|
+
s.source_files = 'ios/**/*.{h,m,mm}'
|
|
17
|
+
s.dependency 'React-Core'
|
|
18
|
+
end
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
type CameraKitReadCodeEvent,
|
|
15
15
|
type ExpoCameraScanResult,
|
|
16
16
|
} from './cameraKit';
|
|
17
|
-
import { parseMetroQrPayload } from './devConnectUtils';
|
|
17
|
+
import { parseMetroQrPayload, type ParsedComputerTarget } from './devConnectUtils';
|
|
18
18
|
|
|
19
19
|
// ─── Camera Error Boundary ─────────────────────────────────
|
|
20
20
|
|
|
@@ -40,7 +40,9 @@ class CameraErrorBoundary extends Component<CameraBoundaryProps, CameraBoundaryS
|
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
render() {
|
|
43
|
-
if (this.state.hasError)
|
|
43
|
+
if (this.state.hasError) {
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
44
46
|
return this.props.children;
|
|
45
47
|
}
|
|
46
48
|
}
|
|
@@ -50,10 +52,10 @@ class CameraErrorBoundary extends Component<CameraBoundaryProps, CameraBoundaryS
|
|
|
50
52
|
interface DevConnectQrScannerProps {
|
|
51
53
|
visible: boolean;
|
|
52
54
|
onClose: () => void;
|
|
53
|
-
|
|
55
|
+
onScanTarget: (target: ParsedComputerTarget) => void;
|
|
54
56
|
}
|
|
55
57
|
|
|
56
|
-
export function DevConnectQrScanner({ visible, onClose,
|
|
58
|
+
export function DevConnectQrScanner({ visible, onClose, onScanTarget }: DevConnectQrScannerProps) {
|
|
57
59
|
const scannedRef = useRef(false);
|
|
58
60
|
const [error, setError] = useState<string | null>(null);
|
|
59
61
|
const [cameraFailed, setCameraFailed] = useState(false);
|
|
@@ -68,8 +70,12 @@ export function DevConnectQrScanner({ visible, onClose, onScanHost }: DevConnect
|
|
|
68
70
|
}, [visible]);
|
|
69
71
|
|
|
70
72
|
const handleScanned = useCallback((rawValue: string) => {
|
|
71
|
-
if (scannedRef.current)
|
|
72
|
-
|
|
73
|
+
if (scannedRef.current) {
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
if (typeof rawValue !== 'string') {
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
73
79
|
|
|
74
80
|
const parsed = parseMetroQrPayload(rawValue);
|
|
75
81
|
if (!parsed) {
|
|
@@ -79,9 +85,12 @@ export function DevConnectQrScanner({ visible, onClose, onScanHost }: DevConnect
|
|
|
79
85
|
|
|
80
86
|
scannedRef.current = true;
|
|
81
87
|
setError(null);
|
|
82
|
-
|
|
88
|
+
onScanTarget({
|
|
89
|
+
computerHost: parsed.computerHost,
|
|
90
|
+
metroPort: parsed.metroPort,
|
|
91
|
+
});
|
|
83
92
|
onClose();
|
|
84
|
-
}, [onClose,
|
|
93
|
+
}, [onClose, onScanTarget]);
|
|
85
94
|
|
|
86
95
|
const handleCameraKitRead = useCallback((event: CameraKitReadCodeEvent) => {
|
|
87
96
|
handleScanned(event.nativeEvent?.codeStringValue ?? '');
|
|
@@ -95,7 +104,9 @@ export function DevConnectQrScanner({ visible, onClose, onScanHost }: DevConnect
|
|
|
95
104
|
setCameraFailed(true);
|
|
96
105
|
}, []);
|
|
97
106
|
|
|
98
|
-
if (!visible || !scanner)
|
|
107
|
+
if (!visible || !scanner) {
|
|
108
|
+
return null;
|
|
109
|
+
}
|
|
99
110
|
|
|
100
111
|
return (
|
|
101
112
|
<Modal visible={visible} animationType="slide" onRequestClose={onClose}>
|