dreaction-react-native 1.2.0 → 1.3.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.
|
@@ -52,10 +52,10 @@ exports.DraggableBall = react_1.default.memo(() => {
|
|
|
52
52
|
const lastPosition = (0, react_1.useRef)(initialPosition);
|
|
53
53
|
const [isDragging, setIsDragging] = (0, react_1.useState)(false);
|
|
54
54
|
const [modalVisible, setModalVisible] = (0, react_1.useState)(false);
|
|
55
|
-
const [
|
|
55
|
+
const [isReady, setIsReady] = (0, react_1.useState)(false);
|
|
56
56
|
(0, react_1.useEffect)(() => {
|
|
57
57
|
const timer = setInterval(() => {
|
|
58
|
-
|
|
58
|
+
setIsReady(dreaction_1.dreaction.isReady);
|
|
59
59
|
}, 1000);
|
|
60
60
|
return () => {
|
|
61
61
|
clearInterval(timer);
|
|
@@ -121,7 +121,7 @@ exports.DraggableBall = react_1.default.memo(() => {
|
|
|
121
121
|
{
|
|
122
122
|
transform: [{ translateX: position.x }, { translateY: position.y }],
|
|
123
123
|
backgroundColor: isDragging ? '#eee' : '#fff',
|
|
124
|
-
borderColor:
|
|
124
|
+
borderColor: isReady ? '#00ff00' : '#eee',
|
|
125
125
|
},
|
|
126
126
|
], ...panResponder.panHandlers, children: (0, jsx_runtime_1.jsx)(react_native_1.Image, { style: styles.icon, source: require('../../assets/icon.png') }) }), (0, jsx_runtime_1.jsx)(ConfigDialog_1.ConfigDialog, { visible: modalVisible, onCancel: () => setModalVisible(false), onConfirm: handleClick })] }));
|
|
127
127
|
});
|
package/lib/dreaction.d.ts
CHANGED
|
@@ -20,7 +20,12 @@ export interface ReactotronReactNative extends Reactotron, ReactNativePluginFeat
|
|
|
20
20
|
useReactNative: (options?: UseReactNativeOptions) => this;
|
|
21
21
|
asyncStorageHandler?: AsyncStorageStatic;
|
|
22
22
|
setAsyncStorageHandler: (asyncStorage: AsyncStorageStatic) => this;
|
|
23
|
-
registerDataWatcher: <T = unknown>(name: string, type: DataWatchPayload['type']
|
|
23
|
+
registerDataWatcher: <T = unknown>(name: string, type: DataWatchPayload['type'], options?: {
|
|
24
|
+
/**
|
|
25
|
+
* Is data watcher enabled?
|
|
26
|
+
*/
|
|
27
|
+
enabled?: boolean;
|
|
28
|
+
}) => {
|
|
24
29
|
currentDebugValue: T | undefined;
|
|
25
30
|
updateDebugValue: (data: unknown) => void;
|
|
26
31
|
useDebugDataWatch: (target: unknown) => void;
|
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,UAAU,EACV,aAAa,EACd,MAAM,uBAAuB,CAAC;AAE/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;AAItD,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,yBA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AAiB,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,qBACf,SAAQ,UAAU,EAEhB,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,uBAAgD,CAAC"}
|
package/lib/dreaction.js
CHANGED
|
@@ -113,8 +113,9 @@ exports.dreaction.setAsyncStorageHandler = (asyncStorage) => {
|
|
|
113
113
|
exports.dreaction.asyncStorageHandler = asyncStorage;
|
|
114
114
|
return exports.dreaction;
|
|
115
115
|
};
|
|
116
|
-
exports.dreaction.registerDataWatcher = (name, type) => {
|
|
117
|
-
|
|
116
|
+
exports.dreaction.registerDataWatcher = (name, type, options) => {
|
|
117
|
+
const { enabled = __DEV__ } = options ?? {};
|
|
118
|
+
if (!enabled) {
|
|
118
119
|
return {
|
|
119
120
|
currentDebugValue: undefined,
|
|
120
121
|
updateDebugValue: () => { },
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dreaction-react-native",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -15,7 +15,7 @@
|
|
|
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.1",
|
|
19
19
|
"dreaction-protocol": "1.0.0"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
@@ -25,11 +25,11 @@ export const DraggableBall: React.FC = React.memo(() => {
|
|
|
25
25
|
const lastPosition = useRef(initialPosition);
|
|
26
26
|
const [isDragging, setIsDragging] = useState(false);
|
|
27
27
|
const [modalVisible, setModalVisible] = useState(false);
|
|
28
|
-
const [
|
|
28
|
+
const [isReady, setIsReady] = useState(false);
|
|
29
29
|
|
|
30
30
|
useEffect(() => {
|
|
31
31
|
const timer = setInterval(() => {
|
|
32
|
-
|
|
32
|
+
setIsReady(dreaction.isReady);
|
|
33
33
|
}, 1000);
|
|
34
34
|
|
|
35
35
|
return () => {
|
|
@@ -113,7 +113,7 @@ export const DraggableBall: React.FC = React.memo(() => {
|
|
|
113
113
|
{
|
|
114
114
|
transform: [{ translateX: position.x }, { translateY: position.y }],
|
|
115
115
|
backgroundColor: isDragging ? '#eee' : '#fff',
|
|
116
|
-
borderColor:
|
|
116
|
+
borderColor: isReady ? '#00ff00' : '#eee',
|
|
117
117
|
},
|
|
118
118
|
]}
|
|
119
119
|
{...panResponder.panHandlers}
|
package/src/dreaction.ts
CHANGED
|
@@ -62,7 +62,13 @@ export interface ReactotronReactNative
|
|
|
62
62
|
setAsyncStorageHandler: (asyncStorage: AsyncStorageStatic) => this;
|
|
63
63
|
registerDataWatcher: <T = unknown>(
|
|
64
64
|
name: string,
|
|
65
|
-
type: DataWatchPayload['type']
|
|
65
|
+
type: DataWatchPayload['type'],
|
|
66
|
+
options?: {
|
|
67
|
+
/**
|
|
68
|
+
* Is data watcher enabled?
|
|
69
|
+
*/
|
|
70
|
+
enabled?: boolean;
|
|
71
|
+
}
|
|
66
72
|
) => {
|
|
67
73
|
currentDebugValue: T | undefined;
|
|
68
74
|
updateDebugValue: (data: unknown) => void;
|
|
@@ -198,9 +204,16 @@ dreaction.setAsyncStorageHandler = (asyncStorage: AsyncStorageStatic) => {
|
|
|
198
204
|
|
|
199
205
|
dreaction.registerDataWatcher = <T = unknown>(
|
|
200
206
|
name: string,
|
|
201
|
-
type: DataWatchPayload['type']
|
|
207
|
+
type: DataWatchPayload['type'],
|
|
208
|
+
options?: {
|
|
209
|
+
/**
|
|
210
|
+
* Is data watcher enabled?
|
|
211
|
+
*/
|
|
212
|
+
enabled?: boolean;
|
|
213
|
+
}
|
|
202
214
|
) => {
|
|
203
|
-
|
|
215
|
+
const { enabled = __DEV__ } = options ?? {};
|
|
216
|
+
if (!enabled) {
|
|
204
217
|
return {
|
|
205
218
|
currentDebugValue: undefined,
|
|
206
219
|
updateDebugValue: () => {},
|