dreaction-react-native 1.1.1 → 1.3.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.
@@ -1 +1 @@
1
- {"version":3,"file":"DraggableBall.d.ts","sourceRoot":"","sources":["../../src/components/DraggableBall.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA2B,MAAM,OAAO,CAAC;AAsBhD,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAgGhC,CAAC"}
1
+ {"version":3,"file":"DraggableBall.d.ts","sourceRoot":"","sources":["../../src/components/DraggableBall.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAsB3D,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EA4GhC,CAAC"}
@@ -52,6 +52,15 @@ 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 [isReady, setIsReady] = (0, react_1.useState)(false);
56
+ (0, react_1.useEffect)(() => {
57
+ const timer = setInterval(() => {
58
+ setIsReady(dreaction_1.dreaction.isReady);
59
+ }, 1000);
60
+ return () => {
61
+ clearInterval(timer);
62
+ };
63
+ }, []);
55
64
  const handleClick = (value) => {
56
65
  try {
57
66
  const host = (0, getHost_1.getHost)(value);
@@ -112,6 +121,7 @@ exports.DraggableBall = react_1.default.memo(() => {
112
121
  {
113
122
  transform: [{ translateX: position.x }, { translateY: position.y }],
114
123
  backgroundColor: isDragging ? '#eee' : '#fff',
124
+ borderColor: isReady ? '#00ff00' : '#eee',
115
125
  },
116
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 })] }));
117
127
  });
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
- if (!__DEV__) {
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: () => { },
@@ -1 +1 @@
1
- {"version":3,"file":"networking.d.ts","sourceRoot":"","sources":["../../src/plugins/networking.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAU,MAAM,uBAAuB,CAAC;AAOnE,MAAM,WAAW,iBAAiB;IAChC,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAID,QAAA,MAAM,UAAU,kBACC,iBAAiB,kBACnB,aAAa;;CAwJzB,CAAC;AACJ,eAAe,UAAU,CAAC"}
1
+ {"version":3,"file":"networking.d.ts","sourceRoot":"","sources":["../../src/plugins/networking.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAU,MAAM,uBAAuB,CAAC;AAOnE,MAAM,WAAW,iBAAiB;IAChC,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAMD,QAAA,MAAM,UAAU,kBACC,iBAAiB,kBACnB,aAAa;;CAwJzB,CAAC;AACJ,eAAe,UAAU,CAAC"}
@@ -9,7 +9,9 @@ const XHRInterceptor_1 = __importDefault(require("react-native/Libraries/Network
9
9
  * Don't include the response bodies for images by default.
10
10
  */
11
11
  const DEFAULT_CONTENT_TYPES_RX = /^(image)\/.*$/i;
12
- const DEFAULTS = {};
12
+ const DEFAULTS = {
13
+ ignoreUrls: /symbolicate/,
14
+ };
13
15
  const networking = (pluginConfig = {}) => (reactotron) => {
14
16
  const options = Object.assign({}, DEFAULTS, pluginConfig);
15
17
  // a RegExp to suppress adding the body cuz it costs a lot to serialize
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dreaction-react-native",
3
- "version": "1.1.1",
3
+ "version": "1.3.0",
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.0.0",
18
+ "dreaction-client-core": "1.1.1",
19
19
  "dreaction-protocol": "1.0.0"
20
20
  },
21
21
  "devDependencies": {
@@ -1,4 +1,4 @@
1
- import React, { useRef, useState } from 'react';
1
+ import React, { useRef, useState, useEffect } from 'react';
2
2
  import {
3
3
  Animated,
4
4
  PanResponder,
@@ -25,6 +25,17 @@ 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 [isReady, setIsReady] = useState(false);
29
+
30
+ useEffect(() => {
31
+ const timer = setInterval(() => {
32
+ setIsReady(dreaction.isReady);
33
+ }, 1000);
34
+
35
+ return () => {
36
+ clearInterval(timer);
37
+ };
38
+ }, []);
28
39
 
29
40
  const handleClick = (value: string) => {
30
41
  try {
@@ -102,6 +113,7 @@ export const DraggableBall: React.FC = React.memo(() => {
102
113
  {
103
114
  transform: [{ translateX: position.x }, { translateY: position.y }],
104
115
  backgroundColor: isDragging ? '#eee' : '#fff',
116
+ borderColor: isReady ? '#00ff00' : '#eee',
105
117
  },
106
118
  ]}
107
119
  {...panResponder.panHandlers}
package/src/dreaction.ts CHANGED
@@ -198,9 +198,16 @@ dreaction.setAsyncStorageHandler = (asyncStorage: AsyncStorageStatic) => {
198
198
 
199
199
  dreaction.registerDataWatcher = <T = unknown>(
200
200
  name: string,
201
- type: DataWatchPayload['type']
201
+ type: DataWatchPayload['type'],
202
+ options?: {
203
+ /**
204
+ * Is data watcher enabled?
205
+ */
206
+ enabled?: boolean;
207
+ }
202
208
  ) => {
203
- if (!__DEV__) {
209
+ const { enabled = __DEV__ } = options ?? {};
210
+ if (!enabled) {
204
211
  return {
205
212
  currentDebugValue: undefined,
206
213
  updateDebugValue: () => {},
@@ -12,7 +12,9 @@ export interface NetworkingOptions {
12
12
  ignoreUrls?: RegExp;
13
13
  }
14
14
 
15
- const DEFAULTS: NetworkingOptions = {};
15
+ const DEFAULTS: NetworkingOptions = {
16
+ ignoreUrls: /symbolicate/,
17
+ };
16
18
 
17
19
  const networking =
18
20
  (pluginConfig: NetworkingOptions = {}) =>