dreaction-react-native 1.3.2 → 1.3.4
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/lib/components/DraggableBall.js +2 -2
- package/lib/dreaction.d.ts.map +1 -1
- package/lib/dreaction.js +2 -1
- package/lib/helpers/common.d.ts +2 -0
- package/lib/helpers/common.d.ts.map +1 -0
- package/lib/helpers/common.js +6 -0
- package/lib/plugins/devTools.d.ts.map +1 -1
- package/lib/plugins/devTools.js +4 -1
- package/package.json +3 -3
- package/src/components/DraggableBall.tsx +2 -2
- package/src/dreaction.ts +2 -1
- package/src/helpers/common.ts +3 -0
- package/src/plugins/devTools.ts +4 -1
|
@@ -39,7 +39,7 @@ const react_1 = __importStar(require("react"));
|
|
|
39
39
|
const react_native_1 = require("react-native");
|
|
40
40
|
const ConfigDialog_1 = require("./ConfigDialog");
|
|
41
41
|
const dreaction_1 = require("../dreaction");
|
|
42
|
-
const
|
|
42
|
+
const parseURL_1 = require("../helpers/parseURL");
|
|
43
43
|
const { width: SCREEN_WIDTH, height: SCREEN_HEIGHT } = react_native_1.Dimensions.get('window');
|
|
44
44
|
const BALL_SIZE = 60;
|
|
45
45
|
const CLICK_THRESHOLD = 5;
|
|
@@ -63,7 +63,7 @@ exports.DraggableBall = react_1.default.memo(() => {
|
|
|
63
63
|
}, []);
|
|
64
64
|
const handleClick = (value) => {
|
|
65
65
|
try {
|
|
66
|
-
const host = (0,
|
|
66
|
+
const host = (0, parseURL_1.getHostFromUrl)(value);
|
|
67
67
|
dreaction_1.dreaction
|
|
68
68
|
.configure({
|
|
69
69
|
host,
|
package/lib/dreaction.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dreaction.d.ts","sourceRoot":"","sources":["../src/dreaction.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,aAAa,EACb,wBAAwB,EAExB,SAAS,EACT,aAAa,EACd,MAAM,uBAAuB,CAAC;AAE/B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yBAAyB,GAAG,wBAAwB,CACvD,aAAa,EACb,OAAO,sBAAsB,CAC9B,CAAC;AAEF,MAAM,WAAW,oBACf,SAAQ,SAAS,EAEf,yBAAyB;IAC3B,cAAc,EAAE,CAAC,OAAO,CAAC,EAAE,qBAAqB,KAAK,IAAI,CAAC;IAC1D,mBAAmB,CAAC,EAAE,kBAAkB,CAAC;IACzC,sBAAsB,EAAE,CAAC,YAAY,EAAE,kBAAkB,KAAK,IAAI,CAAC;IACnE,mBAAmB,EAAE,CAAC,CAAC,GAAG,OAAO,EAC/B,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,gBAAgB,CAAC,MAAM,CAAC,EAC9B,OAAO,CAAC,EAAE;QACR;;WAEG;QACH,OAAO,CAAC,EAAE,OAAO,CAAC;KACnB,KACE;QACH,iBAAiB,EAAE,CAAC,GAAG,SAAS,CAAC;QACjC,gBAAgB,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;QAC1C,iBAAiB,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;KAC9C,CAAC;CACH;AAkFD,eAAO,MAAM,SAAS,sBAA+C,CAAC"}
|
package/lib/dreaction.js
CHANGED
|
@@ -17,6 +17,7 @@ const trackGlobalLogs_1 = __importDefault(require("./plugins/trackGlobalLogs"));
|
|
|
17
17
|
const getReactNativePlatformConstants_1 = __importDefault(require("./helpers/getReactNativePlatformConstants"));
|
|
18
18
|
const react_1 = require("react");
|
|
19
19
|
const getHost_1 = require("./helpers/getHost");
|
|
20
|
+
const common_1 = require("./helpers/common");
|
|
20
21
|
const DREACTION_ASYNC_CLIENT_ID = '@DREACTION/clientId';
|
|
21
22
|
let tempClientId = null;
|
|
22
23
|
exports.reactNativeCorePlugins = [
|
|
@@ -33,7 +34,7 @@ const DEFAULTS = {
|
|
|
33
34
|
host: (0, getHost_1.getHost)('localhost'),
|
|
34
35
|
port: 9600,
|
|
35
36
|
name: 'React Native App',
|
|
36
|
-
environment: process.env.NODE_ENV || (
|
|
37
|
+
environment: process.env.NODE_ENV || ((0, common_1.isDev)() ? 'development' : 'production'),
|
|
37
38
|
client: {
|
|
38
39
|
dreactionLibraryName: 'dreaction-react-native',
|
|
39
40
|
dreactionLibraryVersion: 'DREACTION_REACT_NATIVE_VERSION',
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/helpers/common.ts"],"names":[],"mappings":"AAAA,wBAAgB,KAAK,IAAI,OAAO,CAE/B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"devTools.d.ts","sourceRoot":"","sources":["../../src/plugins/devTools.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"devTools.d.ts","sourceRoot":"","sources":["../../src/plugins/devTools.ts"],"names":[],"mappings":"AAWA,QAAA,MAAM,QAAQ,EAAE,GAmBf,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
package/lib/plugins/devTools.js
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const react_native_1 = require("react-native");
|
|
4
|
+
const common_1 = require("../helpers/common");
|
|
4
5
|
let DevMenu = { show: () => { }, reload: () => { } };
|
|
5
|
-
if (react_native_1.Platform.OS === 'ios') {
|
|
6
|
+
if (react_native_1.Platform.OS === 'ios' && (0, common_1.isDev)()) {
|
|
7
|
+
// this will be crash in ios release mode
|
|
8
|
+
// so add is dev check
|
|
6
9
|
DevMenu = require('react-native/Libraries/NativeModules/specs/NativeDevMenu');
|
|
7
10
|
}
|
|
8
11
|
const devTools = () => () => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dreaction-react-native",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.4",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
"author": "moonrailgun <moonrailgun@gmail.com>",
|
|
16
16
|
"license": "MIT",
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"dreaction-
|
|
19
|
-
"dreaction-
|
|
18
|
+
"dreaction-client-core": "1.1.4",
|
|
19
|
+
"dreaction-protocol": "1.0.1"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"@types/react-native": "^0.73.0",
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
} from 'react-native';
|
|
10
10
|
import { ConfigDialog } from './ConfigDialog';
|
|
11
11
|
import { dreaction } from '../dreaction';
|
|
12
|
-
import {
|
|
12
|
+
import { getHostFromUrl } from '../helpers/parseURL';
|
|
13
13
|
|
|
14
14
|
const { width: SCREEN_WIDTH, height: SCREEN_HEIGHT } = Dimensions.get('window');
|
|
15
15
|
const BALL_SIZE = 60;
|
|
@@ -39,7 +39,7 @@ export const DraggableBall: React.FC = React.memo(() => {
|
|
|
39
39
|
|
|
40
40
|
const handleClick = (value: string) => {
|
|
41
41
|
try {
|
|
42
|
-
const host =
|
|
42
|
+
const host = getHostFromUrl(value);
|
|
43
43
|
|
|
44
44
|
dreaction
|
|
45
45
|
.configure({
|
package/src/dreaction.ts
CHANGED
|
@@ -23,6 +23,7 @@ import getReactNativePlatformConstants from './helpers/getReactNativePlatformCon
|
|
|
23
23
|
import { DataWatchPayload } from 'dreaction-protocol';
|
|
24
24
|
import { useEffect } from 'react';
|
|
25
25
|
import { getHost } from './helpers/getHost';
|
|
26
|
+
import { isDev } from './helpers/common';
|
|
26
27
|
|
|
27
28
|
export type { ClientOptions };
|
|
28
29
|
|
|
@@ -92,7 +93,7 @@ const DEFAULTS: ClientOptions<DReactionReactNative> = {
|
|
|
92
93
|
host: getHost('localhost'),
|
|
93
94
|
port: 9600,
|
|
94
95
|
name: 'React Native App',
|
|
95
|
-
environment: process.env.NODE_ENV || (
|
|
96
|
+
environment: process.env.NODE_ENV || (isDev() ? 'development' : 'production'),
|
|
96
97
|
client: {
|
|
97
98
|
dreactionLibraryName: 'dreaction-react-native',
|
|
98
99
|
dreactionLibraryVersion: 'DREACTION_REACT_NATIVE_VERSION',
|
package/src/plugins/devTools.ts
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { Platform } from 'react-native';
|
|
2
2
|
import type { DReactionCore, Plugin } from 'dreaction-client-core';
|
|
3
|
+
import { isDev } from '../helpers/common';
|
|
3
4
|
|
|
4
5
|
let DevMenu = { show: () => {}, reload: () => {} };
|
|
5
|
-
if (Platform.OS === 'ios') {
|
|
6
|
+
if (Platform.OS === 'ios' && isDev()) {
|
|
7
|
+
// this will be crash in ios release mode
|
|
8
|
+
// so add is dev check
|
|
6
9
|
DevMenu = require('react-native/Libraries/NativeModules/specs/NativeDevMenu');
|
|
7
10
|
}
|
|
8
11
|
|