dreaction-react-native 1.9.0 → 1.9.1

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.
@@ -1,4 +1,5 @@
1
1
  import React from 'react';
2
+ export declare const LOCAL_CACHE_HOST_NAME = "__dreaction-react-native-host";
2
3
  interface ConfigDialogProps {
3
4
  visible: boolean;
4
5
  onConfirm: (host: string) => void;
@@ -1 +1 @@
1
- {"version":3,"file":"ConfigDialog.d.ts","sourceRoot":"","sources":["../../src/components/ConfigDialog.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAenD,UAAU,iBAAiB;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,QAAQ,EAAE,MAAM,IAAI,CAAC;CACtB;AACD,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAqDnD,CAAC"}
1
+ {"version":3,"file":"ConfigDialog.d.ts","sourceRoot":"","sources":["../../src/components/ConfigDialog.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAanD,eAAO,MAAM,qBAAqB,kCAAkC,CAAC;AAErE,UAAU,iBAAiB;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,QAAQ,EAAE,MAAM,IAAI,CAAC;CACtB;AACD,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAqDnD,CAAC"}
@@ -33,14 +33,14 @@ var __importStar = (this && this.__importStar) || (function () {
33
33
  };
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.ConfigDialog = void 0;
36
+ exports.ConfigDialog = exports.LOCAL_CACHE_HOST_NAME = void 0;
37
37
  const jsx_runtime_1 = require("react/jsx-runtime");
38
38
  const react_1 = __importStar(require("react"));
39
39
  const react_native_1 = require("react-native");
40
40
  const getHost_1 = require("../helpers/getHost");
41
41
  const dreaction_1 = require("../dreaction");
42
42
  const parseURL_1 = require("../helpers/parseURL");
43
- const LOCAL_CACHE_HOST_NAME = '__dreaction-react-native-host';
43
+ exports.LOCAL_CACHE_HOST_NAME = '__dreaction-react-native-host';
44
44
  exports.ConfigDialog = react_1.default.memo((props) => {
45
45
  const { visible, onConfirm, onCancel } = props;
46
46
  const defaultValue = (0, getHost_1.getHost)();
@@ -48,7 +48,7 @@ exports.ConfigDialog = react_1.default.memo((props) => {
48
48
  const selectTextOnFocus = inputValue === defaultValue;
49
49
  (0, react_1.useEffect)(() => {
50
50
  dreaction_1.dreaction.asyncStorageHandler
51
- ?.getItem(LOCAL_CACHE_HOST_NAME)
51
+ ?.getItem(exports.LOCAL_CACHE_HOST_NAME)
52
52
  .then((host) => {
53
53
  if (host) {
54
54
  setInputValue(host);
@@ -57,7 +57,7 @@ exports.ConfigDialog = react_1.default.memo((props) => {
57
57
  }, []);
58
58
  const handleConfirm = () => {
59
59
  const host = (0, parseURL_1.getHostWithPortFromUrl)(inputValue);
60
- dreaction_1.dreaction.asyncStorageHandler?.setItem(LOCAL_CACHE_HOST_NAME, host);
60
+ dreaction_1.dreaction.asyncStorageHandler?.setItem(exports.LOCAL_CACHE_HOST_NAME, host);
61
61
  onConfirm(host);
62
62
  };
63
63
  return ((0, jsx_runtime_1.jsx)(react_native_1.Modal, { animationType: "fade", transparent: true, visible: visible, onRequestClose: () => onCancel(), children: (0, jsx_runtime_1.jsx)(react_native_1.View, { style: styles.modalOverlay, children: (0, jsx_runtime_1.jsxs)(react_native_1.View, { style: styles.modalContent, children: [(0, jsx_runtime_1.jsx)(react_native_1.Text, { style: styles.title, children: "DReaction Desktop Application Host" }), (0, jsx_runtime_1.jsx)(react_native_1.TextInput, { style: styles.input, selectTextOnFocus: selectTextOnFocus, value: inputValue, keyboardType: "url", onChangeText: setInputValue, placeholder: (0, getHost_1.getHost)() }), (0, jsx_runtime_1.jsxs)(react_native_1.View, { style: styles.buttonContainer, children: [(0, jsx_runtime_1.jsx)(react_native_1.TouchableOpacity, { style: styles.buttonView, onPress: onCancel, children: (0, jsx_runtime_1.jsx)(react_native_1.Text, { style: styles.buttonText, children: "Cancel" }) }), (0, jsx_runtime_1.jsx)(react_native_1.TouchableOpacity, { style: styles.buttonView, onPress: handleConfirm, children: (0, jsx_runtime_1.jsx)(react_native_1.Text, { style: styles.buttonText, children: "Confirm" }) })] })] }) }) }));
@@ -1 +1 @@
1
- {"version":3,"file":"DraggableBall.d.ts","sourceRoot":"","sources":["../../src/components/DraggableBall.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAqB3D,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EA0GhC,CAAC"}
1
+ {"version":3,"file":"DraggableBall.d.ts","sourceRoot":"","sources":["../../src/components/DraggableBall.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAqB3D,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAyHhC,CAAC"}
@@ -60,6 +60,19 @@ exports.DraggableBall = react_1.default.memo(() => {
60
60
  clearInterval(timer);
61
61
  };
62
62
  }, []);
63
+ (0, react_1.useEffect)(() => {
64
+ if (dreaction_1.dreaction.isReady || dreaction_1.dreaction.connected) {
65
+ return;
66
+ }
67
+ dreaction_1.dreaction.asyncStorageHandler
68
+ ?.getItem(ConfigDialog_1.LOCAL_CACHE_HOST_NAME)
69
+ .then((cachedHost) => {
70
+ if (cachedHost && !dreaction_1.dreaction.isReady && !dreaction_1.dreaction.connected) {
71
+ dreaction_1.dreaction.configure({ host: cachedHost }).connect();
72
+ }
73
+ })
74
+ .catch(() => { });
75
+ }, []);
63
76
  const handleClick = (host) => {
64
77
  try {
65
78
  dreaction_1.dreaction
@@ -1 +1 @@
1
- {"version":3,"file":"getHost.d.ts","sourceRoot":"","sources":["../../src/helpers/getHost.ts"],"names":[],"mappings":"AAIA;;;;;;GAMG;AACH,eAAO,MAAM,OAAO,kCAkBnB,CAAC"}
1
+ {"version":3,"file":"getHost.d.ts","sourceRoot":"","sources":["../../src/helpers/getHost.ts"],"names":[],"mappings":"AAIA;;;;;;GAMG;AACH,eAAO,MAAM,OAAO,GAAI,oBAAyB,WAkBhD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"asyncStorage.d.ts","sourceRoot":"","sources":["../../src/plugins/asyncStorage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAU,MAAM,uBAAuB,CAAC;AAEnE,MAAM,WAAW,mBAAmB;IAClC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;CACnB;AAMD,QAAA,MAAM,YAAY,aACL,mBAAmB,iBAAiB,aAAa;;;;;CA+M3D,CAAC;AAEJ,eAAe,YAAY,CAAC"}
1
+ {"version":3,"file":"asyncStorage.d.ts","sourceRoot":"","sources":["../../src/plugins/asyncStorage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAU,MAAM,uBAAuB,CAAC;AAEnE,MAAM,WAAW,mBAAmB;IAClC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;CACnB;AAMD,QAAA,MAAM,YAAY,GACf,UAAU,mBAAmB,MAAM,WAAW,aAAa;;;;;CA+M3D,CAAC;AAEJ,eAAe,YAAY,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"networking.d.ts","sourceRoot":"","sources":["../../src/plugins/networking.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,aAAa,EAGnB,MAAM,uBAAuB,CAAC;AAO/B,MAAM,WAAW,iBAAiB;IAChC,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAMD,QAAA,MAAM,UAAU,kBACC,iBAAiB,iBACpB,aAAa;;CA+JxB,CAAC;AACJ,eAAe,UAAU,CAAC"}
1
+ {"version":3,"file":"networking.d.ts","sourceRoot":"","sources":["../../src/plugins/networking.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,aAAa,EAGnB,MAAM,uBAAuB,CAAC;AAO/B,MAAM,WAAW,iBAAiB;IAChC,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAMD,QAAA,MAAM,UAAU,GACb,eAAc,iBAAsB,MACpC,WAAW,aAAa;;CA+JxB,CAAC;AACJ,eAAe,UAAU,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"openInEditor.d.ts","sourceRoot":"","sources":["../../src/plugins/openInEditor.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAElD,MAAM,WAAW,mBAAmB;IAClC,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAMD,QAAA,MAAM,YAAY,kBACD,mBAAmB;yBAKT,OAAO;CAW/B,CAAC;AACJ,eAAe,YAAY,CAAC"}
1
+ {"version":3,"file":"openInEditor.d.ts","sourceRoot":"","sources":["../../src/plugins/openInEditor.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAElD,MAAM,WAAW,mBAAmB;IAClC,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAMD,QAAA,MAAM,YAAY,GACf,eAAc,mBAAwB;yBAKd,OAAO;CAW/B,CAAC;AACJ,eAAe,YAAY,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"trackGlobalErrors.d.ts","sourceRoot":"","sources":["../../src/plugins/trackGlobalErrors.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAGL,aAAa,EAGd,MAAM,uBAAuB,CAAC;AAC/B,OAAgB,EACd,YAAY,IAAI,kBAAkB,EAEnC,MAAM,sCAAsC,CAAC;AAM9C,UAAU,mBAAoB,SAAQ,kBAAkB;IACtD;;OA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GAEG;AACH,QAAA,MAAM,iBAAiB,GACpB,UAAU,wBAAwB,MAAM,WAAW,aAAa;;;6BAUnC,UAAU,CAAC,OAAO,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;;CA+EtE,CAAC;AAEJ,eAAe,iBAAiB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"trackGlobalLogs.d.ts","sourceRoot":"","sources":["../../src/plugins/trackGlobalLogs.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,aAAa,EAGd,MAAM,uBAAuB,CAAC;AAE/B;;GAEG;AACH,QAAA,MAAM,eAAe,oBAAqB,aAAa;;;CAsCtD,CAAC;AAEF,eAAe,eAAe,CAAC"}
1
+ {"version":3,"file":"trackGlobalLogs.d.ts","sourceRoot":"","sources":["../../src/plugins/trackGlobalLogs.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,aAAa,EAGd,MAAM,uBAAuB,CAAC;AAE/B;;GAEG;AACH,QAAA,MAAM,eAAe,SAAU,WAAW,aAAa;;;CAsCtD,CAAC;AAEF,eAAe,eAAe,CAAC"}
package/package.json CHANGED
@@ -1,9 +1,16 @@
1
1
  {
2
2
  "name": "dreaction-react-native",
3
- "version": "1.9.0",
3
+ "version": "1.9.1",
4
4
  "private": false,
5
5
  "description": "DReaction client for React Native applications with draggable debug ball and powerful debugging tools",
6
6
  "main": "lib/index.js",
7
+ "scripts": {
8
+ "dev": "tsc --watch",
9
+ "build": "tsc",
10
+ "prepare": "tsc",
11
+ "release": "npm publish --registry=https://registry.npmjs.com/",
12
+ "test": "vitest"
13
+ },
7
14
  "files": [
8
15
  "assets",
9
16
  "lib",
@@ -31,21 +38,19 @@
31
38
  },
32
39
  "homepage": "https://github.com/moonrailgun/dreaction#readme",
33
40
  "dependencies": {
34
- "mitt": "^3.0.1",
35
- "dreaction-client-core": "1.4.0",
36
- "dreaction-protocol": "1.0.11"
41
+ "dreaction-client-core": "workspace:*",
42
+ "dreaction-protocol": "workspace:*",
43
+ "mitt": "^3.0.1"
37
44
  },
38
45
  "devDependencies": {
39
- "@react-native-async-storage/async-storage": "^2.1.0",
46
+ "@types/node": "^22.0.0",
47
+ "@types/react": "^18.0.0",
40
48
  "@types/react-native": "^0.73.0",
41
49
  "typescript": "^5.4.5"
42
50
  },
43
51
  "peerDependencies": {
44
- "@react-native-async-storage/async-storage": "*"
45
- },
46
- "scripts": {
47
- "dev": "tsc --watch",
48
- "build": "tsc",
49
- "test": "vitest"
52
+ "@react-native-async-storage/async-storage": "*",
53
+ "react": ">=18",
54
+ "react-native": ">=0.70"
50
55
  }
51
- }
56
+ }
@@ -11,7 +11,7 @@ import { getHost } from '../helpers/getHost';
11
11
  import { dreaction } from '../dreaction';
12
12
  import { getHostWithPortFromUrl } from '../helpers/parseURL';
13
13
 
14
- const LOCAL_CACHE_HOST_NAME = '__dreaction-react-native-host';
14
+ export const LOCAL_CACHE_HOST_NAME = '__dreaction-react-native-host';
15
15
 
16
16
  interface ConfigDialogProps {
17
17
  visible: boolean;
@@ -7,7 +7,7 @@ import {
7
7
  Image,
8
8
  Alert,
9
9
  } from 'react-native';
10
- import { ConfigDialog } from './ConfigDialog';
10
+ import { ConfigDialog, LOCAL_CACHE_HOST_NAME } from './ConfigDialog';
11
11
  import { dreaction } from '../dreaction';
12
12
 
13
13
  const { width: SCREEN_WIDTH, height: SCREEN_HEIGHT } = Dimensions.get('window');
@@ -36,6 +36,21 @@ export const DraggableBall: React.FC = React.memo(() => {
36
36
  };
37
37
  }, []);
38
38
 
39
+ useEffect(() => {
40
+ if (dreaction.isReady || dreaction.connected) {
41
+ return;
42
+ }
43
+
44
+ dreaction.asyncStorageHandler
45
+ ?.getItem(LOCAL_CACHE_HOST_NAME)
46
+ .then((cachedHost) => {
47
+ if (cachedHost && !dreaction.isReady && !dreaction.connected) {
48
+ dreaction.configure({ host: cachedHost }).connect();
49
+ }
50
+ })
51
+ .catch(() => {});
52
+ }, []);
53
+
39
54
  const handleClick = (host: string) => {
40
55
  try {
41
56
  dreaction