react-native-xenon 2.3.0 → 2.4.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.
Files changed (79) hide show
  1. package/lib/module/core/utils.js +1 -1
  2. package/lib/module/core/utils.js.map +1 -1
  3. package/lib/module/ui/Xenon.js +1 -1
  4. package/lib/module/ui/Xenon.js.map +1 -1
  5. package/lib/module/ui/components/bubble/Bubble.js +4 -6
  6. package/lib/module/ui/components/bubble/Bubble.js.map +1 -1
  7. package/lib/module/ui/components/common/IndexedStack.js +5 -6
  8. package/lib/module/ui/components/common/IndexedStack.js.map +1 -1
  9. package/lib/module/ui/components/details/LogMessageDetails.js +10 -9
  10. package/lib/module/ui/components/details/LogMessageDetails.js.map +1 -1
  11. package/lib/module/ui/components/details/NetworkRequestDetails.js +6 -6
  12. package/lib/module/ui/components/details/NetworkRequestDetails.js.map +1 -1
  13. package/lib/module/ui/components/headers/ConsoleHeader.js +5 -6
  14. package/lib/module/ui/components/headers/ConsoleHeader.js.map +1 -1
  15. package/lib/module/ui/components/headers/DebuggerHeader.js +7 -7
  16. package/lib/module/ui/components/headers/DebuggerHeader.js.map +1 -1
  17. package/lib/module/ui/components/headers/HeaderComponents.js +6 -5
  18. package/lib/module/ui/components/headers/HeaderComponents.js.map +1 -1
  19. package/lib/module/ui/components/headers/NetworkHeader.js +6 -6
  20. package/lib/module/ui/components/headers/NetworkHeader.js.map +1 -1
  21. package/lib/module/ui/components/items/ConsolePanelItem.js +1 -3
  22. package/lib/module/ui/components/items/ConsolePanelItem.js.map +1 -1
  23. package/lib/module/ui/components/items/DebuggerHeaderItem.js +2 -1
  24. package/lib/module/ui/components/items/DebuggerHeaderItem.js.map +1 -1
  25. package/lib/module/ui/components/items/NetworkPanelItem.js +1 -3
  26. package/lib/module/ui/components/items/NetworkPanelItem.js.map +1 -1
  27. package/lib/module/ui/components/panels/ConsolePanel.js +6 -6
  28. package/lib/module/ui/components/panels/ConsolePanel.js.map +1 -1
  29. package/lib/module/ui/components/panels/NetworkPanel.js +7 -7
  30. package/lib/module/ui/components/panels/NetworkPanel.js.map +1 -1
  31. package/lib/module/ui/components/panels/Panel.js +4 -6
  32. package/lib/module/ui/components/panels/Panel.js.map +1 -1
  33. package/lib/module/ui/components/search-bar/SearchBar.js +4 -6
  34. package/lib/module/ui/components/search-bar/SearchBar.js.map +1 -1
  35. package/lib/typescript/src/ui/Xenon.d.ts +16 -14
  36. package/lib/typescript/src/ui/Xenon.d.ts.map +1 -1
  37. package/lib/typescript/src/ui/components/bubble/Bubble.d.ts +4 -2
  38. package/lib/typescript/src/ui/components/bubble/Bubble.d.ts.map +1 -1
  39. package/lib/typescript/src/ui/components/common/IndexedStack.d.ts +4 -3
  40. package/lib/typescript/src/ui/components/common/IndexedStack.d.ts.map +1 -1
  41. package/lib/typescript/src/ui/components/details/LogMessageDetails.d.ts +6 -3
  42. package/lib/typescript/src/ui/components/details/LogMessageDetails.d.ts.map +1 -1
  43. package/lib/typescript/src/ui/components/details/NetworkRequestDetails.d.ts +6 -3
  44. package/lib/typescript/src/ui/components/details/NetworkRequestDetails.d.ts.map +1 -1
  45. package/lib/typescript/src/ui/components/headers/ConsoleHeader.d.ts +5 -3
  46. package/lib/typescript/src/ui/components/headers/ConsoleHeader.d.ts.map +1 -1
  47. package/lib/typescript/src/ui/components/headers/DebuggerHeader.d.ts +4 -2
  48. package/lib/typescript/src/ui/components/headers/DebuggerHeader.d.ts.map +1 -1
  49. package/lib/typescript/src/ui/components/headers/HeaderComponents.d.ts +6 -5
  50. package/lib/typescript/src/ui/components/headers/HeaderComponents.d.ts.map +1 -1
  51. package/lib/typescript/src/ui/components/headers/NetworkHeader.d.ts +4 -2
  52. package/lib/typescript/src/ui/components/headers/NetworkHeader.d.ts.map +1 -1
  53. package/lib/typescript/src/ui/components/items/NetworkPanelItem.d.ts.map +1 -1
  54. package/lib/typescript/src/ui/components/panels/ConsolePanel.d.ts +6 -3
  55. package/lib/typescript/src/ui/components/panels/ConsolePanel.d.ts.map +1 -1
  56. package/lib/typescript/src/ui/components/panels/NetworkPanel.d.ts +7 -5
  57. package/lib/typescript/src/ui/components/panels/NetworkPanel.d.ts.map +1 -1
  58. package/lib/typescript/src/ui/components/panels/Panel.d.ts +5 -3
  59. package/lib/typescript/src/ui/components/panels/Panel.d.ts.map +1 -1
  60. package/lib/typescript/src/ui/components/search-bar/SearchBar.d.ts +4 -2
  61. package/lib/typescript/src/ui/components/search-bar/SearchBar.d.ts.map +1 -1
  62. package/package.json +2 -1
  63. package/src/core/utils.ts +1 -1
  64. package/src/ui/Xenon.tsx +18 -15
  65. package/src/ui/components/bubble/Bubble.tsx +97 -100
  66. package/src/ui/components/common/IndexedStack.tsx +8 -20
  67. package/src/ui/components/details/LogMessageDetails.tsx +25 -27
  68. package/src/ui/components/details/NetworkRequestDetails.tsx +152 -151
  69. package/src/ui/components/headers/ConsoleHeader.tsx +13 -16
  70. package/src/ui/components/headers/DebuggerHeader.tsx +82 -83
  71. package/src/ui/components/headers/HeaderComponents.tsx +18 -16
  72. package/src/ui/components/headers/NetworkHeader.tsx +47 -50
  73. package/src/ui/components/items/ConsolePanelItem.tsx +3 -3
  74. package/src/ui/components/items/DebuggerHeaderItem.tsx +1 -0
  75. package/src/ui/components/items/NetworkPanelItem.tsx +6 -9
  76. package/src/ui/components/panels/ConsolePanel.tsx +8 -5
  77. package/src/ui/components/panels/NetworkPanel.tsx +9 -13
  78. package/src/ui/components/panels/Panel.tsx +7 -7
  79. package/src/ui/components/search-bar/SearchBar.tsx +7 -7
@@ -1,6 +1,8 @@
1
1
  import { View, type ViewProps } from 'react-native';
2
- interface PanelProps extends ViewProps {
2
+ import { type Ref } from 'react';
3
+ interface PanelComponentProps extends ViewProps {
4
+ ref?: Ref<View>;
3
5
  }
4
- declare const Panel: import("react").ForwardRefExoticComponent<PanelProps & import("react").RefAttributes<View>>;
5
- export default Panel;
6
+ export default function Panel({ style, ...props }: PanelComponentProps): import("react/jsx-runtime").JSX.Element;
7
+ export {};
6
8
  //# sourceMappingURL=Panel.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Panel.d.ts","sourceRoot":"","sources":["../../../../../../src/ui/components/panels/Panel.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAkC,IAAI,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAgBpF,UAAU,UAAW,SAAQ,SAAS;CAAG;AAEzC,QAAA,MAAM,KAAK,6FA8CT,CAAC;AAgBH,eAAe,KAAK,CAAC"}
1
+ {"version":3,"file":"Panel.d.ts","sourceRoot":"","sources":["../../../../../../src/ui/components/panels/Panel.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAkC,IAAI,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAQpF,OAAO,EAAkC,KAAK,GAAG,EAAE,MAAM,OAAO,CAAC;AAQjE,UAAU,mBAAoB,SAAQ,SAAS;IAC7C,GAAG,CAAC,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC;CACjB;AAED,MAAM,CAAC,OAAO,UAAU,KAAK,CAAC,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,EAAE,mBAAmB,2CA8CrE"}
@@ -1,6 +1,8 @@
1
+ import { type Ref } from 'react';
1
2
  import { View, type ViewProps } from 'react-native';
2
3
  interface SearchBarProps extends ViewProps {
4
+ ref?: Ref<View>;
3
5
  }
4
- declare const SearchBar: import("react").ForwardRefExoticComponent<SearchBarProps & import("react").RefAttributes<View>>;
5
- export default SearchBar;
6
+ export default function SearchBar({ style, ...props }: SearchBarProps): import("react/jsx-runtime").JSX.Element;
7
+ export {};
6
8
  //# sourceMappingURL=SearchBar.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"SearchBar.d.ts","sourceRoot":"","sources":["../../../../../../src/ui/components/search-bar/SearchBar.tsx"],"names":[],"mappings":"AACA,OAAO,EAKL,IAAI,EAGJ,KAAK,SAAS,EACf,MAAM,cAAc,CAAC;AAUtB,UAAU,cAAe,SAAQ,SAAS;CAAG;AAI7C,QAAA,MAAM,SAAS,iGAiEb,CAAC;AAmCH,eAAe,SAAS,CAAC"}
1
+ {"version":3,"file":"SearchBar.d.ts","sourceRoot":"","sources":["../../../../../../src/ui/components/search-bar/SearchBar.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAwB,KAAK,GAAG,EAAE,MAAM,OAAO,CAAC;AACvD,OAAO,EAKL,IAAI,EAGJ,KAAK,SAAS,EACf,MAAM,cAAc,CAAC;AAUtB,UAAU,cAAe,SAAQ,SAAS;IACxC,GAAG,CAAC,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC;CACjB;AAID,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,EAAE,cAAc,2CAiEpE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-xenon",
3
- "version": "2.3.0",
3
+ "version": "2.4.0",
4
4
  "description": "A powerful in-app debugging tool for React Native.",
5
5
  "main": "./lib/module/index.js",
6
6
  "types": "./lib/typescript/src/index.d.ts",
@@ -36,6 +36,7 @@
36
36
  "test": "jest",
37
37
  "typecheck": "tsc",
38
38
  "lint": "eslint \"**/*.{js,ts,tsx}\"",
39
+ "format": "prettier --write \"**/*.{js,ts,tsx,json,md}\"",
39
40
  "clean": "del-cli lib",
40
41
  "prepare": "bob build",
41
42
  "release": "release-it --only-version"
package/src/core/utils.ts CHANGED
@@ -92,7 +92,7 @@ export const getHttpInterceptorId = () => {
92
92
  //#region formatters
93
93
  export const showNewLine = (when: boolean) => (when ? '\n' : '');
94
94
 
95
- const limitChar = (value: any, limit = 5000) => {
95
+ const limitChar = (value: any, limit = 100000) => {
96
96
  const stringValue = typeof value === 'string' ? value : JSON.stringify(value ?? '');
97
97
 
98
98
  return stringValue.length > limit
package/src/ui/Xenon.tsx CHANGED
@@ -10,13 +10,19 @@ import { type DebuggerState } from '../types';
10
10
  import { Bubble, IndexedStack, Panel, SearchBar } from './components';
11
11
 
12
12
  namespace Xenon {
13
- interface Methods {
13
+ export interface Methods {
14
14
  isVisible(): boolean;
15
15
  show(): void;
16
16
  hide(): void;
17
17
  }
18
18
 
19
- interface Props {
19
+ export interface Props {
20
+ children: ReactNode;
21
+ /**
22
+ * If true, completely disables the debugger by rendering only the children components without any debugging functionality.
23
+ * @default false
24
+ */
25
+ disabled?: boolean;
20
26
  /**
21
27
  * Determines whether the network inspector is automatically enabled upon initialization.
22
28
  * @default true
@@ -45,15 +51,6 @@ namespace Xenon {
45
51
  includeDomains?: string[];
46
52
  }
47
53
 
48
- interface WrapperProps extends Props {
49
- /**
50
- * If true, completely disables the debugger by rendering only the children components without any debugging functionality.
51
- * @default false
52
- */
53
- disabled?: boolean;
54
- children: ReactNode;
55
- }
56
-
57
54
  enableMapSet();
58
55
  const ref = createRef<Methods>();
59
56
 
@@ -61,7 +58,7 @@ namespace Xenon {
61
58
  * Checks whether the debugger is currently visible.
62
59
  * @returns `true` if the debugger is currently visible, otherwise `false`.
63
60
  */
64
- export const isVisible = () => ref.current?.isVisible() ?? false;
61
+ export const isVisible = (): boolean => ref.current?.isVisible() ?? false;
65
62
 
66
63
  /**
67
64
  * Makes the debugger visible. If it is already visible, this method has no additional effect.
@@ -75,14 +72,14 @@ namespace Xenon {
75
72
  */
76
73
  export const hide = (): void => ref.current?.hide();
77
74
 
78
- const Debugger = memo(
75
+ const Debugger = memo<Omit<Props, 'children' | 'disabled'>>(
79
76
  ({
80
77
  autoInspectNetworkEnabled = true,
81
78
  autoInspectConsoleEnabled = true,
82
79
  bubbleSize = 40,
83
80
  idleBubbleOpacity = 0.5,
84
81
  includeDomains,
85
- }: Props) => {
82
+ }) => {
86
83
  const dimensions = useWindowDimensions();
87
84
 
88
85
  const [debuggerState, setDebuggerState] = useImmer<DebuggerState>({
@@ -142,9 +139,15 @@ namespace Xenon {
142
139
  </MainContext.Provider>
143
140
  );
144
141
  },
142
+ (prevProps, nextProps) =>
143
+ prevProps.autoInspectNetworkEnabled === nextProps.autoInspectNetworkEnabled &&
144
+ prevProps.autoInspectConsoleEnabled === nextProps.autoInspectConsoleEnabled &&
145
+ prevProps.bubbleSize === nextProps.bubbleSize &&
146
+ prevProps.idleBubbleOpacity === nextProps.idleBubbleOpacity &&
147
+ JSON.stringify(prevProps.includeDomains) === JSON.stringify(nextProps.includeDomains),
145
148
  );
146
149
 
147
- export function Wrapper({ disabled = false, children, ...props }: WrapperProps): JSX.Element {
150
+ export function Wrapper({ disabled = false, children, ...props }: Props): JSX.Element {
148
151
  if (disabled) return children as JSX.Element;
149
152
 
150
153
  return (
@@ -1,4 +1,4 @@
1
- import { forwardRef, useContext, useMemo, useRef, useState } from 'react';
1
+ import { useContext, useMemo, useRef, useState, type Ref } from 'react';
2
2
  import {
3
3
  Animated,
4
4
  PanResponder,
@@ -17,106 +17,105 @@ import Icon from '../common/Icon';
17
17
  interface BubbleProps extends ViewProps {
18
18
  bubbleSize: number;
19
19
  idleBubbleOpacity: number;
20
+ ref?: Ref<View>;
20
21
  }
21
22
 
22
- const Bubble = forwardRef<View, BubbleProps>(
23
- ({ bubbleSize, idleBubbleOpacity, style, ...props }, ref) => {
24
- const {
25
- dimensions: { width: screenWidth, height: screenHeight },
26
- } = useContext(MainContext)!;
27
- const [idleOpacity, setIdleOpacity] = useState(idleBubbleOpacity);
28
- const pan = useRef(new Animated.ValueXY({ x: 0, y: getVerticalSafeMargin(screenHeight) }));
29
- const opacityTimer = useRef<NodeJS.Timeout | null>(null);
30
-
31
- const panResponder = useMemo(() => {
32
- const clearTimer = () => {
33
- if (opacityTimer.current) clearTimeout(opacityTimer.current);
34
- opacityTimer.current = null;
35
- };
36
-
37
- const blur = () => {
38
- opacityTimer.current = setTimeout(() => {
39
- setIdleOpacity(idleBubbleOpacity);
40
- clearTimer();
41
- }, 1000);
42
- };
43
-
44
- return PanResponder.create({
45
- onStartShouldSetPanResponder: () => true,
46
- onMoveShouldSetPanResponder: () => true,
47
- onPanResponderGrant: () => {
48
- pan.current.setOffset({
49
- // @ts-ignore
50
- x: pan.current.x._value,
51
- // @ts-ignore
52
- y: pan.current.y._value,
53
- });
54
-
55
- pan.current.setValue({ x: 0, y: 0 });
56
-
57
- clearTimer();
58
- setIdleOpacity(1);
59
- },
60
- onPanResponderMove: Animated.event([null, { dx: pan.current.x, dy: pan.current.y }], {
23
+ export default function Bubble({ bubbleSize, idleBubbleOpacity, style, ...props }: BubbleProps) {
24
+ const {
25
+ dimensions: { width: screenWidth, height: screenHeight },
26
+ } = useContext(MainContext)!;
27
+ const [idleOpacity, setIdleOpacity] = useState(idleBubbleOpacity);
28
+ const pan = useRef(new Animated.ValueXY({ x: 0, y: getVerticalSafeMargin(screenHeight) }));
29
+ const opacityTimer = useRef<NodeJS.Timeout | null>(null);
30
+
31
+ const panResponder = useMemo(() => {
32
+ const clearTimer = () => {
33
+ if (opacityTimer.current) clearTimeout(opacityTimer.current);
34
+ opacityTimer.current = null;
35
+ };
36
+
37
+ const blur = () => {
38
+ opacityTimer.current = setTimeout(() => {
39
+ setIdleOpacity(idleBubbleOpacity);
40
+ clearTimer();
41
+ }, 1000);
42
+ };
43
+
44
+ return PanResponder.create({
45
+ onStartShouldSetPanResponder: () => true,
46
+ onMoveShouldSetPanResponder: () => true,
47
+ onPanResponderGrant: () => {
48
+ pan.current.setOffset({
49
+ // @ts-ignore
50
+ x: pan.current.x._value,
51
+ // @ts-ignore
52
+ y: pan.current.y._value,
53
+ });
54
+
55
+ pan.current.setValue({ x: 0, y: 0 });
56
+
57
+ clearTimer();
58
+ setIdleOpacity(1);
59
+ },
60
+ onPanResponderMove: Animated.event([null, { dx: pan.current.x, dy: pan.current.y }], {
61
+ useNativeDriver: false,
62
+ }),
63
+ onPanResponderRelease: (_, gesture: PanResponderGestureState) => {
64
+ pan.current.flattenOffset();
65
+
66
+ const isTapGesture =
67
+ gesture.dx > -10 && gesture.dx < 10 && gesture.dy > -10 && gesture.dy < 10;
68
+ if (isTapGesture) {
69
+ refs.debugger.current?.setCurrentIndex(DebuggerVisibility.Panel);
70
+ }
71
+
72
+ if (gesture.moveX === 0 && gesture.moveY === 0) {
73
+ blur();
74
+ return;
75
+ }
76
+
77
+ const finalX =
78
+ gesture.moveX < (screenWidth - bubbleSize) / 2 ? 0 : screenWidth - bubbleSize;
79
+
80
+ const verticalSafeMargin = getVerticalSafeMargin(screenHeight);
81
+
82
+ const finalY = clamp(
83
+ verticalSafeMargin,
84
+ screenHeight - verticalSafeMargin - bubbleSize,
85
+ gesture.moveY,
86
+ );
87
+
88
+ Animated.spring(pan.current, {
89
+ toValue: { x: finalX, y: finalY },
61
90
  useNativeDriver: false,
62
- }),
63
- onPanResponderRelease: (_, gesture: PanResponderGestureState) => {
64
- pan.current.flattenOffset();
65
-
66
- const isTapGesture =
67
- gesture.dx > -10 && gesture.dx < 10 && gesture.dy > -10 && gesture.dy < 10;
68
- if (isTapGesture) {
69
- refs.debugger.current?.setCurrentIndex(DebuggerVisibility.Panel);
70
- }
71
-
72
- if (gesture.moveX === 0 && gesture.moveY === 0) {
73
- blur();
74
- return;
75
- }
76
-
77
- const finalX =
78
- gesture.moveX < (screenWidth - bubbleSize) / 2 ? 0 : screenWidth - bubbleSize;
79
-
80
- const verticalSafeMargin = getVerticalSafeMargin(screenHeight);
81
-
82
- const finalY = clamp(
83
- verticalSafeMargin,
84
- screenHeight - verticalSafeMargin - bubbleSize,
85
- gesture.moveY,
86
- );
87
-
88
- Animated.spring(pan.current, {
89
- toValue: { x: finalX, y: finalY },
90
- useNativeDriver: false,
91
- }).start(({ finished }) => {
92
- if (!finished) return;
93
- blur();
94
- });
95
- },
96
- });
97
- }, [bubbleSize, idleBubbleOpacity, screenHeight, screenWidth]);
98
-
99
- return (
100
- <View ref={ref} style={[styles.bubbleBackdrop, style]} {...props}>
101
- <Animated.View
102
- {...panResponder.panHandlers}
103
- style={[
104
- styles.bubble,
105
- {
106
- width: bubbleSize,
107
- height: bubbleSize,
108
- borderRadius: bubbleSize / 2,
109
- transform: pan.current.getTranslateTransform(),
110
- opacity: idleOpacity,
111
- },
112
- ]}
113
- >
114
- <Icon source={icons.bug} size={bubbleSize * 0.65} />
115
- </Animated.View>
116
- </View>
117
- );
118
- },
119
- );
91
+ }).start(({ finished }) => {
92
+ if (!finished) return;
93
+ blur();
94
+ });
95
+ },
96
+ });
97
+ }, [bubbleSize, idleBubbleOpacity, screenHeight, screenWidth]);
98
+
99
+ return (
100
+ <View style={[styles.bubbleBackdrop, style]} {...props}>
101
+ <Animated.View
102
+ {...panResponder.panHandlers}
103
+ style={[
104
+ styles.bubble,
105
+ {
106
+ width: bubbleSize,
107
+ height: bubbleSize,
108
+ borderRadius: bubbleSize / 2,
109
+ transform: pan.current.getTranslateTransform(),
110
+ opacity: idleOpacity,
111
+ },
112
+ ]}
113
+ >
114
+ <Icon source={icons.bug} size={bubbleSize * 0.65} />
115
+ </Animated.View>
116
+ </View>
117
+ );
118
+ }
120
119
 
121
120
  const styles = StyleSheet.create({
122
121
  bubbleBackdrop: {
@@ -131,5 +130,3 @@ const styles = StyleSheet.create({
131
130
  alignItems: 'center',
132
131
  },
133
132
  });
134
-
135
- export default Bubble;
@@ -1,19 +1,11 @@
1
- import {
2
- Children,
3
- createElement,
4
- forwardRef,
5
- useImperativeHandle,
6
- useRef,
7
- type ForwardedRef,
8
- type JSX,
9
- type RefAttributes,
10
- } from 'react';
1
+ import { Children, createElement, useImperativeHandle, useRef, type JSX, type Ref } from 'react';
11
2
  import { type NativeMethods } from 'react-native';
12
3
 
13
4
  interface IndexedStackProps<T extends number> {
14
5
  children: JSX.Element[];
15
6
  id: string;
16
7
  defaultIndex: T;
8
+ ref: Ref<IndexedStackMethods<T>>;
17
9
  }
18
10
 
19
11
  export type IndexedStackMethods<T extends number> = {
@@ -21,10 +13,12 @@ export type IndexedStackMethods<T extends number> = {
21
13
  setCurrentIndex: (index: T) => void;
22
14
  };
23
15
 
24
- function IndexedStackComponent<T extends number>(
25
- { children, defaultIndex, id }: IndexedStackProps<T>,
26
- ref: ForwardedRef<IndexedStackMethods<T>>,
27
- ) {
16
+ export default function IndexedStack<T extends number>({
17
+ children,
18
+ defaultIndex,
19
+ id,
20
+ ref,
21
+ }: IndexedStackProps<T>) {
28
22
  const currentIndex = useRef<T>(defaultIndex as T);
29
23
  const childrenRefs = useRef<NativeMethods[]>([]);
30
24
 
@@ -54,9 +48,3 @@ function IndexedStackComponent<T extends number>(
54
48
  });
55
49
  });
56
50
  }
57
-
58
- const IndexedStack = forwardRef(IndexedStackComponent) as <T extends number>(
59
- props: IndexedStackProps<T> & RefAttributes<IndexedStackMethods<T>>,
60
- ) => JSX.Element;
61
-
62
- export default IndexedStack;
@@ -1,33 +1,33 @@
1
- import { ScrollView, StyleSheet, Text, type StyleProp, type ViewStyle } from 'react-native';
1
+ import { useContext, type Ref } from 'react';
2
+ import { ScrollView, StyleSheet, type StyleProp, type ViewStyle } from 'react-native';
3
+ import { MainContext } from '../../../contexts';
2
4
  import { formatLogMessage, getConsoleTypeColor } from '../../../core/utils';
3
- import type { LogMessage } from '../../../types';
4
5
  import colors from '../../../theme/colors';
5
- import { forwardRef, useContext } from 'react';
6
- import { MainContext } from '../../../contexts';
6
+ import type { LogMessage } from '../../../types';
7
+ import ShareableText from '../common/ShareableText';
7
8
 
8
- const LogMessageDetails = forwardRef<ScrollView, { style?: StyleProp<ViewStyle> }>(
9
- ({ style }, ref) => {
10
- const {
11
- debuggerState: { detailsData },
12
- } = useContext(MainContext)!;
9
+ interface LogMessageDetailsProps {
10
+ style?: StyleProp<ViewStyle>;
11
+ ref?: Ref<ScrollView>;
12
+ }
13
13
 
14
- const item = detailsData?.data as LogMessage | undefined;
14
+ export default function LogMessageDetails({ style, ref }: LogMessageDetailsProps) {
15
+ const {
16
+ debuggerState: { detailsData },
17
+ } = useContext(MainContext)!;
15
18
 
16
- return (
17
- <ScrollView
18
- ref={ref}
19
- style={[
20
- styles.container,
21
- { backgroundColor: getConsoleTypeColor(item?.type ?? '') },
22
- style,
23
- ]}
24
- contentContainerStyle={styles.contentContainer}
25
- >
26
- <Text style={styles.text}>{formatLogMessage(item?.values ?? [])}</Text>
27
- </ScrollView>
28
- );
29
- },
30
- );
19
+ const item = detailsData?.data as LogMessage | undefined;
20
+
21
+ return (
22
+ <ScrollView
23
+ ref={ref}
24
+ style={[styles.container, { backgroundColor: getConsoleTypeColor(item?.type ?? '') }, style]}
25
+ contentContainerStyle={styles.contentContainer}
26
+ >
27
+ <ShareableText style={styles.text}>{formatLogMessage(item?.values ?? [])}</ShareableText>
28
+ </ScrollView>
29
+ );
30
+ }
31
31
 
32
32
  const styles = StyleSheet.create({
33
33
  container: {
@@ -41,5 +41,3 @@ const styles = StyleSheet.create({
41
41
  fontSize: 14,
42
42
  },
43
43
  });
44
-
45
- export default LogMessageDetails;