dreaction-react-native 1.7.3 → 1.8.2
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/OverlayImage.d.ts +3 -0
- package/lib/components/OverlayImage.d.ts.map +1 -0
- package/lib/components/OverlayImage.js +75 -0
- package/lib/dreaction.d.ts +3 -0
- package/lib/dreaction.d.ts.map +1 -1
- package/lib/dreaction.js +6 -1
- package/lib/index.d.ts +2 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +3 -1
- package/lib/plugins/overlay/index.d.ts +7 -2
- package/lib/plugins/overlay/index.d.ts.map +1 -1
- package/lib/plugins/overlay/index.js +4 -9
- package/lib/plugins/overlay/overlay.d.ts +5 -158
- package/lib/plugins/overlay/overlay.d.ts.map +1 -1
- package/lib/plugins/overlay/overlay.js +20 -95
- package/lib/plugins/overlay.d.ts +8 -0
- package/lib/plugins/overlay.d.ts.map +1 -0
- package/lib/plugins/overlay.js +25 -0
- package/lib/plugins/trackGlobalLogs.d.ts.map +1 -1
- package/lib/plugins/trackGlobalLogs.js +3 -3
- package/package.json +4 -3
- package/src/components/OverlayImage.tsx +56 -0
- package/src/dreaction.ts +8 -0
- package/src/index.ts +2 -0
- package/src/plugins/overlay.ts +22 -0
- package/src/plugins/trackGlobalLogs.ts +3 -4
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OverlayImage.d.ts","sourceRoot":"","sources":["../../src/components/OverlayImage.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAInD,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAkD/B,CAAC"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.OverlayImage = void 0;
|
|
37
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
38
|
+
const react_1 = __importStar(require("react"));
|
|
39
|
+
const react_native_1 = require("react-native");
|
|
40
|
+
const overlay_1 = require("../plugins/overlay");
|
|
41
|
+
exports.OverlayImage = react_1.default.memo(() => {
|
|
42
|
+
const [uri, setUri] = (0, react_1.useState)(null);
|
|
43
|
+
const [opacity, setOpacity] = (0, react_1.useState)(0.5);
|
|
44
|
+
(0, react_1.useEffect)(() => {
|
|
45
|
+
const handler = (payload) => {
|
|
46
|
+
setUri(payload.uri);
|
|
47
|
+
if (payload.opacity !== undefined) {
|
|
48
|
+
setOpacity(payload.opacity);
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
overlay_1.emitter.on('overlay', handler);
|
|
52
|
+
return () => {
|
|
53
|
+
overlay_1.emitter.off('overlay', handler);
|
|
54
|
+
};
|
|
55
|
+
}, []);
|
|
56
|
+
if (!uri) {
|
|
57
|
+
return null;
|
|
58
|
+
}
|
|
59
|
+
const { width, height } = react_native_1.Dimensions.get('window');
|
|
60
|
+
return ((0, jsx_runtime_1.jsx)(react_native_1.View, { pointerEvents: "none", style: {
|
|
61
|
+
position: 'absolute',
|
|
62
|
+
top: 0,
|
|
63
|
+
left: 0,
|
|
64
|
+
width: width,
|
|
65
|
+
height: height,
|
|
66
|
+
}, children: (0, jsx_runtime_1.jsx)(react_native_1.Image, { source: { uri: uri }, resizeMode: "contain", style: {
|
|
67
|
+
position: 'absolute',
|
|
68
|
+
top: 0,
|
|
69
|
+
left: 0,
|
|
70
|
+
width: width,
|
|
71
|
+
height: height,
|
|
72
|
+
opacity: opacity,
|
|
73
|
+
} }) }));
|
|
74
|
+
});
|
|
75
|
+
exports.OverlayImage.displayName = 'OverlayImage';
|
package/lib/dreaction.d.ts
CHANGED
|
@@ -5,12 +5,15 @@ import { OpenInEditorOptions } from './plugins/openInEditor';
|
|
|
5
5
|
import { TrackGlobalErrorsOptions } from './plugins/trackGlobalErrors';
|
|
6
6
|
import { NetworkingOptions } from './plugins/networking';
|
|
7
7
|
import { DataWatchPayload } from 'dreaction-protocol';
|
|
8
|
+
import overlay from './plugins/overlay';
|
|
8
9
|
export type { ClientOptions };
|
|
10
|
+
export { overlay };
|
|
9
11
|
export declare const reactNativeCorePlugins: any[];
|
|
10
12
|
export interface UseReactNativeOptions {
|
|
11
13
|
errors?: TrackGlobalErrorsOptions | boolean;
|
|
12
14
|
log?: boolean;
|
|
13
15
|
editor?: OpenInEditorOptions | boolean;
|
|
16
|
+
overlay?: boolean;
|
|
14
17
|
asyncStorage?: AsyncStorageOptions | boolean;
|
|
15
18
|
networking?: NetworkingOptions | boolean;
|
|
16
19
|
devTools?: boolean;
|
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;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;
|
|
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;AAItD,OAAO,OAAO,MAAM,mBAAmB,CAAC;AAExC,YAAY,EAAE,aAAa,EAAE,CAAC;AAE9B,OAAO,EAAE,OAAO,EAAE,CAAC;AAMnB,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,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,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;AA6FtE,wBAAgB,QAAQ,eAMvB"}
|
package/lib/dreaction.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.dreaction = exports.reactNativeCorePlugins = void 0;
|
|
6
|
+
exports.dreaction = exports.reactNativeCorePlugins = exports.overlay = void 0;
|
|
7
7
|
exports.watchFPS = watchFPS;
|
|
8
8
|
const react_native_1 = require("react-native");
|
|
9
9
|
const dreaction_client_core_1 = require("dreaction-client-core");
|
|
@@ -19,6 +19,8 @@ const getReactNativePlatformConstants_1 = __importDefault(require("./helpers/get
|
|
|
19
19
|
const react_1 = require("react");
|
|
20
20
|
const getHost_1 = require("./helpers/getHost");
|
|
21
21
|
const common_1 = require("./helpers/common");
|
|
22
|
+
const overlay_1 = __importDefault(require("./plugins/overlay"));
|
|
23
|
+
exports.overlay = overlay_1.default;
|
|
22
24
|
const DREACTION_ASYNC_CLIENT_ID = '@DREACTION/clientId';
|
|
23
25
|
let tempClientId = null;
|
|
24
26
|
exports.reactNativeCorePlugins = [
|
|
@@ -100,6 +102,9 @@ exports.dreaction.useReactNative = (options = {}) => {
|
|
|
100
102
|
if (options.editor !== false) {
|
|
101
103
|
exports.dreaction.use((0, openInEditor_1.default)(getPluginOptions(options.editor)));
|
|
102
104
|
}
|
|
105
|
+
if (options.overlay !== false) {
|
|
106
|
+
exports.dreaction.use((0, overlay_1.default)());
|
|
107
|
+
}
|
|
103
108
|
if (options.asyncStorage !== false) {
|
|
104
109
|
exports.dreaction.use((0, asyncStorage_1.default)(getPluginOptions(options.asyncStorage)));
|
|
105
110
|
}
|
package/lib/index.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
export type { Command } from 'dreaction-protocol';
|
|
2
2
|
import { DraggableBall } from './components/DraggableBall';
|
|
3
3
|
import { Profiler } from './components/Profiler';
|
|
4
|
+
import { OverlayImage } from './components/OverlayImage';
|
|
4
5
|
export { DraggableBall as DReactionDraggableBall };
|
|
6
|
+
export { OverlayImage as DReactionOverlayImage };
|
|
5
7
|
export { Profiler as DReactionProfiler };
|
|
6
8
|
export * from './dreaction';
|
|
7
9
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAEzD,OAAO,EAAE,aAAa,IAAI,sBAAsB,EAAE,CAAC;AACnD,OAAO,EAAE,YAAY,IAAI,qBAAqB,EAAE,CAAC;AACjD,OAAO,EAAE,QAAQ,IAAI,iBAAiB,EAAE,CAAC;AAEzC,cAAc,aAAa,CAAC"}
|
package/lib/index.js
CHANGED
|
@@ -14,9 +14,11 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.DReactionProfiler = exports.DReactionDraggableBall = void 0;
|
|
17
|
+
exports.DReactionProfiler = exports.DReactionOverlayImage = exports.DReactionDraggableBall = void 0;
|
|
18
18
|
const DraggableBall_1 = require("./components/DraggableBall");
|
|
19
19
|
Object.defineProperty(exports, "DReactionDraggableBall", { enumerable: true, get: function () { return DraggableBall_1.DraggableBall; } });
|
|
20
20
|
const Profiler_1 = require("./components/Profiler");
|
|
21
21
|
Object.defineProperty(exports, "DReactionProfiler", { enumerable: true, get: function () { return Profiler_1.Profiler; } });
|
|
22
|
+
const OverlayImage_1 = require("./components/OverlayImage");
|
|
23
|
+
Object.defineProperty(exports, "DReactionOverlayImage", { enumerable: true, get: function () { return OverlayImage_1.OverlayImage; } });
|
|
22
24
|
__exportStar(require("./dreaction"), exports);
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
1
|
+
export declare const emitter: import("mitt").Emitter<Record<import("mitt").EventType, unknown>>;
|
|
2
|
+
export default function OverlayCreator(): () => {
|
|
3
|
+
/**
|
|
4
|
+
* Fires when any Reactotron message arrives.
|
|
5
|
+
*/
|
|
6
|
+
onCommand: (command: import("dreaction-protocol").Command) => void;
|
|
7
|
+
};
|
|
3
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/overlay/index.
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/overlay/index.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,OAAO,mEAAS,CAAC;AAE9B,MAAM,CAAC,OAAO,UAAU,cAAc;IAGhC;;OAEG;;EAQR"}
|
|
@@ -3,26 +3,21 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.emitter = void 0;
|
|
6
7
|
exports.default = OverlayCreator;
|
|
7
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
-
const react_native_1 = require("react-native");
|
|
9
8
|
const mitt_1 = __importDefault(require("mitt"));
|
|
10
|
-
|
|
9
|
+
exports.emitter = (0, mitt_1.default)();
|
|
11
10
|
function OverlayCreator() {
|
|
12
11
|
return function overlay() {
|
|
13
|
-
const emitter = (0, mitt_1.default)();
|
|
14
12
|
return {
|
|
15
13
|
/**
|
|
16
14
|
* Fires when any Reactotron message arrives.
|
|
17
15
|
*/
|
|
18
16
|
onCommand: (command) => {
|
|
19
|
-
if (command.type !==
|
|
17
|
+
if (command.type !== 'overlay')
|
|
20
18
|
return;
|
|
21
19
|
// relay this payload on to the emitter
|
|
22
|
-
emitter.emit(
|
|
23
|
-
},
|
|
24
|
-
features: {
|
|
25
|
-
overlay: (WrappedComponent) => (props = {}) => ((0, jsx_runtime_1.jsxs)(react_native_1.View, { style: { flex: 1 }, children: [(0, jsx_runtime_1.jsx)(WrappedComponent, { ...props }), (0, jsx_runtime_1.jsx)(overlay_1.default, { emitter: emitter })] })),
|
|
20
|
+
exports.emitter.emit('overlay', command.payload);
|
|
26
21
|
},
|
|
27
22
|
};
|
|
28
23
|
};
|
|
@@ -1,161 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
interface Props {
|
|
4
|
-
emitter: any;
|
|
5
|
-
}
|
|
6
|
-
interface State {
|
|
7
|
-
opacity: AnimatableNumericValue;
|
|
8
|
-
uri: string;
|
|
9
|
-
justifyContent: "flex-start" | "flex-end" | "center" | "space-between" | "space-around" | "space-evenly";
|
|
10
|
-
alignItems: FlexAlignType;
|
|
11
|
-
width?: number;
|
|
12
|
-
height?: number;
|
|
13
|
-
growToWindow?: boolean;
|
|
14
|
-
resizeMode?: ImageResizeMode;
|
|
15
|
-
marginLeft?: number;
|
|
16
|
-
marginRight?: number;
|
|
17
|
-
marginTop?: number;
|
|
18
|
-
marginBottom?: number;
|
|
19
|
-
showDebug?: boolean;
|
|
20
|
-
}
|
|
21
|
-
/** An overlay for showing an image to help with layout.
|
|
22
|
-
*
|
|
23
|
-
* @class FullScreenOverlay
|
|
24
|
-
* @extends {Component}
|
|
25
|
-
*/
|
|
26
|
-
declare class FullScreenOverlay extends Component<Props, State> {
|
|
27
|
-
constructor(props: Props);
|
|
28
|
-
createContainerStyle(): {
|
|
29
|
-
opacity: AnimatableNumericValue;
|
|
30
|
-
width: number;
|
|
31
|
-
height: number;
|
|
32
|
-
justifyContent: "center" | "flex-start" | "flex-end" | "space-between" | "space-around" | "space-evenly";
|
|
33
|
-
alignItems: FlexAlignType;
|
|
34
|
-
backfaceVisibility?: "visible" | "hidden" | undefined;
|
|
35
|
-
backgroundColor?: import("react-native").ColorValue | undefined;
|
|
36
|
-
borderBlockColor?: import("react-native").ColorValue | undefined;
|
|
37
|
-
borderBlockEndColor?: import("react-native").ColorValue | undefined;
|
|
38
|
-
borderBlockStartColor?: import("react-native").ColorValue | undefined;
|
|
39
|
-
borderBottomColor?: import("react-native").ColorValue | undefined;
|
|
40
|
-
borderBottomEndRadius?: AnimatableNumericValue | string | undefined;
|
|
41
|
-
borderBottomLeftRadius?: AnimatableNumericValue | string | undefined;
|
|
42
|
-
borderBottomRightRadius?: AnimatableNumericValue | string | undefined;
|
|
43
|
-
borderBottomStartRadius?: AnimatableNumericValue | string | undefined;
|
|
44
|
-
borderColor?: import("react-native").ColorValue | undefined;
|
|
45
|
-
borderCurve?: "circular" | "continuous" | undefined;
|
|
46
|
-
borderEndColor?: import("react-native").ColorValue | undefined;
|
|
47
|
-
borderEndEndRadius?: AnimatableNumericValue | string | undefined;
|
|
48
|
-
borderEndStartRadius?: AnimatableNumericValue | string | undefined;
|
|
49
|
-
borderLeftColor?: import("react-native").ColorValue | undefined;
|
|
50
|
-
borderRadius?: AnimatableNumericValue | string | undefined;
|
|
51
|
-
borderRightColor?: import("react-native").ColorValue | undefined;
|
|
52
|
-
borderStartColor?: import("react-native").ColorValue | undefined;
|
|
53
|
-
borderStartEndRadius?: AnimatableNumericValue | string | undefined;
|
|
54
|
-
borderStartStartRadius?: AnimatableNumericValue | string | undefined;
|
|
55
|
-
borderStyle?: "solid" | "dotted" | "dashed" | undefined;
|
|
56
|
-
borderTopColor?: import("react-native").ColorValue | undefined;
|
|
57
|
-
borderTopEndRadius?: AnimatableNumericValue | string | undefined;
|
|
58
|
-
borderTopLeftRadius?: AnimatableNumericValue | string | undefined;
|
|
59
|
-
borderTopRightRadius?: AnimatableNumericValue | string | undefined;
|
|
60
|
-
borderTopStartRadius?: AnimatableNumericValue | string | undefined;
|
|
61
|
-
elevation?: number | undefined;
|
|
62
|
-
pointerEvents?: "box-none" | "none" | "box-only" | "auto" | undefined;
|
|
63
|
-
isolation?: "auto" | "isolate" | undefined;
|
|
64
|
-
cursor?: import("react-native").CursorValue | undefined;
|
|
65
|
-
boxShadow?: ReadonlyArray<import("react-native").BoxShadowValue> | string | undefined;
|
|
66
|
-
filter?: ReadonlyArray<import("react-native").FilterFunction> | string | undefined;
|
|
67
|
-
alignContent?: "flex-start" | "flex-end" | "center" | "stretch" | "space-between" | "space-around" | "space-evenly" | undefined;
|
|
68
|
-
alignSelf?: "auto" | FlexAlignType | undefined;
|
|
69
|
-
aspectRatio?: number | string | undefined;
|
|
70
|
-
borderBottomWidth?: number | undefined;
|
|
71
|
-
borderEndWidth?: number | undefined;
|
|
72
|
-
borderLeftWidth?: number | undefined;
|
|
73
|
-
borderRightWidth?: number | undefined;
|
|
74
|
-
borderStartWidth?: number | undefined;
|
|
75
|
-
borderTopWidth?: number | undefined;
|
|
76
|
-
borderWidth?: number | undefined;
|
|
77
|
-
bottom?: import("react-native").DimensionValue | undefined;
|
|
78
|
-
display?: "none" | "flex" | undefined;
|
|
79
|
-
end?: import("react-native").DimensionValue | undefined;
|
|
80
|
-
flex?: number | undefined;
|
|
81
|
-
flexBasis?: import("react-native").DimensionValue | undefined;
|
|
82
|
-
flexDirection?: "row" | "column" | "row-reverse" | "column-reverse" | undefined;
|
|
83
|
-
rowGap?: number | string | undefined;
|
|
84
|
-
gap?: number | string | undefined;
|
|
85
|
-
columnGap?: number | string | undefined;
|
|
86
|
-
flexGrow?: number | undefined;
|
|
87
|
-
flexShrink?: number | undefined;
|
|
88
|
-
flexWrap?: "wrap" | "nowrap" | "wrap-reverse" | undefined;
|
|
89
|
-
left?: import("react-native").DimensionValue | undefined;
|
|
90
|
-
margin?: import("react-native").DimensionValue | undefined;
|
|
91
|
-
marginBottom?: import("react-native").DimensionValue | undefined;
|
|
92
|
-
marginEnd?: import("react-native").DimensionValue | undefined;
|
|
93
|
-
marginHorizontal?: import("react-native").DimensionValue | undefined;
|
|
94
|
-
marginLeft?: import("react-native").DimensionValue | undefined;
|
|
95
|
-
marginRight?: import("react-native").DimensionValue | undefined;
|
|
96
|
-
marginStart?: import("react-native").DimensionValue | undefined;
|
|
97
|
-
marginTop?: import("react-native").DimensionValue | undefined;
|
|
98
|
-
marginVertical?: import("react-native").DimensionValue | undefined;
|
|
99
|
-
maxHeight?: import("react-native").DimensionValue | undefined;
|
|
100
|
-
maxWidth?: import("react-native").DimensionValue | undefined;
|
|
101
|
-
minHeight?: import("react-native").DimensionValue | undefined;
|
|
102
|
-
minWidth?: import("react-native").DimensionValue | undefined;
|
|
103
|
-
overflow?: "visible" | "hidden" | "scroll" | undefined;
|
|
104
|
-
padding?: import("react-native").DimensionValue | undefined;
|
|
105
|
-
paddingBottom?: import("react-native").DimensionValue | undefined;
|
|
106
|
-
paddingEnd?: import("react-native").DimensionValue | undefined;
|
|
107
|
-
paddingHorizontal?: import("react-native").DimensionValue | undefined;
|
|
108
|
-
paddingLeft?: import("react-native").DimensionValue | undefined;
|
|
109
|
-
paddingRight?: import("react-native").DimensionValue | undefined;
|
|
110
|
-
paddingStart?: import("react-native").DimensionValue | undefined;
|
|
111
|
-
paddingTop?: import("react-native").DimensionValue | undefined;
|
|
112
|
-
paddingVertical?: import("react-native").DimensionValue | undefined;
|
|
113
|
-
position?: "absolute" | "relative" | "static" | undefined;
|
|
114
|
-
right?: import("react-native").DimensionValue | undefined;
|
|
115
|
-
start?: import("react-native").DimensionValue | undefined;
|
|
116
|
-
top?: import("react-native").DimensionValue | undefined;
|
|
117
|
-
zIndex?: number | undefined;
|
|
118
|
-
direction?: "inherit" | "ltr" | "rtl" | undefined;
|
|
119
|
-
inset?: import("react-native").DimensionValue | undefined;
|
|
120
|
-
insetBlock?: import("react-native").DimensionValue | undefined;
|
|
121
|
-
insetBlockEnd?: import("react-native").DimensionValue | undefined;
|
|
122
|
-
insetBlockStart?: import("react-native").DimensionValue | undefined;
|
|
123
|
-
insetInline?: import("react-native").DimensionValue | undefined;
|
|
124
|
-
insetInlineEnd?: import("react-native").DimensionValue | undefined;
|
|
125
|
-
insetInlineStart?: import("react-native").DimensionValue | undefined;
|
|
126
|
-
marginBlock?: import("react-native").DimensionValue | undefined;
|
|
127
|
-
marginBlockEnd?: import("react-native").DimensionValue | undefined;
|
|
128
|
-
marginBlockStart?: import("react-native").DimensionValue | undefined;
|
|
129
|
-
marginInline?: import("react-native").DimensionValue | undefined;
|
|
130
|
-
marginInlineEnd?: import("react-native").DimensionValue | undefined;
|
|
131
|
-
marginInlineStart?: import("react-native").DimensionValue | undefined;
|
|
132
|
-
paddingBlock?: import("react-native").DimensionValue | undefined;
|
|
133
|
-
paddingBlockEnd?: import("react-native").DimensionValue | undefined;
|
|
134
|
-
paddingBlockStart?: import("react-native").DimensionValue | undefined;
|
|
135
|
-
paddingInline?: import("react-native").DimensionValue | undefined;
|
|
136
|
-
paddingInlineEnd?: import("react-native").DimensionValue | undefined;
|
|
137
|
-
paddingInlineStart?: import("react-native").DimensionValue | undefined;
|
|
138
|
-
shadowColor?: import("react-native").ColorValue | undefined;
|
|
139
|
-
shadowOffset?: Readonly<{
|
|
140
|
-
width: number;
|
|
141
|
-
height: number;
|
|
142
|
-
}> | undefined;
|
|
143
|
-
shadowOpacity?: AnimatableNumericValue | undefined;
|
|
144
|
-
shadowRadius?: number | undefined;
|
|
145
|
-
transform?: Readonly<import("react-native").MaximumOneOf<import("react-native").PerspectiveTransform & import("react-native").RotateTransform & import("react-native").RotateXTransform & import("react-native").RotateYTransform & import("react-native").RotateZTransform & import("react-native").ScaleTransform & import("react-native").ScaleXTransform & import("react-native").ScaleYTransform & import("react-native").TranslateXTransform & import("react-native").TranslateYTransform & import("react-native").SkewXTransform & import("react-native").SkewYTransform & import("react-native").MatrixTransform>[]> | string | undefined;
|
|
146
|
-
transformOrigin?: Array<string | number> | string | undefined;
|
|
147
|
-
transformMatrix?: Array<number> | undefined;
|
|
148
|
-
rotation?: AnimatableNumericValue | undefined;
|
|
149
|
-
scaleX?: AnimatableNumericValue | undefined;
|
|
150
|
-
scaleY?: AnimatableNumericValue | undefined;
|
|
151
|
-
translateX?: AnimatableNumericValue | undefined;
|
|
152
|
-
translateY?: AnimatableNumericValue | undefined;
|
|
153
|
-
};
|
|
154
|
-
renderDebug(): import("react/jsx-runtime").JSX.Element | null;
|
|
1
|
+
export declare const emitter: import("mitt").Emitter<Record<import("mitt").EventType, unknown>>;
|
|
2
|
+
export default function OverlayCreator(): () => {
|
|
155
3
|
/**
|
|
156
|
-
*
|
|
4
|
+
* Fires when any Reactotron message arrives.
|
|
157
5
|
*/
|
|
158
|
-
|
|
159
|
-
}
|
|
160
|
-
export default FullScreenOverlay;
|
|
6
|
+
onCommand: (command: import("dreaction-protocol").Command) => void;
|
|
7
|
+
};
|
|
161
8
|
//# sourceMappingURL=overlay.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"overlay.d.ts","sourceRoot":"","sources":["../../../src/plugins/overlay/overlay.
|
|
1
|
+
{"version":3,"file":"overlay.d.ts","sourceRoot":"","sources":["../../../src/plugins/overlay/overlay.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,OAAO,mEAAS,CAAC;AAE9B,MAAM,CAAC,OAAO,UAAU,cAAc;IAGhC;;OAEG;;EAQR"}
|
|
@@ -1,99 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const react_1 = require("react");
|
|
5
|
-
const react_native_1 = require("react-native");
|
|
6
|
-
const Styles = {
|
|
7
|
-
container: {
|
|
8
|
-
position: "absolute",
|
|
9
|
-
left: 0,
|
|
10
|
-
top: 0,
|
|
11
|
-
right: 0,
|
|
12
|
-
bottom: 0,
|
|
13
|
-
zIndex: 1000,
|
|
14
|
-
opacity: 0.25,
|
|
15
|
-
},
|
|
16
|
-
debugContainer: {
|
|
17
|
-
position: "absolute",
|
|
18
|
-
top: 0,
|
|
19
|
-
left: 0,
|
|
20
|
-
right: 0,
|
|
21
|
-
bottom: 0,
|
|
22
|
-
justifyContent: "center",
|
|
23
|
-
alignItems: "center",
|
|
24
|
-
backgroundColor: "transparent",
|
|
25
|
-
zIndex: 2000,
|
|
26
|
-
},
|
|
27
|
-
debugTextContainer: {
|
|
28
|
-
backgroundColor: "lightgray",
|
|
29
|
-
margin: 50,
|
|
30
|
-
padding: 20,
|
|
31
|
-
},
|
|
32
|
-
debugText: {
|
|
33
|
-
color: "red",
|
|
34
|
-
fontSize: 16,
|
|
35
|
-
marginBottom: 10,
|
|
36
|
-
},
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
4
|
};
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
createContainerStyle() {
|
|
58
|
-
const { opacity, justifyContent, alignItems } = this.state;
|
|
59
|
-
const { width, height } = react_native_1.Dimensions.get("window");
|
|
60
|
-
const containerStyle = {
|
|
61
|
-
...Styles.container,
|
|
62
|
-
opacity,
|
|
63
|
-
width,
|
|
64
|
-
height,
|
|
65
|
-
justifyContent,
|
|
66
|
-
alignItems,
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.emitter = void 0;
|
|
7
|
+
exports.default = OverlayCreator;
|
|
8
|
+
const mitt_1 = __importDefault(require("mitt"));
|
|
9
|
+
exports.emitter = (0, mitt_1.default)();
|
|
10
|
+
function OverlayCreator() {
|
|
11
|
+
return function overlay() {
|
|
12
|
+
return {
|
|
13
|
+
/**
|
|
14
|
+
* Fires when any Reactotron message arrives.
|
|
15
|
+
*/
|
|
16
|
+
onCommand: (command) => {
|
|
17
|
+
if (command.type !== 'overlay')
|
|
18
|
+
return;
|
|
19
|
+
// relay this payload on to the emitter
|
|
20
|
+
exports.emitter.emit('overlay', command.payload);
|
|
21
|
+
},
|
|
67
22
|
};
|
|
68
|
-
|
|
69
|
-
}
|
|
70
|
-
renderDebug() {
|
|
71
|
-
const { showDebug } = this.state;
|
|
72
|
-
// If Reactotron is configured properly it should be disabled in production.
|
|
73
|
-
// We'll throw a __DEV__ check in here just in case it get's feisty.
|
|
74
|
-
if (!__DEV__ || !showDebug)
|
|
75
|
-
return null;
|
|
76
|
-
return ((0, jsx_runtime_1.jsx)(react_native_1.View, { style: Styles.debugContainer, pointerEvents: "none", children: (0, jsx_runtime_1.jsx)(react_native_1.View, { style: Styles.debugTextContainer, children: Object.keys(this.state).map((key) => {
|
|
77
|
-
if (key === "showDebug")
|
|
78
|
-
return null;
|
|
79
|
-
const keyName = key === "uri" ? "have image" : key;
|
|
80
|
-
const value = key === "uri" ? !!this.state[key] : this.state[key];
|
|
81
|
-
return ((0, jsx_runtime_1.jsx)(react_native_1.Text, { style: Styles.debugText, children: `${keyName}: ${value}` }, key));
|
|
82
|
-
}) }) }));
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* Draw.
|
|
86
|
-
*/
|
|
87
|
-
render() {
|
|
88
|
-
const { uri, width, height, growToWindow, resizeMode, marginLeft = 0, marginRight = 0, marginTop = 0, marginBottom = 0, } = this.state;
|
|
89
|
-
const imageStyle = { width, height, marginTop, marginRight, marginBottom, marginLeft };
|
|
90
|
-
if (growToWindow) {
|
|
91
|
-
const windowSize = react_native_1.Dimensions.get("window");
|
|
92
|
-
imageStyle.width = windowSize.width;
|
|
93
|
-
imageStyle.height = windowSize.height;
|
|
94
|
-
}
|
|
95
|
-
const image = uri ? ((0, jsx_runtime_1.jsx)(react_native_1.Image, { source: { uri }, style: imageStyle, resizeMode: growToWindow ? resizeMode : null })) : ((0, jsx_runtime_1.jsx)(react_native_1.View, {}));
|
|
96
|
-
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(react_native_1.View, { style: this.createContainerStyle(), pointerEvents: "none", children: image }), this.renderDebug()] }));
|
|
97
|
-
}
|
|
23
|
+
};
|
|
98
24
|
}
|
|
99
|
-
exports.default = FullScreenOverlay;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const emitter: import("mitt").Emitter<Record<import("mitt").EventType, unknown>>;
|
|
2
|
+
export default function OverlayCreator(): () => {
|
|
3
|
+
/**
|
|
4
|
+
* Fires when any Reactotron message arrives.
|
|
5
|
+
*/
|
|
6
|
+
onCommand: (command: import("dreaction-protocol").Command) => void;
|
|
7
|
+
};
|
|
8
|
+
//# sourceMappingURL=overlay.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"overlay.d.ts","sourceRoot":"","sources":["../../src/plugins/overlay.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,OAAO,mEAAS,CAAC;AAE9B,MAAM,CAAC,OAAO,UAAU,cAAc;IAGhC;;OAEG;;EAWR"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.emitter = void 0;
|
|
7
|
+
exports.default = OverlayCreator;
|
|
8
|
+
const mitt_1 = __importDefault(require("mitt"));
|
|
9
|
+
exports.emitter = (0, mitt_1.default)();
|
|
10
|
+
function OverlayCreator() {
|
|
11
|
+
return function overlay() {
|
|
12
|
+
return {
|
|
13
|
+
/**
|
|
14
|
+
* Fires when any Reactotron message arrives.
|
|
15
|
+
*/
|
|
16
|
+
onCommand: (command) => {
|
|
17
|
+
if (command.type !== 'overlay') {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
// relay this payload on to the emitter
|
|
21
|
+
exports.emitter.emit('overlay', command.payload);
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
}
|
|
@@ -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;;;
|
|
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"}
|
|
@@ -8,9 +8,9 @@ const trackGlobalLogs = () => (dreaction) => {
|
|
|
8
8
|
(0, dreaction_client_core_1.assertHasLoggerPlugin)(dreaction);
|
|
9
9
|
const client = dreaction;
|
|
10
10
|
const originalConsoleLog = console.log;
|
|
11
|
+
const originalConsoleInfo = console.info;
|
|
11
12
|
const originalConsoleWarn = console.warn;
|
|
12
13
|
const originalConsoleDebug = console.debug;
|
|
13
|
-
const originalConsoleInfo = console.info;
|
|
14
14
|
return {
|
|
15
15
|
onConnect: () => {
|
|
16
16
|
console.log = (...args) => {
|
|
@@ -19,7 +19,7 @@ const trackGlobalLogs = () => (dreaction) => {
|
|
|
19
19
|
};
|
|
20
20
|
console.info = (...args) => {
|
|
21
21
|
originalConsoleInfo(...args);
|
|
22
|
-
client.
|
|
22
|
+
client.info(...args);
|
|
23
23
|
};
|
|
24
24
|
console.warn = (...args) => {
|
|
25
25
|
originalConsoleWarn(...args);
|
|
@@ -36,7 +36,7 @@ const trackGlobalLogs = () => (dreaction) => {
|
|
|
36
36
|
console.warn = originalConsoleWarn;
|
|
37
37
|
console.debug = originalConsoleDebug;
|
|
38
38
|
console.info = originalConsoleInfo;
|
|
39
|
-
}
|
|
39
|
+
},
|
|
40
40
|
};
|
|
41
41
|
};
|
|
42
42
|
exports.default = trackGlobalLogs;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dreaction-react-native",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.8.2",
|
|
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",
|
|
@@ -31,8 +31,9 @@
|
|
|
31
31
|
},
|
|
32
32
|
"homepage": "https://github.com/moonrailgun/dreaction#readme",
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"
|
|
35
|
-
"dreaction-
|
|
34
|
+
"mitt": "^3.0.1",
|
|
35
|
+
"dreaction-client-core": "1.2.2",
|
|
36
|
+
"dreaction-protocol": "1.0.9"
|
|
36
37
|
},
|
|
37
38
|
"devDependencies": {
|
|
38
39
|
"@react-native-async-storage/async-storage": "^2.1.0",
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
|
+
import { Image, Dimensions, View } from 'react-native';
|
|
3
|
+
import { emitter } from '../plugins/overlay';
|
|
4
|
+
|
|
5
|
+
export const OverlayImage: React.FC = React.memo(() => {
|
|
6
|
+
const [uri, setUri] = useState<string | null>(null);
|
|
7
|
+
const [opacity, setOpacity] = useState(0.5);
|
|
8
|
+
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
const handler = (payload: any) => {
|
|
11
|
+
setUri(payload.uri);
|
|
12
|
+
if (payload.opacity !== undefined) {
|
|
13
|
+
setOpacity(payload.opacity);
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
emitter.on('overlay', handler);
|
|
18
|
+
|
|
19
|
+
return () => {
|
|
20
|
+
emitter.off('overlay', handler);
|
|
21
|
+
};
|
|
22
|
+
}, []);
|
|
23
|
+
|
|
24
|
+
if (!uri) {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const { width, height } = Dimensions.get('window');
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<View
|
|
32
|
+
pointerEvents="none"
|
|
33
|
+
style={{
|
|
34
|
+
position: 'absolute',
|
|
35
|
+
top: 0,
|
|
36
|
+
left: 0,
|
|
37
|
+
width: width,
|
|
38
|
+
height: height,
|
|
39
|
+
}}
|
|
40
|
+
>
|
|
41
|
+
<Image
|
|
42
|
+
source={{ uri: uri }}
|
|
43
|
+
resizeMode="contain"
|
|
44
|
+
style={{
|
|
45
|
+
position: 'absolute',
|
|
46
|
+
top: 0,
|
|
47
|
+
left: 0,
|
|
48
|
+
width: width,
|
|
49
|
+
height: height,
|
|
50
|
+
opacity: opacity,
|
|
51
|
+
}}
|
|
52
|
+
/>
|
|
53
|
+
</View>
|
|
54
|
+
);
|
|
55
|
+
});
|
|
56
|
+
OverlayImage.displayName = 'OverlayImage';
|
package/src/dreaction.ts
CHANGED
|
@@ -23,9 +23,12 @@ import { DataWatchPayload } from 'dreaction-protocol';
|
|
|
23
23
|
import { useEffect } from 'react';
|
|
24
24
|
import { getHost } from './helpers/getHost';
|
|
25
25
|
import { isDev } from './helpers/common';
|
|
26
|
+
import overlay from './plugins/overlay';
|
|
26
27
|
|
|
27
28
|
export type { ClientOptions };
|
|
28
29
|
|
|
30
|
+
export { overlay };
|
|
31
|
+
|
|
29
32
|
const DREACTION_ASYNC_CLIENT_ID = '@DREACTION/clientId';
|
|
30
33
|
|
|
31
34
|
let tempClientId: string | null = null;
|
|
@@ -43,6 +46,7 @@ export interface UseReactNativeOptions {
|
|
|
43
46
|
errors?: TrackGlobalErrorsOptions | boolean;
|
|
44
47
|
log?: boolean;
|
|
45
48
|
editor?: OpenInEditorOptions | boolean;
|
|
49
|
+
overlay?: boolean;
|
|
46
50
|
asyncStorage?: AsyncStorageOptions | boolean;
|
|
47
51
|
networking?: NetworkingOptions | boolean;
|
|
48
52
|
devTools?: boolean;
|
|
@@ -177,6 +181,10 @@ dreaction.useReactNative = (options: UseReactNativeOptions = {}) => {
|
|
|
177
181
|
dreaction.use(openInEditor(getPluginOptions(options.editor as any)));
|
|
178
182
|
}
|
|
179
183
|
|
|
184
|
+
if (options.overlay !== false) {
|
|
185
|
+
dreaction.use(overlay());
|
|
186
|
+
}
|
|
187
|
+
|
|
180
188
|
if (options.asyncStorage !== false) {
|
|
181
189
|
dreaction.use(
|
|
182
190
|
asyncStorage(getPluginOptions(options.asyncStorage) as any) as any
|
package/src/index.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
export type { Command } from 'dreaction-protocol';
|
|
2
2
|
import { DraggableBall } from './components/DraggableBall';
|
|
3
3
|
import { Profiler } from './components/Profiler';
|
|
4
|
+
import { OverlayImage } from './components/OverlayImage';
|
|
4
5
|
|
|
5
6
|
export { DraggableBall as DReactionDraggableBall };
|
|
7
|
+
export { OverlayImage as DReactionOverlayImage };
|
|
6
8
|
export { Profiler as DReactionProfiler };
|
|
7
9
|
|
|
8
10
|
export * from './dreaction';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import mitt from 'mitt';
|
|
2
|
+
import type { DReactionCore, Plugin } from 'dreaction-client-core';
|
|
3
|
+
|
|
4
|
+
export const emitter = mitt();
|
|
5
|
+
|
|
6
|
+
export default function OverlayCreator() {
|
|
7
|
+
return function overlay() {
|
|
8
|
+
return {
|
|
9
|
+
/**
|
|
10
|
+
* Fires when any Reactotron message arrives.
|
|
11
|
+
*/
|
|
12
|
+
onCommand: (command) => {
|
|
13
|
+
if (command.type !== 'overlay') {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// relay this payload on to the emitter
|
|
18
|
+
emitter.emit('overlay', command.payload);
|
|
19
|
+
},
|
|
20
|
+
} satisfies Plugin<DReactionCore>;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
@@ -15,9 +15,9 @@ const trackGlobalLogs = () => (dreaction: DReactionCore) => {
|
|
|
15
15
|
InferFeatures<DReactionCore, LoggerPlugin>;
|
|
16
16
|
|
|
17
17
|
const originalConsoleLog = console.log;
|
|
18
|
+
const originalConsoleInfo = console.info;
|
|
18
19
|
const originalConsoleWarn = console.warn;
|
|
19
20
|
const originalConsoleDebug = console.debug;
|
|
20
|
-
const originalConsoleInfo = console.info;
|
|
21
21
|
|
|
22
22
|
return {
|
|
23
23
|
onConnect: () => {
|
|
@@ -27,13 +27,12 @@ const trackGlobalLogs = () => (dreaction: DReactionCore) => {
|
|
|
27
27
|
};
|
|
28
28
|
console.info = (...args: Parameters<typeof console.info>) => {
|
|
29
29
|
originalConsoleInfo(...args);
|
|
30
|
-
client.
|
|
30
|
+
client.info(...args);
|
|
31
31
|
};
|
|
32
32
|
console.warn = (...args: Parameters<typeof console.warn>) => {
|
|
33
33
|
originalConsoleWarn(...args);
|
|
34
34
|
client.warn(args[0]);
|
|
35
35
|
};
|
|
36
|
-
|
|
37
36
|
console.debug = (...args: Parameters<typeof console.debug>) => {
|
|
38
37
|
originalConsoleDebug(...args);
|
|
39
38
|
client.debug(args[0]);
|
|
@@ -46,7 +45,7 @@ const trackGlobalLogs = () => (dreaction: DReactionCore) => {
|
|
|
46
45
|
console.warn = originalConsoleWarn;
|
|
47
46
|
console.debug = originalConsoleDebug;
|
|
48
47
|
console.info = originalConsoleInfo;
|
|
49
|
-
}
|
|
48
|
+
},
|
|
50
49
|
} satisfies Plugin<DReactionCore>;
|
|
51
50
|
};
|
|
52
51
|
|