dreaction-react-native 1.3.3 → 1.4.0
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/ConfigDialog.d.ts +1 -1
- package/lib/components/ConfigDialog.d.ts.map +1 -1
- package/lib/components/ConfigDialog.js +27 -3
- package/lib/components/DraggableBall.d.ts.map +1 -1
- package/lib/components/DraggableBall.js +1 -3
- 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/asyncStorage.d.ts.map +1 -1
- package/lib/plugins/devTools.d.ts.map +1 -1
- package/lib/plugins/devTools.js +4 -1
- package/package.json +6 -2
- package/src/components/ConfigDialog.tsx +46 -7
- package/src/components/DraggableBall.tsx +1 -4
- package/src/dreaction.ts +2 -2
- package/src/helpers/common.ts +3 -0
- package/src/plugins/asyncStorage.ts +0 -1
- package/src/plugins/devTools.ts +4 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfigDialog.d.ts","sourceRoot":"","sources":["../../src/components/ConfigDialog.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
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"}
|
|
@@ -38,13 +38,29 @@ 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
|
+
const dreaction_1 = require("../dreaction");
|
|
42
|
+
const parseURL_1 = require("../helpers/parseURL");
|
|
43
|
+
const LOCAL_CACHE_HOST_NAME = '__dreaction-react-native-host';
|
|
41
44
|
exports.ConfigDialog = react_1.default.memo((props) => {
|
|
42
45
|
const { visible, onConfirm, onCancel } = props;
|
|
43
|
-
const
|
|
46
|
+
const defaultValue = (0, getHost_1.getHost)();
|
|
47
|
+
const [inputValue, setInputValue] = (0, react_1.useState)(defaultValue);
|
|
48
|
+
const selectTextOnFocus = inputValue === defaultValue;
|
|
49
|
+
(0, react_1.useEffect)(() => {
|
|
50
|
+
dreaction_1.dreaction.asyncStorageHandler
|
|
51
|
+
?.getItem(LOCAL_CACHE_HOST_NAME)
|
|
52
|
+
.then((host) => {
|
|
53
|
+
if (host) {
|
|
54
|
+
setInputValue(host);
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
}, []);
|
|
44
58
|
const handleConfirm = () => {
|
|
45
|
-
|
|
59
|
+
const host = (0, parseURL_1.getHostFromUrl)(inputValue);
|
|
60
|
+
dreaction_1.dreaction.asyncStorageHandler?.setItem(LOCAL_CACHE_HOST_NAME, host);
|
|
61
|
+
onConfirm(host);
|
|
46
62
|
};
|
|
47
|
-
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 Url" }), (0, jsx_runtime_1.jsx)(react_native_1.TextInput, { style: styles.input, 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.
|
|
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 Url" }), (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" }) })] })] }) }) }));
|
|
48
64
|
});
|
|
49
65
|
exports.ConfigDialog.displayName = 'ConfigDialog';
|
|
50
66
|
const styles = react_native_1.StyleSheet.create({
|
|
@@ -73,6 +89,7 @@ const styles = react_native_1.StyleSheet.create({
|
|
|
73
89
|
borderWidth: 1,
|
|
74
90
|
borderColor: '#ccc',
|
|
75
91
|
borderRadius: 5,
|
|
92
|
+
color: 'black',
|
|
76
93
|
padding: 10,
|
|
77
94
|
marginBottom: 20,
|
|
78
95
|
},
|
|
@@ -80,4 +97,11 @@ const styles = react_native_1.StyleSheet.create({
|
|
|
80
97
|
flexDirection: 'row',
|
|
81
98
|
justifyContent: 'space-around',
|
|
82
99
|
},
|
|
100
|
+
buttonView: {
|
|
101
|
+
flexDirection: 'row',
|
|
102
|
+
justifyContent: 'space-around',
|
|
103
|
+
},
|
|
104
|
+
buttonText: {
|
|
105
|
+
color: '#2563eb',
|
|
106
|
+
},
|
|
83
107
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DraggableBall.d.ts","sourceRoot":"","sources":["../../src/components/DraggableBall.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsC,MAAM,OAAO,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,EA0GhC,CAAC"}
|
|
@@ -39,7 +39,6 @@ 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 parseURL_1 = require("../helpers/parseURL");
|
|
43
42
|
const { width: SCREEN_WIDTH, height: SCREEN_HEIGHT } = react_native_1.Dimensions.get('window');
|
|
44
43
|
const BALL_SIZE = 60;
|
|
45
44
|
const CLICK_THRESHOLD = 5;
|
|
@@ -61,9 +60,8 @@ exports.DraggableBall = react_1.default.memo(() => {
|
|
|
61
60
|
clearInterval(timer);
|
|
62
61
|
};
|
|
63
62
|
}, []);
|
|
64
|
-
const handleClick = (
|
|
63
|
+
const handleClick = (host) => {
|
|
65
64
|
try {
|
|
66
|
-
const host = (0, parseURL_1.getHostFromUrl)(value);
|
|
67
65
|
dreaction_1.dreaction
|
|
68
66
|
.configure({
|
|
69
67
|
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;
|
|
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;AAC/B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2CAA2C,CAAC;AAGpF,OAAqB,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC3E,OAAqB,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC3E,OAA0B,EACxB,wBAAwB,EACzB,MAAM,6BAA6B,CAAC;AACrC,OAAmB,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAIrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAKtD,YAAY,EAAE,aAAa,EAAE,CAAC;AAM9B,eAAO,MAAM,sBAAsB,OAOO,CAAC;AAE3C,MAAM,WAAW,qBAAqB;IACpC,MAAM,CAAC,EAAE,wBAAwB,GAAG,OAAO,CAAC;IAC5C,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,MAAM,CAAC,EAAE,mBAAmB,GAAG,OAAO,CAAC;IACvC,YAAY,CAAC,EAAE,mBAAmB,GAAG,OAAO,CAAC;IAC7C,UAAU,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC;IACzC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,KAAK,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":"asyncStorage.d.ts","sourceRoot":"","sources":["../../src/plugins/asyncStorage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAU,MAAM,uBAAuB,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,aACL,mBAAmB,iBAAiB,aAAa;;;;;CA+M3D,CAAC;AAEJ,eAAe,YAAY,CAAC"}
|
|
@@ -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
|
+
"version": "1.4.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -15,13 +15,17 @@
|
|
|
15
15
|
"author": "moonrailgun <moonrailgun@gmail.com>",
|
|
16
16
|
"license": "MIT",
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"dreaction-client-core": "1.1.
|
|
18
|
+
"dreaction-client-core": "1.1.4",
|
|
19
19
|
"dreaction-protocol": "1.0.1"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
|
+
"@react-native-async-storage/async-storage": "^2.1.0",
|
|
22
23
|
"@types/react-native": "^0.73.0",
|
|
23
24
|
"typescript": "^5.4.5"
|
|
24
25
|
},
|
|
26
|
+
"peerDependencies": {
|
|
27
|
+
"@react-native-async-storage/async-storage": ">=2.0.0"
|
|
28
|
+
},
|
|
25
29
|
"scripts": {
|
|
26
30
|
"dev": "tsc --watch",
|
|
27
31
|
"build": "tsc",
|
|
@@ -1,18 +1,44 @@
|
|
|
1
|
-
import React, { useState } from 'react';
|
|
2
|
-
import {
|
|
1
|
+
import React, { useState, useEffect } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
View,
|
|
4
|
+
Text,
|
|
5
|
+
TextInput,
|
|
6
|
+
Modal,
|
|
7
|
+
StyleSheet,
|
|
8
|
+
TouchableOpacity,
|
|
9
|
+
} from 'react-native';
|
|
3
10
|
import { getHost } from '../helpers/getHost';
|
|
11
|
+
import { dreaction } from '../dreaction';
|
|
12
|
+
import { getHostFromUrl } from '../helpers/parseURL';
|
|
13
|
+
|
|
14
|
+
const LOCAL_CACHE_HOST_NAME = '__dreaction-react-native-host';
|
|
4
15
|
|
|
5
16
|
interface ConfigDialogProps {
|
|
6
17
|
visible: boolean;
|
|
7
|
-
onConfirm: (
|
|
18
|
+
onConfirm: (host: string) => void;
|
|
8
19
|
onCancel: () => void;
|
|
9
20
|
}
|
|
10
21
|
export const ConfigDialog: React.FC<ConfigDialogProps> = React.memo((props) => {
|
|
11
22
|
const { visible, onConfirm, onCancel } = props;
|
|
12
|
-
const
|
|
23
|
+
const defaultValue = getHost();
|
|
24
|
+
const [inputValue, setInputValue] = useState(defaultValue);
|
|
25
|
+
|
|
26
|
+
const selectTextOnFocus = inputValue === defaultValue;
|
|
27
|
+
|
|
28
|
+
useEffect(() => {
|
|
29
|
+
dreaction.asyncStorageHandler
|
|
30
|
+
?.getItem(LOCAL_CACHE_HOST_NAME)
|
|
31
|
+
.then((host) => {
|
|
32
|
+
if (host) {
|
|
33
|
+
setInputValue(host);
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
}, []);
|
|
13
37
|
|
|
14
38
|
const handleConfirm = () => {
|
|
15
|
-
|
|
39
|
+
const host = getHostFromUrl(inputValue);
|
|
40
|
+
dreaction.asyncStorageHandler?.setItem(LOCAL_CACHE_HOST_NAME, host);
|
|
41
|
+
onConfirm(host);
|
|
16
42
|
};
|
|
17
43
|
|
|
18
44
|
return (
|
|
@@ -27,14 +53,19 @@ export const ConfigDialog: React.FC<ConfigDialogProps> = React.memo((props) => {
|
|
|
27
53
|
<Text style={styles.title}>DReaction Desktop Application Url</Text>
|
|
28
54
|
<TextInput
|
|
29
55
|
style={styles.input}
|
|
56
|
+
selectTextOnFocus={selectTextOnFocus}
|
|
30
57
|
value={inputValue}
|
|
31
58
|
keyboardType="url"
|
|
32
59
|
onChangeText={setInputValue}
|
|
33
60
|
placeholder={getHost()}
|
|
34
61
|
/>
|
|
35
62
|
<View style={styles.buttonContainer}>
|
|
36
|
-
<
|
|
37
|
-
|
|
63
|
+
<TouchableOpacity style={styles.buttonView} onPress={onCancel}>
|
|
64
|
+
<Text style={styles.buttonText}>Cancel</Text>
|
|
65
|
+
</TouchableOpacity>
|
|
66
|
+
<TouchableOpacity style={styles.buttonView} onPress={handleConfirm}>
|
|
67
|
+
<Text style={styles.buttonText}>Confirm</Text>
|
|
68
|
+
</TouchableOpacity>
|
|
38
69
|
</View>
|
|
39
70
|
</View>
|
|
40
71
|
</View>
|
|
@@ -69,6 +100,7 @@ const styles = StyleSheet.create({
|
|
|
69
100
|
borderWidth: 1,
|
|
70
101
|
borderColor: '#ccc',
|
|
71
102
|
borderRadius: 5,
|
|
103
|
+
color: 'black',
|
|
72
104
|
padding: 10,
|
|
73
105
|
marginBottom: 20,
|
|
74
106
|
},
|
|
@@ -76,4 +108,11 @@ const styles = StyleSheet.create({
|
|
|
76
108
|
flexDirection: 'row',
|
|
77
109
|
justifyContent: 'space-around',
|
|
78
110
|
},
|
|
111
|
+
buttonView: {
|
|
112
|
+
flexDirection: 'row',
|
|
113
|
+
justifyContent: 'space-around',
|
|
114
|
+
},
|
|
115
|
+
buttonText: {
|
|
116
|
+
color: '#2563eb',
|
|
117
|
+
},
|
|
79
118
|
});
|
|
@@ -9,7 +9,6 @@ import {
|
|
|
9
9
|
} from 'react-native';
|
|
10
10
|
import { ConfigDialog } from './ConfigDialog';
|
|
11
11
|
import { dreaction } from '../dreaction';
|
|
12
|
-
import { getHostFromUrl } from '../helpers/parseURL';
|
|
13
12
|
|
|
14
13
|
const { width: SCREEN_WIDTH, height: SCREEN_HEIGHT } = Dimensions.get('window');
|
|
15
14
|
const BALL_SIZE = 60;
|
|
@@ -37,10 +36,8 @@ export const DraggableBall: React.FC = React.memo(() => {
|
|
|
37
36
|
};
|
|
38
37
|
}, []);
|
|
39
38
|
|
|
40
|
-
const handleClick = (
|
|
39
|
+
const handleClick = (host: string) => {
|
|
41
40
|
try {
|
|
42
|
-
const host = getHostFromUrl(value);
|
|
43
|
-
|
|
44
41
|
dreaction
|
|
45
42
|
.configure({
|
|
46
43
|
host,
|
package/src/dreaction.ts
CHANGED
|
@@ -7,7 +7,6 @@ import type {
|
|
|
7
7
|
DReaction,
|
|
8
8
|
DReactionCore,
|
|
9
9
|
} from 'dreaction-client-core';
|
|
10
|
-
// @ts-ignore
|
|
11
10
|
import type { AsyncStorageStatic } from '@react-native-async-storage/async-storage';
|
|
12
11
|
import getReactNativeVersion from './helpers/getReactNativeVersion';
|
|
13
12
|
import getReactNativeDimensions from './helpers/getReactNativeDimensions';
|
|
@@ -23,6 +22,7 @@ import getReactNativePlatformConstants from './helpers/getReactNativePlatformCon
|
|
|
23
22
|
import { DataWatchPayload } from 'dreaction-protocol';
|
|
24
23
|
import { useEffect } from 'react';
|
|
25
24
|
import { getHost } from './helpers/getHost';
|
|
25
|
+
import { isDev } from './helpers/common';
|
|
26
26
|
|
|
27
27
|
export type { ClientOptions };
|
|
28
28
|
|
|
@@ -92,7 +92,7 @@ const DEFAULTS: ClientOptions<DReactionReactNative> = {
|
|
|
92
92
|
host: getHost('localhost'),
|
|
93
93
|
port: 9600,
|
|
94
94
|
name: 'React Native App',
|
|
95
|
-
environment: process.env.NODE_ENV || (
|
|
95
|
+
environment: process.env.NODE_ENV || (isDev() ? 'development' : 'production'),
|
|
96
96
|
client: {
|
|
97
97
|
dreactionLibraryName: 'dreaction-react-native',
|
|
98
98
|
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
|
|