react-native-inapp-inspector 1.0.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/LICENSE +21 -0
- package/README.md +97 -0
- package/dist/commonjs/components/AnalyticsDetail.d.ts +6 -0
- package/dist/commonjs/components/AnalyticsDetail.js +558 -0
- package/dist/commonjs/components/AnalyticsEventCard.d.ts +18 -0
- package/dist/commonjs/components/AnalyticsEventCard.js +327 -0
- package/dist/commonjs/components/AnalyticsGraph.d.ts +8 -0
- package/dist/commonjs/components/AnalyticsGraph.js +416 -0
- package/dist/commonjs/components/CodeSnippet.d.ts +8 -0
- package/dist/commonjs/components/CodeSnippet.js +427 -0
- package/dist/commonjs/components/ConsoleLogCard.d.ts +10 -0
- package/dist/commonjs/components/ConsoleLogCard.js +401 -0
- package/dist/commonjs/components/CopyButton.d.ts +4 -0
- package/dist/commonjs/components/CopyButton.js +69 -0
- package/dist/commonjs/components/DiffViewer.d.ts +7 -0
- package/dist/commonjs/components/DiffViewer.js +86 -0
- package/dist/commonjs/components/DomainHeader.d.ts +18 -0
- package/dist/commonjs/components/DomainHeader.js +136 -0
- package/dist/commonjs/components/EmptyState.d.ts +5 -0
- package/dist/commonjs/components/EmptyState.js +40 -0
- package/dist/commonjs/components/HeadersSection.d.ts +4 -0
- package/dist/commonjs/components/HeadersSection.js +155 -0
- package/dist/commonjs/components/HighlightText.d.ts +3 -0
- package/dist/commonjs/components/HighlightText.js +57 -0
- package/dist/commonjs/components/JsonViewer.d.ts +7 -0
- package/dist/commonjs/components/JsonViewer.js +19 -0
- package/dist/commonjs/components/LogCard.d.ts +4 -0
- package/dist/commonjs/components/LogCard.js +179 -0
- package/dist/commonjs/components/MetaAccordion.d.ts +4 -0
- package/dist/commonjs/components/MetaAccordion.js +113 -0
- package/dist/commonjs/components/MiniBarChart.d.ts +7 -0
- package/dist/commonjs/components/MiniBarChart.js +56 -0
- package/dist/commonjs/components/MiniLineChart.d.ts +6 -0
- package/dist/commonjs/components/MiniLineChart.js +58 -0
- package/dist/commonjs/components/NetworkIcons.d.ts +31 -0
- package/dist/commonjs/components/NetworkIcons.js +245 -0
- package/dist/commonjs/components/SectionHeader.d.ts +4 -0
- package/dist/commonjs/components/SectionHeader.js +87 -0
- package/dist/commonjs/components/SourcePageCard.d.ts +4 -0
- package/dist/commonjs/components/SourcePageCard.js +132 -0
- package/dist/commonjs/components/TouchableScale.d.ts +9 -0
- package/dist/commonjs/components/TouchableScale.js +44 -0
- package/dist/commonjs/components/TreeNode.d.ts +4 -0
- package/dist/commonjs/components/TreeNode.js +140 -0
- package/dist/commonjs/constants/index.d.ts +7 -0
- package/dist/commonjs/constants/index.js +35 -0
- package/dist/commonjs/customHooks/analyticsLogger.d.ts +21 -0
- package/dist/commonjs/customHooks/analyticsLogger.js +160 -0
- package/dist/commonjs/customHooks/consoleLogger.d.ts +5 -0
- package/dist/commonjs/customHooks/consoleLogger.js +141 -0
- package/dist/commonjs/customHooks/logFilters.d.ts +5 -0
- package/dist/commonjs/customHooks/logFilters.js +34 -0
- package/dist/commonjs/customHooks/networkLogger.d.ts +20 -0
- package/dist/commonjs/customHooks/networkLogger.js +272 -0
- package/dist/commonjs/customHooks/useAccordion.d.ts +17 -0
- package/dist/commonjs/customHooks/useAccordion.js +48 -0
- package/dist/commonjs/customHooks/webViewLogger.d.ts +22 -0
- package/dist/commonjs/customHooks/webViewLogger.js +412 -0
- package/dist/commonjs/helpers/index.d.ts +20 -0
- package/dist/commonjs/helpers/index.js +229 -0
- package/dist/commonjs/index.d.ts +7 -0
- package/dist/commonjs/index.js +2668 -0
- package/dist/commonjs/styles/AppColors.d.ts +27 -0
- package/dist/commonjs/styles/AppColors.js +30 -0
- package/dist/commonjs/styles/AppFonts.d.ts +7 -0
- package/dist/commonjs/styles/AppFonts.js +10 -0
- package/dist/commonjs/styles/index.d.ts +1488 -0
- package/dist/commonjs/styles/index.js +1357 -0
- package/dist/commonjs/types/index.d.ts +127 -0
- package/dist/commonjs/types/index.js +2 -0
- package/dist/esm/components/AnalyticsDetail.d.ts +6 -0
- package/dist/esm/components/AnalyticsDetail.js +520 -0
- package/dist/esm/components/AnalyticsEventCard.d.ts +18 -0
- package/dist/esm/components/AnalyticsEventCard.js +288 -0
- package/dist/esm/components/AnalyticsGraph.d.ts +8 -0
- package/dist/esm/components/AnalyticsGraph.js +378 -0
- package/dist/esm/components/CodeSnippet.d.ts +8 -0
- package/dist/esm/components/CodeSnippet.js +392 -0
- package/dist/esm/components/ConsoleLogCard.d.ts +10 -0
- package/dist/esm/components/ConsoleLogCard.js +362 -0
- package/dist/esm/components/CopyButton.d.ts +4 -0
- package/dist/esm/components/CopyButton.js +31 -0
- package/dist/esm/components/DiffViewer.d.ts +7 -0
- package/dist/esm/components/DiffViewer.js +48 -0
- package/dist/esm/components/DomainHeader.d.ts +18 -0
- package/dist/esm/components/DomainHeader.js +98 -0
- package/dist/esm/components/EmptyState.d.ts +5 -0
- package/dist/esm/components/EmptyState.js +35 -0
- package/dist/esm/components/HeadersSection.d.ts +4 -0
- package/dist/esm/components/HeadersSection.js +117 -0
- package/dist/esm/components/HighlightText.d.ts +3 -0
- package/dist/esm/components/HighlightText.js +52 -0
- package/dist/esm/components/JsonViewer.d.ts +7 -0
- package/dist/esm/components/JsonViewer.js +14 -0
- package/dist/esm/components/LogCard.d.ts +4 -0
- package/dist/esm/components/LogCard.js +141 -0
- package/dist/esm/components/MetaAccordion.d.ts +4 -0
- package/dist/esm/components/MetaAccordion.js +108 -0
- package/dist/esm/components/MiniBarChart.d.ts +7 -0
- package/dist/esm/components/MiniBarChart.js +18 -0
- package/dist/esm/components/MiniLineChart.d.ts +6 -0
- package/dist/esm/components/MiniLineChart.js +20 -0
- package/dist/esm/components/NetworkIcons.d.ts +31 -0
- package/dist/esm/components/NetworkIcons.js +176 -0
- package/dist/esm/components/SectionHeader.d.ts +4 -0
- package/dist/esm/components/SectionHeader.js +49 -0
- package/dist/esm/components/SourcePageCard.d.ts +4 -0
- package/dist/esm/components/SourcePageCard.js +94 -0
- package/dist/esm/components/TouchableScale.d.ts +9 -0
- package/dist/esm/components/TouchableScale.js +9 -0
- package/dist/esm/components/TreeNode.d.ts +4 -0
- package/dist/esm/components/TreeNode.js +102 -0
- package/dist/esm/constants/index.d.ts +7 -0
- package/dist/esm/constants/index.js +32 -0
- package/dist/esm/customHooks/analyticsLogger.d.ts +21 -0
- package/dist/esm/customHooks/analyticsLogger.js +152 -0
- package/dist/esm/customHooks/consoleLogger.d.ts +5 -0
- package/dist/esm/customHooks/consoleLogger.js +134 -0
- package/dist/esm/customHooks/logFilters.d.ts +5 -0
- package/dist/esm/customHooks/logFilters.js +31 -0
- package/dist/esm/customHooks/networkLogger.d.ts +20 -0
- package/dist/esm/customHooks/networkLogger.js +264 -0
- package/dist/esm/customHooks/useAccordion.d.ts +17 -0
- package/dist/esm/customHooks/useAccordion.js +46 -0
- package/dist/esm/customHooks/webViewLogger.d.ts +22 -0
- package/dist/esm/customHooks/webViewLogger.js +365 -0
- package/dist/esm/helpers/index.d.ts +20 -0
- package/dist/esm/helpers/index.js +207 -0
- package/dist/esm/index.d.ts +7 -0
- package/dist/esm/index.js +2611 -0
- package/dist/esm/styles/AppColors.d.ts +27 -0
- package/dist/esm/styles/AppColors.js +27 -0
- package/dist/esm/styles/AppFonts.d.ts +7 -0
- package/dist/esm/styles/AppFonts.js +7 -0
- package/dist/esm/styles/index.d.ts +1488 -0
- package/dist/esm/styles/index.js +1355 -0
- package/dist/esm/types/index.d.ts +127 -0
- package/dist/esm/types/index.js +1 -0
- package/fonts/Inter/Inter.ttc +0 -0
- package/fonts/Inter/InterVariable-Italic.ttf +0 -0
- package/fonts/Inter/InterVariable.ttf +0 -0
- package/fonts/Inter/LICENSE.txt +92 -0
- package/fonts/Inter/extras/otf/Inter-Black.otf +0 -0
- package/fonts/Inter/extras/otf/Inter-BlackItalic.otf +0 -0
- package/fonts/Inter/extras/otf/Inter-Bold.otf +0 -0
- package/fonts/Inter/extras/otf/Inter-BoldItalic.otf +0 -0
- package/fonts/Inter/extras/otf/Inter-ExtraBold.otf +0 -0
- package/fonts/Inter/extras/otf/Inter-ExtraBoldItalic.otf +0 -0
- package/fonts/Inter/extras/otf/Inter-ExtraLight.otf +0 -0
- package/fonts/Inter/extras/otf/Inter-ExtraLightItalic.otf +0 -0
- package/fonts/Inter/extras/otf/Inter-Italic.otf +0 -0
- package/fonts/Inter/extras/otf/Inter-Light.otf +0 -0
- package/fonts/Inter/extras/otf/Inter-LightItalic.otf +0 -0
- package/fonts/Inter/extras/otf/Inter-Medium.otf +0 -0
- package/fonts/Inter/extras/otf/Inter-MediumItalic.otf +0 -0
- package/fonts/Inter/extras/otf/Inter-Regular.otf +0 -0
- package/fonts/Inter/extras/otf/Inter-SemiBold.otf +0 -0
- package/fonts/Inter/extras/otf/Inter-SemiBoldItalic.otf +0 -0
- package/fonts/Inter/extras/otf/Inter-Thin.otf +0 -0
- package/fonts/Inter/extras/otf/Inter-ThinItalic.otf +0 -0
- package/fonts/Inter/extras/otf/InterDisplay-Black.otf +0 -0
- package/fonts/Inter/extras/otf/InterDisplay-BlackItalic.otf +0 -0
- package/fonts/Inter/extras/otf/InterDisplay-Bold.otf +0 -0
- package/fonts/Inter/extras/otf/InterDisplay-BoldItalic.otf +0 -0
- package/fonts/Inter/extras/otf/InterDisplay-ExtraBold.otf +0 -0
- package/fonts/Inter/extras/otf/InterDisplay-ExtraBoldItalic.otf +0 -0
- package/fonts/Inter/extras/otf/InterDisplay-ExtraLight.otf +0 -0
- package/fonts/Inter/extras/otf/InterDisplay-ExtraLightItalic.otf +0 -0
- package/fonts/Inter/extras/otf/InterDisplay-Italic.otf +0 -0
- package/fonts/Inter/extras/otf/InterDisplay-Light.otf +0 -0
- package/fonts/Inter/extras/otf/InterDisplay-LightItalic.otf +0 -0
- package/fonts/Inter/extras/otf/InterDisplay-Medium.otf +0 -0
- package/fonts/Inter/extras/otf/InterDisplay-MediumItalic.otf +0 -0
- package/fonts/Inter/extras/otf/InterDisplay-Regular.otf +0 -0
- package/fonts/Inter/extras/otf/InterDisplay-SemiBold.otf +0 -0
- package/fonts/Inter/extras/otf/InterDisplay-SemiBoldItalic.otf +0 -0
- package/fonts/Inter/extras/otf/InterDisplay-Thin.otf +0 -0
- package/fonts/Inter/extras/otf/InterDisplay-ThinItalic.otf +0 -0
- package/fonts/Inter/extras/ttf/Inter-Black.ttf +0 -0
- package/fonts/Inter/extras/ttf/Inter-BlackItalic.ttf +0 -0
- package/fonts/Inter/extras/ttf/Inter-Bold.ttf +0 -0
- package/fonts/Inter/extras/ttf/Inter-BoldItalic.ttf +0 -0
- package/fonts/Inter/extras/ttf/Inter-ExtraBold.ttf +0 -0
- package/fonts/Inter/extras/ttf/Inter-ExtraBoldItalic.ttf +0 -0
- package/fonts/Inter/extras/ttf/Inter-ExtraLight.ttf +0 -0
- package/fonts/Inter/extras/ttf/Inter-ExtraLightItalic.ttf +0 -0
- package/fonts/Inter/extras/ttf/Inter-Italic.ttf +0 -0
- package/fonts/Inter/extras/ttf/Inter-Light.ttf +0 -0
- package/fonts/Inter/extras/ttf/Inter-LightItalic.ttf +0 -0
- package/fonts/Inter/extras/ttf/Inter-Medium.ttf +0 -0
- package/fonts/Inter/extras/ttf/Inter-MediumItalic.ttf +0 -0
- package/fonts/Inter/extras/ttf/Inter-Regular.ttf +0 -0
- package/fonts/Inter/extras/ttf/Inter-SemiBold.ttf +0 -0
- package/fonts/Inter/extras/ttf/Inter-SemiBoldItalic.ttf +0 -0
- package/fonts/Inter/extras/ttf/Inter-Thin.ttf +0 -0
- package/fonts/Inter/extras/ttf/Inter-ThinItalic.ttf +0 -0
- package/fonts/Inter/extras/ttf/InterDisplay-Black.ttf +0 -0
- package/fonts/Inter/extras/ttf/InterDisplay-BlackItalic.ttf +0 -0
- package/fonts/Inter/extras/ttf/InterDisplay-Bold.ttf +0 -0
- package/fonts/Inter/extras/ttf/InterDisplay-BoldItalic.ttf +0 -0
- package/fonts/Inter/extras/ttf/InterDisplay-ExtraBold.ttf +0 -0
- package/fonts/Inter/extras/ttf/InterDisplay-ExtraBoldItalic.ttf +0 -0
- package/fonts/Inter/extras/ttf/InterDisplay-ExtraLight.ttf +0 -0
- package/fonts/Inter/extras/ttf/InterDisplay-ExtraLightItalic.ttf +0 -0
- package/fonts/Inter/extras/ttf/InterDisplay-Italic.ttf +0 -0
- package/fonts/Inter/extras/ttf/InterDisplay-Light.ttf +0 -0
- package/fonts/Inter/extras/ttf/InterDisplay-LightItalic.ttf +0 -0
- package/fonts/Inter/extras/ttf/InterDisplay-Medium.ttf +0 -0
- package/fonts/Inter/extras/ttf/InterDisplay-MediumItalic.ttf +0 -0
- package/fonts/Inter/extras/ttf/InterDisplay-Regular.ttf +0 -0
- package/fonts/Inter/extras/ttf/InterDisplay-SemiBold.ttf +0 -0
- package/fonts/Inter/extras/ttf/InterDisplay-SemiBoldItalic.ttf +0 -0
- package/fonts/Inter/extras/ttf/InterDisplay-Thin.ttf +0 -0
- package/fonts/Inter/extras/ttf/InterDisplay-ThinItalic.ttf +0 -0
- package/fonts/Inter/extras/woff-hinted/Inter-Black.woff2 +0 -0
- package/fonts/Inter/extras/woff-hinted/Inter-BlackItalic.woff2 +0 -0
- package/fonts/Inter/extras/woff-hinted/Inter-Bold.woff2 +0 -0
- package/fonts/Inter/extras/woff-hinted/Inter-BoldItalic.woff2 +0 -0
- package/fonts/Inter/extras/woff-hinted/Inter-ExtraBold.woff2 +0 -0
- package/fonts/Inter/extras/woff-hinted/Inter-ExtraBoldItalic.woff2 +0 -0
- package/fonts/Inter/extras/woff-hinted/Inter-ExtraLight.woff2 +0 -0
- package/fonts/Inter/extras/woff-hinted/Inter-ExtraLightItalic.woff2 +0 -0
- package/fonts/Inter/extras/woff-hinted/Inter-Italic.woff2 +0 -0
- package/fonts/Inter/extras/woff-hinted/Inter-Light.woff2 +0 -0
- package/fonts/Inter/extras/woff-hinted/Inter-LightItalic.woff2 +0 -0
- package/fonts/Inter/extras/woff-hinted/Inter-Medium.woff2 +0 -0
- package/fonts/Inter/extras/woff-hinted/Inter-MediumItalic.woff2 +0 -0
- package/fonts/Inter/extras/woff-hinted/Inter-Regular.woff2 +0 -0
- package/fonts/Inter/extras/woff-hinted/Inter-SemiBold.woff2 +0 -0
- package/fonts/Inter/extras/woff-hinted/Inter-SemiBoldItalic.woff2 +0 -0
- package/fonts/Inter/extras/woff-hinted/Inter-Thin.woff2 +0 -0
- package/fonts/Inter/extras/woff-hinted/Inter-ThinItalic.woff2 +0 -0
- package/fonts/Inter/extras/woff-hinted/InterDisplay-Black.woff2 +0 -0
- package/fonts/Inter/extras/woff-hinted/InterDisplay-BlackItalic.woff2 +0 -0
- package/fonts/Inter/extras/woff-hinted/InterDisplay-Bold.woff2 +0 -0
- package/fonts/Inter/extras/woff-hinted/InterDisplay-BoldItalic.woff2 +0 -0
- package/fonts/Inter/extras/woff-hinted/InterDisplay-ExtraBold.woff2 +0 -0
- package/fonts/Inter/extras/woff-hinted/InterDisplay-ExtraBoldItalic.woff2 +0 -0
- package/fonts/Inter/extras/woff-hinted/InterDisplay-ExtraLight.woff2 +0 -0
- package/fonts/Inter/extras/woff-hinted/InterDisplay-ExtraLightItalic.woff2 +0 -0
- package/fonts/Inter/extras/woff-hinted/InterDisplay-Italic.woff2 +0 -0
- package/fonts/Inter/extras/woff-hinted/InterDisplay-Light.woff2 +0 -0
- package/fonts/Inter/extras/woff-hinted/InterDisplay-LightItalic.woff2 +0 -0
- package/fonts/Inter/extras/woff-hinted/InterDisplay-Medium.woff2 +0 -0
- package/fonts/Inter/extras/woff-hinted/InterDisplay-MediumItalic.woff2 +0 -0
- package/fonts/Inter/extras/woff-hinted/InterDisplay-Regular.woff2 +0 -0
- package/fonts/Inter/extras/woff-hinted/InterDisplay-SemiBold.woff2 +0 -0
- package/fonts/Inter/extras/woff-hinted/InterDisplay-SemiBoldItalic.woff2 +0 -0
- package/fonts/Inter/extras/woff-hinted/InterDisplay-Thin.woff2 +0 -0
- package/fonts/Inter/extras/woff-hinted/InterDisplay-ThinItalic.woff2 +0 -0
- package/fonts/Inter/help.txt +165 -0
- package/fonts/Inter/web/Inter-Black.woff2 +0 -0
- package/fonts/Inter/web/Inter-BlackItalic.woff2 +0 -0
- package/fonts/Inter/web/Inter-Bold.woff2 +0 -0
- package/fonts/Inter/web/Inter-BoldItalic.woff2 +0 -0
- package/fonts/Inter/web/Inter-ExtraBold.woff2 +0 -0
- package/fonts/Inter/web/Inter-ExtraBoldItalic.woff2 +0 -0
- package/fonts/Inter/web/Inter-ExtraLight.woff2 +0 -0
- package/fonts/Inter/web/Inter-ExtraLightItalic.woff2 +0 -0
- package/fonts/Inter/web/Inter-Italic.woff2 +0 -0
- package/fonts/Inter/web/Inter-Light.woff2 +0 -0
- package/fonts/Inter/web/Inter-LightItalic.woff2 +0 -0
- package/fonts/Inter/web/Inter-Medium.woff2 +0 -0
- package/fonts/Inter/web/Inter-MediumItalic.woff2 +0 -0
- package/fonts/Inter/web/Inter-Regular.woff2 +0 -0
- package/fonts/Inter/web/Inter-SemiBold.woff2 +0 -0
- package/fonts/Inter/web/Inter-SemiBoldItalic.woff2 +0 -0
- package/fonts/Inter/web/Inter-Thin.woff2 +0 -0
- package/fonts/Inter/web/Inter-ThinItalic.woff2 +0 -0
- package/fonts/Inter/web/InterDisplay-Black.woff2 +0 -0
- package/fonts/Inter/web/InterDisplay-BlackItalic.woff2 +0 -0
- package/fonts/Inter/web/InterDisplay-Bold.woff2 +0 -0
- package/fonts/Inter/web/InterDisplay-BoldItalic.woff2 +0 -0
- package/fonts/Inter/web/InterDisplay-ExtraBold.woff2 +0 -0
- package/fonts/Inter/web/InterDisplay-ExtraBoldItalic.woff2 +0 -0
- package/fonts/Inter/web/InterDisplay-ExtraLight.woff2 +0 -0
- package/fonts/Inter/web/InterDisplay-ExtraLightItalic.woff2 +0 -0
- package/fonts/Inter/web/InterDisplay-Italic.woff2 +0 -0
- package/fonts/Inter/web/InterDisplay-Light.woff2 +0 -0
- package/fonts/Inter/web/InterDisplay-LightItalic.woff2 +0 -0
- package/fonts/Inter/web/InterDisplay-Medium.woff2 +0 -0
- package/fonts/Inter/web/InterDisplay-MediumItalic.woff2 +0 -0
- package/fonts/Inter/web/InterDisplay-Regular.woff2 +0 -0
- package/fonts/Inter/web/InterDisplay-SemiBold.woff2 +0 -0
- package/fonts/Inter/web/InterDisplay-SemiBoldItalic.woff2 +0 -0
- package/fonts/Inter/web/InterDisplay-Thin.woff2 +0 -0
- package/fonts/Inter/web/InterDisplay-ThinItalic.woff2 +0 -0
- package/fonts/Inter/web/InterVariable-Italic.woff2 +0 -0
- package/fonts/Inter/web/InterVariable.woff2 +0 -0
- package/fonts/Inter/web/inter.css +148 -0
- package/package.json +52 -0
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.setupConsoleLogger = exports.getConsoleLogs = exports.clearConsoleLogs = exports.subscribeConsoleLogs = void 0;
|
|
4
|
+
const logFilters_1 = require("./logFilters");
|
|
5
|
+
let logs = [];
|
|
6
|
+
let listeners = [];
|
|
7
|
+
let counter = 0;
|
|
8
|
+
let isIntercepting = false;
|
|
9
|
+
const MAX_LOGS = 100;
|
|
10
|
+
// ─── Helpers ──────────────────────────────────────────────────────────────────
|
|
11
|
+
const formatArgs = (args) => {
|
|
12
|
+
return args
|
|
13
|
+
.map(arg => {
|
|
14
|
+
if (arg === null)
|
|
15
|
+
return 'null';
|
|
16
|
+
if (arg === undefined)
|
|
17
|
+
return 'undefined';
|
|
18
|
+
if (typeof arg === 'object') {
|
|
19
|
+
try {
|
|
20
|
+
return JSON.stringify(arg, null, 2);
|
|
21
|
+
}
|
|
22
|
+
catch {
|
|
23
|
+
return Object.prototype.toString.call(arg);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return String(arg);
|
|
27
|
+
})
|
|
28
|
+
.join(' ');
|
|
29
|
+
};
|
|
30
|
+
const getCallerFromStack = () => {
|
|
31
|
+
try {
|
|
32
|
+
const stack = new Error().stack;
|
|
33
|
+
if (!stack)
|
|
34
|
+
return 'Unknown';
|
|
35
|
+
const lines = stack.split('\n');
|
|
36
|
+
for (let i = 0; i < lines.length; i++) {
|
|
37
|
+
const line = lines[i];
|
|
38
|
+
// Skip internal console logger stack frames and native helpers
|
|
39
|
+
if (line.includes('consoleLogger') ||
|
|
40
|
+
line.includes('setupConsoleLogger') ||
|
|
41
|
+
line.includes('node_modules') ||
|
|
42
|
+
line.includes('Error')) {
|
|
43
|
+
continue;
|
|
44
|
+
}
|
|
45
|
+
return line.trim().replace(/^at /, '');
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
catch (e) { }
|
|
49
|
+
return 'Unknown';
|
|
50
|
+
};
|
|
51
|
+
const notify = () => {
|
|
52
|
+
const snapshot = [...logs];
|
|
53
|
+
listeners.forEach(cb => cb(snapshot));
|
|
54
|
+
};
|
|
55
|
+
const addLog = (type, args, sourceMethod) => {
|
|
56
|
+
if (isIntercepting)
|
|
57
|
+
return;
|
|
58
|
+
isIntercepting = true;
|
|
59
|
+
try {
|
|
60
|
+
const message = formatArgs(args);
|
|
61
|
+
// Check if the log should be ignored based on starting prefixes across all categories
|
|
62
|
+
const allPrefixes = [
|
|
63
|
+
...((logFilters_1.IGNORED_LOG_PREFIXES && logFilters_1.IGNORED_LOG_PREFIXES.info) || []),
|
|
64
|
+
...((logFilters_1.IGNORED_LOG_PREFIXES && logFilters_1.IGNORED_LOG_PREFIXES.warn) || []),
|
|
65
|
+
...((logFilters_1.IGNORED_LOG_PREFIXES && logFilters_1.IGNORED_LOG_PREFIXES.error) || []),
|
|
66
|
+
].filter(p => typeof p === 'string' && p.trim().length > 0);
|
|
67
|
+
if (allPrefixes.some(prefix => message
|
|
68
|
+
.toLowerCase()
|
|
69
|
+
.trim()
|
|
70
|
+
.startsWith(prefix.toLowerCase().trim()) ||
|
|
71
|
+
message.toLowerCase().trim().includes(prefix.toLowerCase().trim()))) {
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
const caller = getCallerFromStack();
|
|
75
|
+
const newLog = {
|
|
76
|
+
id: counter++,
|
|
77
|
+
type,
|
|
78
|
+
message,
|
|
79
|
+
timestamp: Date.now(),
|
|
80
|
+
caller,
|
|
81
|
+
sourceMethod,
|
|
82
|
+
};
|
|
83
|
+
logs.unshift(newLog);
|
|
84
|
+
logs = logs.slice(0, MAX_LOGS);
|
|
85
|
+
notify();
|
|
86
|
+
}
|
|
87
|
+
catch (e) {
|
|
88
|
+
// Fail-safe to prevent crash during logging
|
|
89
|
+
}
|
|
90
|
+
finally {
|
|
91
|
+
isIntercepting = false;
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
// ─── Public API ───────────────────────────────────────────────────────────────
|
|
95
|
+
const subscribeConsoleLogs = (callback) => {
|
|
96
|
+
listeners.push(callback);
|
|
97
|
+
callback([...logs]);
|
|
98
|
+
return () => {
|
|
99
|
+
listeners = listeners.filter(l => l !== callback);
|
|
100
|
+
};
|
|
101
|
+
};
|
|
102
|
+
exports.subscribeConsoleLogs = subscribeConsoleLogs;
|
|
103
|
+
const clearConsoleLogs = () => {
|
|
104
|
+
logs = [];
|
|
105
|
+
notify();
|
|
106
|
+
};
|
|
107
|
+
exports.clearConsoleLogs = clearConsoleLogs;
|
|
108
|
+
const getConsoleLogs = () => [...logs];
|
|
109
|
+
exports.getConsoleLogs = getConsoleLogs;
|
|
110
|
+
const setupConsoleLogger = () => {
|
|
111
|
+
if (global.__CONSOLE_LOGGER_INITIALIZED__)
|
|
112
|
+
return;
|
|
113
|
+
const originalConsole = {
|
|
114
|
+
log: console.log,
|
|
115
|
+
info: console.info,
|
|
116
|
+
warn: console.warn,
|
|
117
|
+
error: console.error,
|
|
118
|
+
};
|
|
119
|
+
// Intercept console.log
|
|
120
|
+
console.log = (...args) => {
|
|
121
|
+
addLog('info', args, 'log');
|
|
122
|
+
originalConsole.log(...args);
|
|
123
|
+
};
|
|
124
|
+
// Intercept console.info
|
|
125
|
+
console.info = (...args) => {
|
|
126
|
+
addLog('info', args, 'info');
|
|
127
|
+
originalConsole.info(...args);
|
|
128
|
+
};
|
|
129
|
+
// Intercept console.warn
|
|
130
|
+
console.warn = (...args) => {
|
|
131
|
+
addLog('warn', args, 'warn');
|
|
132
|
+
originalConsole.warn(...args);
|
|
133
|
+
};
|
|
134
|
+
// Intercept console.error
|
|
135
|
+
console.error = (...args) => {
|
|
136
|
+
addLog('error', args, 'error');
|
|
137
|
+
originalConsole.error(...args);
|
|
138
|
+
};
|
|
139
|
+
global.__CONSOLE_LOGGER_INITIALIZED__ = true;
|
|
140
|
+
};
|
|
141
|
+
exports.setupConsoleLogger = setupConsoleLogger;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.IGNORED_LOG_PREFIXES = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Configuration for console logs to ignore.
|
|
6
|
+
* Logs matching any of these starting prefixes will be filtered out.
|
|
7
|
+
*/
|
|
8
|
+
exports.IGNORED_LOG_PREFIXES = {
|
|
9
|
+
info: [
|
|
10
|
+
// Add prefixes of info logs you want to ignore, e.g.:
|
|
11
|
+
// 'Starting server',
|
|
12
|
+
'VirtualizedList: You have a large list that is slow to update',
|
|
13
|
+
],
|
|
14
|
+
warn: [
|
|
15
|
+
// Add prefixes of warning logs you want to ignore, e.g.:
|
|
16
|
+
// 'Require cycle:',
|
|
17
|
+
// 'ViewPropTypes will be removed',
|
|
18
|
+
'This method is deprecated (as well as all React Native Firebase namespaced API) and will be removed in the next major release as part of move to match Firebase Web modular SDK API.',
|
|
19
|
+
'SerializableStateInvariantMiddleware took',
|
|
20
|
+
'Non-serializable values were found in the navigation state.',
|
|
21
|
+
'SafeAreaView has been deprecated and will be removed in a future release.',
|
|
22
|
+
'Clipboard has been extracted from react-native core and will be removed in a future release.',
|
|
23
|
+
'You should always pass contentWidth prop to properly handle screen rotations and have a seamless support for images scaling.',
|
|
24
|
+
'Selector unknown returned a different result when called with the same parameters.',
|
|
25
|
+
'You seem to update props of the "TRenderEngineProvider" component in short periods of time',
|
|
26
|
+
'A non-serializable value was detected in an action',
|
|
27
|
+
],
|
|
28
|
+
error: [
|
|
29
|
+
// Add prefixes of error logs you want to ignore, e.g.:
|
|
30
|
+
// 'Warning: Each child in a list should have a unique',
|
|
31
|
+
'A non-serializable value was detected in the state, in the path: `tierStatusCalculator.date`',
|
|
32
|
+
'VirtualizedLists should never be nested inside plain ScrollViews with the same orientation because it can break windowing and other functionality - use another VirtualizedList-backed container instead.',
|
|
33
|
+
],
|
|
34
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import './webViewLogger';
|
|
2
|
+
type NetworkLog = {
|
|
3
|
+
id: number;
|
|
4
|
+
url: string;
|
|
5
|
+
method: string;
|
|
6
|
+
status?: number;
|
|
7
|
+
request?: any;
|
|
8
|
+
response?: any;
|
|
9
|
+
duration?: number;
|
|
10
|
+
startTime: number;
|
|
11
|
+
caller?: string;
|
|
12
|
+
requestHeaders?: Record<string, string>;
|
|
13
|
+
responseHeaders?: Record<string, string>;
|
|
14
|
+
};
|
|
15
|
+
export declare const subscribeNetworkLogs: (callback: (logs: NetworkLog[]) => void) => () => void;
|
|
16
|
+
export declare const clearNetworkLogs: () => void;
|
|
17
|
+
export declare const getNetworkLogs: () => NetworkLog[];
|
|
18
|
+
export declare const setupNetworkLogger: () => void;
|
|
19
|
+
export declare const addAxiosInterceptors: (axiosInstance: any) => void;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.addAxiosInterceptors = exports.setupNetworkLogger = exports.getNetworkLogs = exports.clearNetworkLogs = exports.subscribeNetworkLogs = void 0;
|
|
4
|
+
require("./webViewLogger");
|
|
5
|
+
let logs = [];
|
|
6
|
+
let listeners = [];
|
|
7
|
+
let counter = 0;
|
|
8
|
+
const ALLOWED_METHODS = ['GET', 'POST', 'PUT', 'PATCH', 'DELETE'];
|
|
9
|
+
// ─── Helpers ──────────────────────────────────────────────────────────────────
|
|
10
|
+
function normaliseHeaders(raw) {
|
|
11
|
+
if (!raw)
|
|
12
|
+
return undefined;
|
|
13
|
+
if (typeof raw.forEach === 'function') {
|
|
14
|
+
const result = {};
|
|
15
|
+
raw.forEach((value, key) => {
|
|
16
|
+
result[key] = value;
|
|
17
|
+
});
|
|
18
|
+
return Object.keys(result).length > 0 ? result : undefined;
|
|
19
|
+
}
|
|
20
|
+
if (Array.isArray(raw)) {
|
|
21
|
+
const result = {};
|
|
22
|
+
raw.forEach(([key, value]) => {
|
|
23
|
+
result[key] = value;
|
|
24
|
+
});
|
|
25
|
+
return Object.keys(result).length > 0 ? result : undefined;
|
|
26
|
+
}
|
|
27
|
+
const obj = raw;
|
|
28
|
+
const result = {};
|
|
29
|
+
Object.entries(obj).forEach(([key, value]) => {
|
|
30
|
+
if (value != null) {
|
|
31
|
+
result[key] = String(value);
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
return Object.keys(result).length > 0 ? result : undefined;
|
|
35
|
+
}
|
|
36
|
+
// ✅ Parse FormData for File Upload previews
|
|
37
|
+
function parseRequestData(data) {
|
|
38
|
+
if (!data)
|
|
39
|
+
return data;
|
|
40
|
+
if (data && data._parts && Array.isArray(data._parts)) {
|
|
41
|
+
const parsedFormData = {};
|
|
42
|
+
data._parts.forEach((part) => {
|
|
43
|
+
const key = part[0];
|
|
44
|
+
const value = part[1];
|
|
45
|
+
if (value && typeof value === 'object' && value.uri) {
|
|
46
|
+
parsedFormData[key] = {
|
|
47
|
+
_isFile: true,
|
|
48
|
+
name: value.name || 'unknown',
|
|
49
|
+
type: value.type || 'unknown',
|
|
50
|
+
uri: value.uri,
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
parsedFormData[key] = value;
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
return { _isFormData: true, ...parsedFormData };
|
|
58
|
+
}
|
|
59
|
+
return data;
|
|
60
|
+
}
|
|
61
|
+
// ✅ Magic function to extract file and line number from the call stack
|
|
62
|
+
function getCallerFromStack() {
|
|
63
|
+
try {
|
|
64
|
+
const stack = new Error().stack;
|
|
65
|
+
if (!stack)
|
|
66
|
+
return 'Unknown';
|
|
67
|
+
const lines = stack.split('\n');
|
|
68
|
+
for (let i = 0; i < lines.length; i++) {
|
|
69
|
+
const line = lines[i];
|
|
70
|
+
// Skip internal react-native network modules and the logger itself
|
|
71
|
+
if (line.includes('networkLogger') ||
|
|
72
|
+
line.includes('node_modules') ||
|
|
73
|
+
line.includes('Error') ||
|
|
74
|
+
line.includes('regeneratorRuntime')) {
|
|
75
|
+
continue;
|
|
76
|
+
}
|
|
77
|
+
return line.trim().replace(/^at /, '');
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
catch (e) { }
|
|
81
|
+
return 'Unknown';
|
|
82
|
+
}
|
|
83
|
+
// ─── Subscribe ────────────────────────────────────────────────────────────────
|
|
84
|
+
const subscribeNetworkLogs = (callback) => {
|
|
85
|
+
listeners.push(callback);
|
|
86
|
+
callback([...logs]);
|
|
87
|
+
return () => {
|
|
88
|
+
listeners = listeners.filter(l => l !== callback);
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
exports.subscribeNetworkLogs = subscribeNetworkLogs;
|
|
92
|
+
const clearNetworkLogs = () => {
|
|
93
|
+
logs = [];
|
|
94
|
+
notify();
|
|
95
|
+
};
|
|
96
|
+
exports.clearNetworkLogs = clearNetworkLogs;
|
|
97
|
+
const getNetworkLogs = () => [...logs];
|
|
98
|
+
exports.getNetworkLogs = getNetworkLogs;
|
|
99
|
+
// ─── Internal ─────────────────────────────────────────────────────────────────
|
|
100
|
+
const notify = () => {
|
|
101
|
+
const snapshot = [...logs];
|
|
102
|
+
listeners.forEach(cb => cb(snapshot));
|
|
103
|
+
};
|
|
104
|
+
const addOrUpdateLog = (log) => {
|
|
105
|
+
const method = log.method?.toUpperCase();
|
|
106
|
+
if (!ALLOWED_METHODS.includes(method))
|
|
107
|
+
return;
|
|
108
|
+
const index = logs.findIndex(l => l.id === log.id);
|
|
109
|
+
if (index >= 0) {
|
|
110
|
+
logs[index] = { ...logs[index], ...log };
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
logs.unshift(log);
|
|
114
|
+
}
|
|
115
|
+
logs = logs.slice(0, 100);
|
|
116
|
+
notify();
|
|
117
|
+
};
|
|
118
|
+
// ─── Setup ────────────────────────────────────────────────────────────────────
|
|
119
|
+
const setupNetworkLogger = () => {
|
|
120
|
+
if (global.__NETWORK_LOGGER_INITIALIZED__)
|
|
121
|
+
return;
|
|
122
|
+
global.__NETWORK_LOGGER__ = addOrUpdateLog;
|
|
123
|
+
const originalFetch = global.fetch;
|
|
124
|
+
if (originalFetch) {
|
|
125
|
+
global.fetch = async (url, options = {}) => {
|
|
126
|
+
const method = (options?.method || 'GET').toUpperCase();
|
|
127
|
+
if (!ALLOWED_METHODS.includes(method))
|
|
128
|
+
return originalFetch(url, options);
|
|
129
|
+
const id = counter++;
|
|
130
|
+
const start = Date.now();
|
|
131
|
+
const finalUrl = typeof url === 'string' ? url : url?.url;
|
|
132
|
+
const requestHeaders = normaliseHeaders(options?.headers);
|
|
133
|
+
const caller = getCallerFromStack(); // ✅ Capture call line
|
|
134
|
+
addOrUpdateLog({
|
|
135
|
+
id,
|
|
136
|
+
url: finalUrl,
|
|
137
|
+
method,
|
|
138
|
+
startTime: start,
|
|
139
|
+
caller,
|
|
140
|
+
request: method === 'GET' ? undefined : parseRequestData(options?.body),
|
|
141
|
+
requestHeaders,
|
|
142
|
+
});
|
|
143
|
+
try {
|
|
144
|
+
const response = await originalFetch(url, options);
|
|
145
|
+
const duration = Date.now() - start;
|
|
146
|
+
const responseHeaders = normaliseHeaders(response.headers);
|
|
147
|
+
let data = null;
|
|
148
|
+
const contentType = responseHeaders?.['content-type'] ||
|
|
149
|
+
responseHeaders?.['Content-Type'] ||
|
|
150
|
+
'';
|
|
151
|
+
if (contentType.includes('image/')) {
|
|
152
|
+
data = '[Image Data]';
|
|
153
|
+
}
|
|
154
|
+
else {
|
|
155
|
+
try {
|
|
156
|
+
const clone = response.clone();
|
|
157
|
+
const text = await clone.text();
|
|
158
|
+
try {
|
|
159
|
+
data = JSON.parse(text);
|
|
160
|
+
}
|
|
161
|
+
catch {
|
|
162
|
+
data = text;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
catch { }
|
|
166
|
+
}
|
|
167
|
+
addOrUpdateLog({
|
|
168
|
+
id,
|
|
169
|
+
url: finalUrl,
|
|
170
|
+
method,
|
|
171
|
+
status: response.status,
|
|
172
|
+
response: data,
|
|
173
|
+
duration,
|
|
174
|
+
startTime: start,
|
|
175
|
+
caller,
|
|
176
|
+
responseHeaders,
|
|
177
|
+
});
|
|
178
|
+
return response;
|
|
179
|
+
}
|
|
180
|
+
catch (error) {
|
|
181
|
+
addOrUpdateLog({
|
|
182
|
+
id,
|
|
183
|
+
url: finalUrl,
|
|
184
|
+
method,
|
|
185
|
+
status: 0,
|
|
186
|
+
startTime: start,
|
|
187
|
+
response: error,
|
|
188
|
+
caller,
|
|
189
|
+
duration: Date.now() - start,
|
|
190
|
+
});
|
|
191
|
+
throw error;
|
|
192
|
+
}
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
global.__NETWORK_LOGGER_INITIALIZED__ = true;
|
|
196
|
+
};
|
|
197
|
+
exports.setupNetworkLogger = setupNetworkLogger;
|
|
198
|
+
// ─── Axios interceptor helper ─────────────────────────────────────────────────
|
|
199
|
+
const addAxiosInterceptors = (axiosInstance) => {
|
|
200
|
+
axiosInstance.interceptors.request.use(async (config) => {
|
|
201
|
+
const method = (config.method || 'GET').toUpperCase();
|
|
202
|
+
if (!ALLOWED_METHODS.includes(method))
|
|
203
|
+
return config;
|
|
204
|
+
const id = counter++;
|
|
205
|
+
const start = Date.now();
|
|
206
|
+
const caller = getCallerFromStack(); // ✅ Capture call line
|
|
207
|
+
config.__logId = id;
|
|
208
|
+
config.__logStart = start;
|
|
209
|
+
config.__logCaller = caller;
|
|
210
|
+
let url = config.url ?? '';
|
|
211
|
+
if (!url.startsWith('http'))
|
|
212
|
+
url = `${config.baseURL ?? ''}${url}`;
|
|
213
|
+
addOrUpdateLog({
|
|
214
|
+
id,
|
|
215
|
+
url,
|
|
216
|
+
method,
|
|
217
|
+
startTime: start,
|
|
218
|
+
caller,
|
|
219
|
+
request: method === 'GET' ? undefined : parseRequestData(config.data),
|
|
220
|
+
requestHeaders: normaliseHeaders(config.headers),
|
|
221
|
+
});
|
|
222
|
+
return config;
|
|
223
|
+
});
|
|
224
|
+
axiosInstance.interceptors.response.use((response) => {
|
|
225
|
+
const config = response.config || {};
|
|
226
|
+
const id = config.__logId;
|
|
227
|
+
const start = config.__logStart;
|
|
228
|
+
const caller = config.__logCaller;
|
|
229
|
+
const method = (config.method || 'GET').toUpperCase();
|
|
230
|
+
if (id == null || !ALLOWED_METHODS.includes(method))
|
|
231
|
+
return response;
|
|
232
|
+
let url = config.url ?? '';
|
|
233
|
+
if (!url.startsWith('http'))
|
|
234
|
+
url = `${config.baseURL ?? ''}${url}`;
|
|
235
|
+
addOrUpdateLog({
|
|
236
|
+
id,
|
|
237
|
+
url,
|
|
238
|
+
method,
|
|
239
|
+
status: response.status,
|
|
240
|
+
response: response.data,
|
|
241
|
+
startTime: start || Date.now(),
|
|
242
|
+
duration: start != null ? Date.now() - start : undefined,
|
|
243
|
+
caller,
|
|
244
|
+
responseHeaders: normaliseHeaders(response.headers),
|
|
245
|
+
});
|
|
246
|
+
return response;
|
|
247
|
+
}, (error) => {
|
|
248
|
+
const config = error.config || {};
|
|
249
|
+
const id = config.__logId;
|
|
250
|
+
const start = config.__logStart;
|
|
251
|
+
const caller = config.__logCaller;
|
|
252
|
+
const method = (config.method || 'GET').toUpperCase();
|
|
253
|
+
if (id != null && ALLOWED_METHODS.includes(method)) {
|
|
254
|
+
let url = config.url ?? '';
|
|
255
|
+
if (!url.startsWith('http'))
|
|
256
|
+
url = `${config.baseURL ?? ''}${url}`;
|
|
257
|
+
addOrUpdateLog({
|
|
258
|
+
id,
|
|
259
|
+
url,
|
|
260
|
+
method,
|
|
261
|
+
status: error.response?.status ?? 0,
|
|
262
|
+
response: error.response?.data ?? error.message,
|
|
263
|
+
startTime: start || Date.now(),
|
|
264
|
+
duration: start != null ? Date.now() - start : undefined,
|
|
265
|
+
caller,
|
|
266
|
+
responseHeaders: normaliseHeaders(error.response?.headers),
|
|
267
|
+
});
|
|
268
|
+
}
|
|
269
|
+
return Promise.reject(error);
|
|
270
|
+
});
|
|
271
|
+
};
|
|
272
|
+
exports.addAxiosInterceptors = addAxiosInterceptors;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Animated } from 'react-native';
|
|
2
|
+
declare const useAccordion: (initialOpen?: boolean, maxBodyHeight?: number, duration?: number) => {
|
|
3
|
+
isOpen: boolean;
|
|
4
|
+
toggleOpen: () => void;
|
|
5
|
+
forceOpen: (open: boolean) => void;
|
|
6
|
+
chevronStyle: {
|
|
7
|
+
transform: {
|
|
8
|
+
rotate: Animated.AnimatedInterpolation<string | number>;
|
|
9
|
+
}[];
|
|
10
|
+
};
|
|
11
|
+
bodyStyle: {
|
|
12
|
+
maxHeight: Animated.AnimatedInterpolation<string | number>;
|
|
13
|
+
overflow: "hidden";
|
|
14
|
+
opacity: Animated.AnimatedInterpolation<string | number>;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
export default useAccordion;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const react_1 = require("react");
|
|
4
|
+
const react_native_1 = require("react-native");
|
|
5
|
+
const useAccordion = (initialOpen = false, maxBodyHeight = 1200, duration = 280) => {
|
|
6
|
+
const [isOpen, setIsOpen] = (0, react_1.useState)(initialOpen);
|
|
7
|
+
const animVal = (0, react_1.useRef)(new react_native_1.Animated.Value(initialOpen ? 1 : 0)).current;
|
|
8
|
+
const toggleOpen = (0, react_1.useCallback)(() => {
|
|
9
|
+
const next = !isOpen;
|
|
10
|
+
setIsOpen(next);
|
|
11
|
+
react_native_1.Animated.timing(animVal, {
|
|
12
|
+
toValue: next ? 1 : 0,
|
|
13
|
+
duration,
|
|
14
|
+
useNativeDriver: false,
|
|
15
|
+
}).start();
|
|
16
|
+
}, [isOpen, animVal, duration]);
|
|
17
|
+
const forceOpen = (0, react_1.useCallback)((open) => {
|
|
18
|
+
setIsOpen(open);
|
|
19
|
+
react_native_1.Animated.timing(animVal, {
|
|
20
|
+
toValue: open ? 1 : 0,
|
|
21
|
+
duration,
|
|
22
|
+
useNativeDriver: false,
|
|
23
|
+
}).start();
|
|
24
|
+
}, [animVal, duration]);
|
|
25
|
+
const chevronStyle = {
|
|
26
|
+
transform: [
|
|
27
|
+
{
|
|
28
|
+
rotate: animVal.interpolate({
|
|
29
|
+
inputRange: [0, 1],
|
|
30
|
+
outputRange: ['0deg', '180deg'],
|
|
31
|
+
}),
|
|
32
|
+
},
|
|
33
|
+
],
|
|
34
|
+
};
|
|
35
|
+
const bodyStyle = {
|
|
36
|
+
maxHeight: animVal.interpolate({
|
|
37
|
+
inputRange: [0, 1],
|
|
38
|
+
outputRange: [0, maxBodyHeight],
|
|
39
|
+
}),
|
|
40
|
+
overflow: 'hidden',
|
|
41
|
+
opacity: animVal.interpolate({
|
|
42
|
+
inputRange: [0, 0.4, 1],
|
|
43
|
+
outputRange: [0, 0.7, 1],
|
|
44
|
+
}),
|
|
45
|
+
};
|
|
46
|
+
return { isOpen, toggleOpen, forceOpen, chevronStyle, bodyStyle };
|
|
47
|
+
};
|
|
48
|
+
exports.default = useAccordion;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export interface WebViewLog {
|
|
2
|
+
id: number;
|
|
3
|
+
type: 'log' | 'info' | 'warn' | 'error';
|
|
4
|
+
message: string;
|
|
5
|
+
timestamp: number;
|
|
6
|
+
}
|
|
7
|
+
export interface WebViewNavState {
|
|
8
|
+
url: string;
|
|
9
|
+
title?: string;
|
|
10
|
+
timestamp: number;
|
|
11
|
+
}
|
|
12
|
+
export declare const addWebViewLog: (type: "log" | "info" | "warn" | "error", message: string) => void;
|
|
13
|
+
export declare const addWebViewNav: (url: string, title?: string) => void;
|
|
14
|
+
export declare const addWebViewHtml: (url: string, html: string, css?: string, js?: string) => void;
|
|
15
|
+
export declare const getWebViewLogs: () => WebViewLog[];
|
|
16
|
+
export declare const getWebViewNavHistory: () => WebViewNavState[];
|
|
17
|
+
export declare const getWebViewHtml: () => string;
|
|
18
|
+
export declare const getWebViewCss: () => string;
|
|
19
|
+
export declare const getWebViewJs: () => string;
|
|
20
|
+
export declare const getWebViewHtmlUrl: () => string;
|
|
21
|
+
export declare const clearWebViewData: () => void;
|
|
22
|
+
export declare const subscribeWebView: (cb: () => void) => () => void;
|