@react-navigation/devtools 6.0.16 → 7.0.0-alpha.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/commonjs/index.js +1 -5
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/index.js +0 -3
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/src/index.d.ts +0 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/parseHermesStack.d.ts +2 -2
- package/lib/typescript/src/parseHermesStack.d.ts.map +1 -1
- package/lib/typescript/src/useDevToolsBase.d.ts +2 -2
- package/lib/typescript/src/useDevToolsBase.d.ts.map +1 -1
- package/package.json +8 -9
- package/src/index.tsx +0 -3
- package/lib/commonjs/useFlipper.js +0 -113
- package/lib/commonjs/useFlipper.js.map +0 -1
- package/lib/module/useFlipper.js +0 -104
- package/lib/module/useFlipper.js.map +0 -1
- package/lib/typescript/src/useFlipper.d.ts +0 -4
- package/lib/typescript/src/useFlipper.d.ts.map +0 -1
- package/src/useFlipper.tsx +0 -115
package/lib/commonjs/index.js
CHANGED
|
@@ -3,17 +3,13 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.useReduxDevToolsExtension =
|
|
6
|
+
exports.useReduxDevToolsExtension = void 0;
|
|
7
7
|
const noop = () => {};
|
|
8
8
|
let useReduxDevToolsExtension;
|
|
9
9
|
exports.useReduxDevToolsExtension = useReduxDevToolsExtension;
|
|
10
|
-
let useFlipper;
|
|
11
|
-
exports.useFlipper = useFlipper;
|
|
12
10
|
if (process.env.NODE_ENV !== 'production') {
|
|
13
11
|
exports.useReduxDevToolsExtension = useReduxDevToolsExtension = require('./useReduxDevToolsExtension').default;
|
|
14
|
-
exports.useFlipper = useFlipper = require('./useFlipper').default;
|
|
15
12
|
} else {
|
|
16
13
|
exports.useReduxDevToolsExtension = useReduxDevToolsExtension = noop;
|
|
17
|
-
exports.useFlipper = useFlipper = noop;
|
|
18
14
|
}
|
|
19
15
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["noop","useReduxDevToolsExtension","
|
|
1
|
+
{"version":3,"names":["noop","useReduxDevToolsExtension","process","env","NODE_ENV","require","default"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;;;;;AAAA,MAAMA,IAAS,GAAG,MAAM,CAAC,CAAC;AAEnB,IAAIC,yBAA+E;AAAC;AAE3F,IAAIC,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,YAAY,EAAE;EACzC,oCAAAH,yBAAyB,GAAGI,OAAO,CAAC,6BAA6B,CAAC,CAACC,OAAO;AAC5E,CAAC,MAAM;EACL,oCAAAL,yBAAyB,GAAGD,IAAI;AAClC"}
|
package/lib/module/index.js
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
const noop = () => {};
|
|
2
2
|
export let useReduxDevToolsExtension;
|
|
3
|
-
export let useFlipper;
|
|
4
3
|
if (process.env.NODE_ENV !== 'production') {
|
|
5
4
|
useReduxDevToolsExtension = require('./useReduxDevToolsExtension').default;
|
|
6
|
-
useFlipper = require('./useFlipper').default;
|
|
7
5
|
} else {
|
|
8
6
|
useReduxDevToolsExtension = noop;
|
|
9
|
-
useFlipper = noop;
|
|
10
7
|
}
|
|
11
8
|
//# sourceMappingURL=index.js.map
|
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["noop","useReduxDevToolsExtension","
|
|
1
|
+
{"version":3,"names":["noop","useReduxDevToolsExtension","process","env","NODE_ENV","require","default"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":"AAAA,MAAMA,IAAS,GAAG,MAAM,CAAC,CAAC;AAE1B,OAAO,IAAIC,yBAA+E;AAE1F,IAAIC,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,YAAY,EAAE;EACzCH,yBAAyB,GAAGI,OAAO,CAAC,6BAA6B,CAAC,CAACC,OAAO;AAC5E,CAAC,MAAM;EACLL,yBAAyB,GAAGD,IAAI;AAClC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAEA,eAAO,IAAI,yBAAyB,EAAE,cAAc,6BAA6B,EAAE,OAAO,CAAC
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAEA,eAAO,IAAI,yBAAyB,EAAE,cAAc,6BAA6B,EAAE,OAAO,CAAC"}
|
|
@@ -19,7 +19,7 @@ interface HermesStackLocationBytecode {
|
|
|
19
19
|
line1Based: number;
|
|
20
20
|
virtualOffset0Based: number;
|
|
21
21
|
}
|
|
22
|
-
|
|
22
|
+
type HermesStackLocation = HermesStackLocationNative | HermesStackLocationSource | HermesStackLocationBytecode;
|
|
23
23
|
interface HermesStackEntryFrame {
|
|
24
24
|
type: 'FRAME';
|
|
25
25
|
location: HermesStackLocation;
|
|
@@ -29,7 +29,7 @@ interface HermesStackEntrySkipped {
|
|
|
29
29
|
type: 'SKIPPED';
|
|
30
30
|
count: number;
|
|
31
31
|
}
|
|
32
|
-
|
|
32
|
+
type HermesStackEntry = HermesStackEntryFrame | HermesStackEntrySkipped;
|
|
33
33
|
export interface HermesParsedStack {
|
|
34
34
|
message: string;
|
|
35
35
|
entries: HermesStackEntry[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parseHermesStack.d.ts","sourceRoot":"","sources":["../../../src/parseHermesStack.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,UAAU,yBAAyB;IACjC,IAAI,EAAE,QAAQ,CAAC;CAChB;AAED,UAAU,yBAAyB;IACjC,IAAI,EAAE,QAAQ,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,UAAU,2BAA2B;IACnC,IAAI,EAAE,UAAU,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,mBAAmB,EAAE,MAAM,CAAC;CAC7B;AAED,
|
|
1
|
+
{"version":3,"file":"parseHermesStack.d.ts","sourceRoot":"","sources":["../../../src/parseHermesStack.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,UAAU,yBAAyB;IACjC,IAAI,EAAE,QAAQ,CAAC;CAChB;AAED,UAAU,yBAAyB;IACjC,IAAI,EAAE,QAAQ,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,UAAU,2BAA2B;IACnC,IAAI,EAAE,UAAU,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,mBAAmB,EAAE,MAAM,CAAC;CAC7B;AAED,KAAK,mBAAmB,GACpB,yBAAyB,GACzB,yBAAyB,GACzB,2BAA2B,CAAC;AAEhC,UAAU,qBAAqB;IAC7B,IAAI,EAAE,OAAO,CAAC;IACd,QAAQ,EAAE,mBAAmB,CAAC;IAC9B,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,UAAU,uBAAuB;IAC/B,IAAI,EAAE,SAAS,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,KAAK,gBAAgB,GAAG,qBAAqB,GAAG,uBAAuB,CAAC;AAExE,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,gBAAgB,EAAE,CAAC;CAC7B;AAkDD,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,iBAAiB,CAoBzE"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { NavigationAction, NavigationContainerRef, NavigationState } from '@react-navigation/core';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
|
|
3
|
+
type InitData = {
|
|
4
4
|
type: 'init';
|
|
5
5
|
state: NavigationState | undefined;
|
|
6
6
|
};
|
|
7
|
-
|
|
7
|
+
type ActionData = {
|
|
8
8
|
type: 'action';
|
|
9
9
|
action: NavigationAction;
|
|
10
10
|
state: NavigationState | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDevToolsBase.d.ts","sourceRoot":"","sources":["../../../src/useDevToolsBase.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAChB,sBAAsB,EACtB,eAAe,EAChB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAmB/B,
|
|
1
|
+
{"version":3,"file":"useDevToolsBase.d.ts","sourceRoot":"","sources":["../../../src/useDevToolsBase.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAChB,sBAAsB,EACtB,eAAe,EAChB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAmB/B,KAAK,QAAQ,GAAG;IACd,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,eAAe,GAAG,SAAS,CAAC;CACpC,CAAC;AAEF,KAAK,UAAU,GAAG;IAChB,IAAI,EAAE,QAAQ,CAAC;IACf,MAAM,EAAE,gBAAgB,CAAC;IACzB,KAAK,EAAE,eAAe,GAAG,SAAS,CAAC;IACnC,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;CAC3B,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,eAAe,CACrC,GAAG,EAAE,KAAK,CAAC,SAAS,CAAC,sBAAsB,CAAC,GAAG,CAAC,CAAC,EACjD,QAAQ,EAAE,CAAC,MAAM,EAAE,QAAQ,GAAG,UAAU,KAAK,IAAI;uBAyJvC,eAAe;EAU1B"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-navigation/devtools",
|
|
3
3
|
"description": "Developer tools for React Navigation",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "7.0.0-alpha.0",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
7
7
|
"react-native",
|
|
@@ -36,20 +36,19 @@
|
|
|
36
36
|
"clean": "del lib"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"deep-equal": "^2.0
|
|
39
|
+
"deep-equal": "^2.1.0",
|
|
40
40
|
"nanoid": "^3.1.23",
|
|
41
41
|
"stacktrace-parser": "^0.1.10"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"@react-navigation/core": "^
|
|
44
|
+
"@react-navigation/core": "^7.0.0-alpha.0",
|
|
45
45
|
"@testing-library/react-native": "^11.5.0",
|
|
46
46
|
"@types/deep-equal": "^1.0.1",
|
|
47
|
-
"@types/react": "~18.0.
|
|
48
|
-
"del-cli": "^
|
|
49
|
-
"react": "18.
|
|
47
|
+
"@types/react": "~18.0.26",
|
|
48
|
+
"del-cli": "^5.0.0",
|
|
49
|
+
"react": "18.1.0",
|
|
50
50
|
"react-native-builder-bob": "^0.20.3",
|
|
51
|
-
"
|
|
52
|
-
"typescript": "^4.7.4"
|
|
51
|
+
"typescript": "^4.9.4"
|
|
53
52
|
},
|
|
54
53
|
"peerDependencies": {
|
|
55
54
|
"react": "*"
|
|
@@ -68,5 +67,5 @@
|
|
|
68
67
|
]
|
|
69
68
|
]
|
|
70
69
|
},
|
|
71
|
-
"gitHead": "
|
|
70
|
+
"gitHead": "ad722b882e0c40b1d1bc025d70112ddb126f265e"
|
|
72
71
|
}
|
package/src/index.tsx
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
const noop: any = () => {};
|
|
2
2
|
|
|
3
3
|
export let useReduxDevToolsExtension: typeof import('./useReduxDevToolsExtension').default;
|
|
4
|
-
export let useFlipper: typeof import('./useFlipper').default;
|
|
5
4
|
|
|
6
5
|
if (process.env.NODE_ENV !== 'production') {
|
|
7
6
|
useReduxDevToolsExtension = require('./useReduxDevToolsExtension').default;
|
|
8
|
-
useFlipper = require('./useFlipper').default;
|
|
9
7
|
} else {
|
|
10
8
|
useReduxDevToolsExtension = noop;
|
|
11
|
-
useFlipper = noop;
|
|
12
9
|
}
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = useFlipper;
|
|
7
|
-
var _nonSecure = require("nanoid/non-secure");
|
|
8
|
-
var React = _interopRequireWildcard(require("react"));
|
|
9
|
-
var _useDevToolsBase = _interopRequireDefault(require("./useDevToolsBase"));
|
|
10
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
12
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
13
|
-
let FlipperModule;
|
|
14
|
-
try {
|
|
15
|
-
FlipperModule = require('react-native-flipper');
|
|
16
|
-
} catch (e) {
|
|
17
|
-
// Do nothing
|
|
18
|
-
}
|
|
19
|
-
function useFlipper(ref) {
|
|
20
|
-
if (FlipperModule == null) {
|
|
21
|
-
throw new Error("Please install the 'react-native-flipper' package in your project to use Flipper integration for React Navigation.");
|
|
22
|
-
}
|
|
23
|
-
const {
|
|
24
|
-
addPlugin
|
|
25
|
-
} = FlipperModule;
|
|
26
|
-
const connectionRef = React.useRef();
|
|
27
|
-
const {
|
|
28
|
-
resetRoot
|
|
29
|
-
} = (0, _useDevToolsBase.default)(ref, result => {
|
|
30
|
-
const connection = connectionRef.current;
|
|
31
|
-
if (!connection) {
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
switch (result.type) {
|
|
35
|
-
case 'init':
|
|
36
|
-
connection.send('init', {
|
|
37
|
-
id: (0, _nonSecure.nanoid)(),
|
|
38
|
-
state: result.state
|
|
39
|
-
});
|
|
40
|
-
break;
|
|
41
|
-
case 'action':
|
|
42
|
-
connection.send('action', {
|
|
43
|
-
id: (0, _nonSecure.nanoid)(),
|
|
44
|
-
action: result.action,
|
|
45
|
-
state: result.state,
|
|
46
|
-
stack: result.stack
|
|
47
|
-
});
|
|
48
|
-
break;
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
React.useEffect(() => {
|
|
52
|
-
addPlugin({
|
|
53
|
-
getId() {
|
|
54
|
-
return 'react-navigation';
|
|
55
|
-
},
|
|
56
|
-
async onConnect(connection) {
|
|
57
|
-
connectionRef.current = connection;
|
|
58
|
-
const on = (event, listener) => {
|
|
59
|
-
connection.receive(event, (params, responder) => {
|
|
60
|
-
try {
|
|
61
|
-
const result = listener(params);
|
|
62
|
-
|
|
63
|
-
// Return null instead of undefined, otherwise flipper doesn't respond
|
|
64
|
-
responder.success(result ?? null);
|
|
65
|
-
} catch (e) {
|
|
66
|
-
responder.error(e);
|
|
67
|
-
}
|
|
68
|
-
});
|
|
69
|
-
};
|
|
70
|
-
on('navigation.invoke', _ref => {
|
|
71
|
-
var _ref$current;
|
|
72
|
-
let {
|
|
73
|
-
method,
|
|
74
|
-
args = []
|
|
75
|
-
} = _ref;
|
|
76
|
-
switch (method) {
|
|
77
|
-
case 'resetRoot':
|
|
78
|
-
return resetRoot(args[0]);
|
|
79
|
-
default:
|
|
80
|
-
// @ts-expect-error: we want to call arbitrary methods here
|
|
81
|
-
return (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current[method](...args);
|
|
82
|
-
}
|
|
83
|
-
});
|
|
84
|
-
on('linking.invoke', _ref2 => {
|
|
85
|
-
var _global$REACT_NAVIGAT, _global$REACT_NAVIGAT2, _args$;
|
|
86
|
-
let {
|
|
87
|
-
method,
|
|
88
|
-
args = []
|
|
89
|
-
} = _ref2;
|
|
90
|
-
const linking = ref.current ? // @ts-ignore: this might not exist
|
|
91
|
-
(_global$REACT_NAVIGAT = global.REACT_NAVIGATION_DEVTOOLS) === null || _global$REACT_NAVIGAT === void 0 ? void 0 : (_global$REACT_NAVIGAT2 = _global$REACT_NAVIGAT.get(ref.current)) === null || _global$REACT_NAVIGAT2 === void 0 ? void 0 : _global$REACT_NAVIGAT2.linking : null;
|
|
92
|
-
switch (method) {
|
|
93
|
-
case 'getStateFromPath':
|
|
94
|
-
case 'getPathFromState':
|
|
95
|
-
case 'getActionFromState':
|
|
96
|
-
return linking === null || linking === void 0 ? void 0 : linking[method](args[0], (_args$ = args[1]) !== null && _args$ !== void 0 && _args$.trim() ?
|
|
97
|
-
// eslint-disable-next-line no-eval
|
|
98
|
-
eval(`(function() { return ${args[1]}; }())`) : linking.config);
|
|
99
|
-
default:
|
|
100
|
-
return linking === null || linking === void 0 ? void 0 : linking[method](...args);
|
|
101
|
-
}
|
|
102
|
-
});
|
|
103
|
-
},
|
|
104
|
-
onDisconnect() {
|
|
105
|
-
connectionRef.current = undefined;
|
|
106
|
-
},
|
|
107
|
-
runInBackground() {
|
|
108
|
-
return false;
|
|
109
|
-
}
|
|
110
|
-
});
|
|
111
|
-
}, [addPlugin, ref, resetRoot]);
|
|
112
|
-
}
|
|
113
|
-
//# sourceMappingURL=useFlipper.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["FlipperModule","require","e","useFlipper","ref","Error","addPlugin","connectionRef","React","useRef","resetRoot","useDevToolsBase","result","connection","current","type","send","id","nanoid","state","action","stack","useEffect","getId","onConnect","on","event","listener","receive","params","responder","success","error","method","args","linking","global","REACT_NAVIGATION_DEVTOOLS","get","trim","eval","config","onDisconnect","undefined","runInBackground"],"sourceRoot":"../../src","sources":["useFlipper.tsx"],"mappings":";;;;;;AACA;AACA;AAGA;AAAgD;AAAA;AAAA;AAEhD,IAAIA,aAAgE;AAEpE,IAAI;EACFA,aAAa,GAAGC,OAAO,CAAC,sBAAsB,CAAC;AACjD,CAAC,CAAC,OAAOC,CAAC,EAAE;EACV;AAAA;AAGa,SAASC,UAAU,CAChCC,GAAiD,EACjD;EACA,IAAIJ,aAAa,IAAI,IAAI,EAAE;IACzB,MAAM,IAAIK,KAAK,CACb,oHAAoH,CACrH;EACH;EAEA,MAAM;IAAEC;EAAU,CAAC,GAAGN,aAAa;EAEnC,MAAMO,aAAa,GAAGC,KAAK,CAACC,MAAM,EAA6B;EAE/D,MAAM;IAAEC;EAAU,CAAC,GAAG,IAAAC,wBAAe,EAACP,GAAG,EAAGQ,MAAM,IAAK;IACrD,MAAMC,UAAU,GAAGN,aAAa,CAACO,OAAO;IAExC,IAAI,CAACD,UAAU,EAAE;MACf;IACF;IAEA,QAAQD,MAAM,CAACG,IAAI;MACjB,KAAK,MAAM;QACTF,UAAU,CAACG,IAAI,CAAC,MAAM,EAAE;UACtBC,EAAE,EAAE,IAAAC,iBAAM,GAAE;UACZC,KAAK,EAAEP,MAAM,CAACO;QAChB,CAAC,CAAC;QACF;MACF,KAAK,QAAQ;QACXN,UAAU,CAACG,IAAI,CAAC,QAAQ,EAAE;UACxBC,EAAE,EA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,yBACAsB,MAAM,CAACC,yBAAyB,oFAAhC,sBAAkCC,GAAG,CAAClC,GAAG,CAACU,OAAO,CAAC,2DAAlD,uBAAoDqB,OAAO,GAC3D,IAAI;UAER,QAAQF,MAAM;YACZ,KAAK,kBAAkB;YACvB,KAAK,kBAAkB;YACvB,KAAK,oBAAoB;cACvB,OAAOE,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAGF,MAAM,CAAC,CACtBC,IAAI,CAAC,CAAC,CAAC,EACP,UAAAA,IAAI,CAAC,CAAC,CAAC,mCAAP,OAASK,IAAI,EAAE;cACX;cACAC,IAAI,CAAE,wBAAuBN,IAAI,CAAC,CAAC,CAAE,QAAO,CAAC,GAC7CC,OAAO,CAACM,MAAM,CACnB;YACH;cACE,OAAON,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAGF,MAAM,CAAC,CAAC,GAAGC,IAAI,CAAC;UAAC;QAExC,CAAC,CAAC;MACJ,CAAC;MACDQ,YAAY,GAAG;QACbnC,aAAa,CAACO,OAAO,GAAG6B,SAAS;MACnC,CAAC;MACDC,eAAe,GAAG;QAChB,OAAO,KAAK;MACd;IACF,CAAC,CAAC;EACJ,CAAC,EAAE,CAACtC,SAAS,EAAEF,GAAG,EAAEM,SAAS,CAAC,CAAC;AACjC"}
|
package/lib/module/useFlipper.js
DELETED
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
import { nanoid } from 'nanoid/non-secure';
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import useDevToolsBase from './useDevToolsBase';
|
|
4
|
-
let FlipperModule;
|
|
5
|
-
try {
|
|
6
|
-
FlipperModule = require('react-native-flipper');
|
|
7
|
-
} catch (e) {
|
|
8
|
-
// Do nothing
|
|
9
|
-
}
|
|
10
|
-
export default function useFlipper(ref) {
|
|
11
|
-
if (FlipperModule == null) {
|
|
12
|
-
throw new Error("Please install the 'react-native-flipper' package in your project to use Flipper integration for React Navigation.");
|
|
13
|
-
}
|
|
14
|
-
const {
|
|
15
|
-
addPlugin
|
|
16
|
-
} = FlipperModule;
|
|
17
|
-
const connectionRef = React.useRef();
|
|
18
|
-
const {
|
|
19
|
-
resetRoot
|
|
20
|
-
} = useDevToolsBase(ref, result => {
|
|
21
|
-
const connection = connectionRef.current;
|
|
22
|
-
if (!connection) {
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
switch (result.type) {
|
|
26
|
-
case 'init':
|
|
27
|
-
connection.send('init', {
|
|
28
|
-
id: nanoid(),
|
|
29
|
-
state: result.state
|
|
30
|
-
});
|
|
31
|
-
break;
|
|
32
|
-
case 'action':
|
|
33
|
-
connection.send('action', {
|
|
34
|
-
id: nanoid(),
|
|
35
|
-
action: result.action,
|
|
36
|
-
state: result.state,
|
|
37
|
-
stack: result.stack
|
|
38
|
-
});
|
|
39
|
-
break;
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
React.useEffect(() => {
|
|
43
|
-
addPlugin({
|
|
44
|
-
getId() {
|
|
45
|
-
return 'react-navigation';
|
|
46
|
-
},
|
|
47
|
-
async onConnect(connection) {
|
|
48
|
-
connectionRef.current = connection;
|
|
49
|
-
const on = (event, listener) => {
|
|
50
|
-
connection.receive(event, (params, responder) => {
|
|
51
|
-
try {
|
|
52
|
-
const result = listener(params);
|
|
53
|
-
|
|
54
|
-
// Return null instead of undefined, otherwise flipper doesn't respond
|
|
55
|
-
responder.success(result ?? null);
|
|
56
|
-
} catch (e) {
|
|
57
|
-
responder.error(e);
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
};
|
|
61
|
-
on('navigation.invoke', _ref => {
|
|
62
|
-
var _ref$current;
|
|
63
|
-
let {
|
|
64
|
-
method,
|
|
65
|
-
args = []
|
|
66
|
-
} = _ref;
|
|
67
|
-
switch (method) {
|
|
68
|
-
case 'resetRoot':
|
|
69
|
-
return resetRoot(args[0]);
|
|
70
|
-
default:
|
|
71
|
-
// @ts-expect-error: we want to call arbitrary methods here
|
|
72
|
-
return (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current[method](...args);
|
|
73
|
-
}
|
|
74
|
-
});
|
|
75
|
-
on('linking.invoke', _ref2 => {
|
|
76
|
-
var _global$REACT_NAVIGAT, _global$REACT_NAVIGAT2, _args$;
|
|
77
|
-
let {
|
|
78
|
-
method,
|
|
79
|
-
args = []
|
|
80
|
-
} = _ref2;
|
|
81
|
-
const linking = ref.current ? // @ts-ignore: this might not exist
|
|
82
|
-
(_global$REACT_NAVIGAT = global.REACT_NAVIGATION_DEVTOOLS) === null || _global$REACT_NAVIGAT === void 0 ? void 0 : (_global$REACT_NAVIGAT2 = _global$REACT_NAVIGAT.get(ref.current)) === null || _global$REACT_NAVIGAT2 === void 0 ? void 0 : _global$REACT_NAVIGAT2.linking : null;
|
|
83
|
-
switch (method) {
|
|
84
|
-
case 'getStateFromPath':
|
|
85
|
-
case 'getPathFromState':
|
|
86
|
-
case 'getActionFromState':
|
|
87
|
-
return linking === null || linking === void 0 ? void 0 : linking[method](args[0], (_args$ = args[1]) !== null && _args$ !== void 0 && _args$.trim() ?
|
|
88
|
-
// eslint-disable-next-line no-eval
|
|
89
|
-
eval(`(function() { return ${args[1]}; }())`) : linking.config);
|
|
90
|
-
default:
|
|
91
|
-
return linking === null || linking === void 0 ? void 0 : linking[method](...args);
|
|
92
|
-
}
|
|
93
|
-
});
|
|
94
|
-
},
|
|
95
|
-
onDisconnect() {
|
|
96
|
-
connectionRef.current = undefined;
|
|
97
|
-
},
|
|
98
|
-
runInBackground() {
|
|
99
|
-
return false;
|
|
100
|
-
}
|
|
101
|
-
});
|
|
102
|
-
}, [addPlugin, ref, resetRoot]);
|
|
103
|
-
}
|
|
104
|
-
//# sourceMappingURL=useFlipper.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["nanoid","React","useDevToolsBase","FlipperModule","require","e","useFlipper","ref","Error","addPlugin","connectionRef","useRef","resetRoot","result","connection","current","type","send","id","state","action","stack","useEffect","getId","onConnect","on","event","listener","receive","params","responder","success","error","method","args","linking","global","REACT_NAVIGATION_DEVTOOLS","get","trim","eval","config","onDisconnect","undefined","runInBackground"],"sourceRoot":"../../src","sources":["useFlipper.tsx"],"mappings":"AACA,SAASA,MAAM,QAAQ,mBAAmB;AAC1C,OAAO,KAAKC,KAAK,MAAM,OAAO;AAG9B,OAAOC,eAAe,MAAM,mBAAmB;AAE/C,IAAIC,aAAgE;AAEpE,IAAI;EACFA,aAAa,GAAGC,OAAO,CAAC,sBAAsB,CAAC;AACjD,CAAC,CAAC,OAAOC,CAAC,EAAE;EACV;AAAA;AAGF,eAAe,SAASC,UAAU,CAChCC,GAAiD,EACjD;EACA,IAAIJ,aAAa,IAAI,IAAI,EAAE;IACzB,MAAM,IAAIK,KAAK,CACb,oHAAoH,CACrH;EACH;EAEA,MAAM;IAAEC;EAAU,CAAC,GAAGN,aAAa;EAEnC,MAAMO,aAAa,GAAGT,KAAK,CAACU,MAAM,EAA6B;EAE/D,MAAM;IAAEC;EAAU,CAAC,GAAGV,eAAe,CAACK,GAAG,EAAGM,MAAM,IAAK;IACrD,MAAMC,UAAU,GAAGJ,aAAa,CAACK,OAAO;IAExC,IAAI,CAACD,UAAU,EAAE;MACf;IACF;IAEA,QAAQD,MAAM,CAACG,IAAI;MACjB,KAAK,MAAM;QACTF,UAAU,CAACG,IAAI,CAAC,MAAM,EAAE;UACtBC,EAAE,EAAElB,MAAM,EAAE;UACZmB,KAAK,EAAEN,MAAM,CAACM;QAChB,CAAC,CAAC;QACF;MACF,KAAK,QAAQ;QACXL,UAAU,CAACG,IAAI,CAAC,QAAQ,EAAE;UACxBC,EAAE,EAAElB,MAAM,EAAE;UACZoB,MAAM,EAAEP,MAAM,CAACO,MAAM;UACrBD,KAAK,EAAEN,MAAM,CAACM,KAAK;UACnBE,KAAK,EAAER,MAAM,CAACQ;QAChB,CAAC,CAAC;QACF;IAAM;EAEZ,CAAC,CAAC;EAEFpB,KAAK,CAACqB,SAAS,CAAC,MAAM;IACpBb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O,aAAPA,OAAO,uBAAPA,OAAO,CAAGF,MAAM,CAAC,CACtBC,IAAI,CAAC,CAAC,CAAC,EACP,UAAAA,IAAI,CAAC,CAAC,CAAC,mCAAP,OAASK,IAAI,EAAE;cACX;cACAC,IAAI,CAAE,wBAAuBN,IAAI,CAAC,CAAC,CAAE,QAAO,CAAC,GAC7CC,OAAO,CAACM,MAAM,CACnB;YACH;cACE,OAAON,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAGF,MAAM,CAAC,CAAC,GAAGC,IAAI,CAAC;UAAC;QAExC,CAAC,CAAC;MACJ,CAAC;MACDQ,YAAY,GAAG;QACbhC,aAAa,CAACK,OAAO,GAAG4B,SAAS;MACnC,CAAC;MACDC,eAAe,GAAG;QAChB,OAAO,KAAK;MACd;IACF,CAAC,CAAC;EACJ,CAAC,EAAE,CAACnC,SAAS,EAAEF,GAAG,EAAEK,SAAS,CAAC,CAAC;AACjC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useFlipper.d.ts","sourceRoot":"","sources":["../../../src/useFlipper.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAErE,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAa/B,MAAM,CAAC,OAAO,UAAU,UAAU,CAChC,GAAG,EAAE,KAAK,CAAC,SAAS,CAAC,sBAAsB,CAAC,GAAG,CAAC,CAAC,QAkGlD"}
|
package/src/useFlipper.tsx
DELETED
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
import type { NavigationContainerRef } from '@react-navigation/core';
|
|
2
|
-
import { nanoid } from 'nanoid/non-secure';
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
import type { Flipper } from 'react-native-flipper';
|
|
5
|
-
|
|
6
|
-
import useDevToolsBase from './useDevToolsBase';
|
|
7
|
-
|
|
8
|
-
let FlipperModule: typeof import('react-native-flipper') | undefined;
|
|
9
|
-
|
|
10
|
-
try {
|
|
11
|
-
FlipperModule = require('react-native-flipper');
|
|
12
|
-
} catch (e) {
|
|
13
|
-
// Do nothing
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export default function useFlipper(
|
|
17
|
-
ref: React.RefObject<NavigationContainerRef<any>>
|
|
18
|
-
) {
|
|
19
|
-
if (FlipperModule == null) {
|
|
20
|
-
throw new Error(
|
|
21
|
-
"Please install the 'react-native-flipper' package in your project to use Flipper integration for React Navigation."
|
|
22
|
-
);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
const { addPlugin } = FlipperModule;
|
|
26
|
-
|
|
27
|
-
const connectionRef = React.useRef<Flipper.FlipperConnection>();
|
|
28
|
-
|
|
29
|
-
const { resetRoot } = useDevToolsBase(ref, (result) => {
|
|
30
|
-
const connection = connectionRef.current;
|
|
31
|
-
|
|
32
|
-
if (!connection) {
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
switch (result.type) {
|
|
37
|
-
case 'init':
|
|
38
|
-
connection.send('init', {
|
|
39
|
-
id: nanoid(),
|
|
40
|
-
state: result.state,
|
|
41
|
-
});
|
|
42
|
-
break;
|
|
43
|
-
case 'action':
|
|
44
|
-
connection.send('action', {
|
|
45
|
-
id: nanoid(),
|
|
46
|
-
action: result.action,
|
|
47
|
-
state: result.state,
|
|
48
|
-
stack: result.stack,
|
|
49
|
-
});
|
|
50
|
-
break;
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
React.useEffect(() => {
|
|
55
|
-
addPlugin({
|
|
56
|
-
getId() {
|
|
57
|
-
return 'react-navigation';
|
|
58
|
-
},
|
|
59
|
-
async onConnect(connection) {
|
|
60
|
-
connectionRef.current = connection;
|
|
61
|
-
|
|
62
|
-
const on = (event: string, listener: (params: any) => Promise<any>) => {
|
|
63
|
-
connection.receive(event, (params, responder) => {
|
|
64
|
-
try {
|
|
65
|
-
const result = listener(params);
|
|
66
|
-
|
|
67
|
-
// Return null instead of undefined, otherwise flipper doesn't respond
|
|
68
|
-
responder.success(result ?? null);
|
|
69
|
-
} catch (e) {
|
|
70
|
-
responder.error(e);
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
on('navigation.invoke', ({ method, args = [] }) => {
|
|
76
|
-
switch (method) {
|
|
77
|
-
case 'resetRoot':
|
|
78
|
-
return resetRoot(args[0]);
|
|
79
|
-
default:
|
|
80
|
-
// @ts-expect-error: we want to call arbitrary methods here
|
|
81
|
-
return ref.current?.[method](...args);
|
|
82
|
-
}
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
on('linking.invoke', ({ method, args = [] }) => {
|
|
86
|
-
const linking: any = ref.current
|
|
87
|
-
? // @ts-ignore: this might not exist
|
|
88
|
-
global.REACT_NAVIGATION_DEVTOOLS?.get(ref.current)?.linking
|
|
89
|
-
: null;
|
|
90
|
-
|
|
91
|
-
switch (method) {
|
|
92
|
-
case 'getStateFromPath':
|
|
93
|
-
case 'getPathFromState':
|
|
94
|
-
case 'getActionFromState':
|
|
95
|
-
return linking?.[method](
|
|
96
|
-
args[0],
|
|
97
|
-
args[1]?.trim()
|
|
98
|
-
? // eslint-disable-next-line no-eval
|
|
99
|
-
eval(`(function() { return ${args[1]}; }())`)
|
|
100
|
-
: linking.config
|
|
101
|
-
);
|
|
102
|
-
default:
|
|
103
|
-
return linking?.[method](...args);
|
|
104
|
-
}
|
|
105
|
-
});
|
|
106
|
-
},
|
|
107
|
-
onDisconnect() {
|
|
108
|
-
connectionRef.current = undefined;
|
|
109
|
-
},
|
|
110
|
-
runInBackground() {
|
|
111
|
-
return false;
|
|
112
|
-
},
|
|
113
|
-
});
|
|
114
|
-
}, [addPlugin, ref, resetRoot]);
|
|
115
|
-
}
|