react-native-xenon 2.1.0 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -24
- package/lib/module/assets/icons/arrow-left.png +0 -0
- package/lib/module/assets/icons/beautify.png +0 -0
- package/lib/module/assets/icons/bug.png +0 -0
- package/lib/module/assets/icons/close.png +0 -0
- package/lib/module/assets/icons/delete.png +0 -0
- package/lib/module/assets/icons/hide.png +0 -0
- package/lib/module/assets/icons/move.png +0 -0
- package/lib/module/assets/icons/record.png +0 -0
- package/lib/module/assets/icons/search.png +0 -0
- package/lib/module/assets/icons/share.png +0 -0
- package/lib/module/core/constants.js +2 -0
- package/lib/module/core/constants.js.map +1 -1
- package/lib/module/core/refs.js +11 -1
- package/lib/module/core/refs.js.map +1 -1
- package/lib/module/core/utils.js +6 -1
- package/lib/module/core/utils.js.map +1 -1
- package/lib/module/hooks/useNetworkInterceptor.js +8 -3
- package/lib/module/hooks/useNetworkInterceptor.js.map +1 -1
- package/lib/module/ui/components/bubble/Bubble.js +1 -1
- package/lib/module/ui/components/bubble/Bubble.js.map +1 -1
- package/lib/module/ui/components/common/Empty.js +26 -0
- package/lib/module/ui/components/common/Empty.js.map +1 -0
- package/lib/module/ui/components/handle/Handle.js +63 -0
- package/lib/module/ui/components/handle/Handle.js.map +1 -0
- package/lib/module/ui/components/headers/DebuggerHeader.js +3 -2
- package/lib/module/ui/components/headers/DebuggerHeader.js.map +1 -1
- package/lib/module/ui/components/items/ConsolePanelItem.js +26 -12
- package/lib/module/ui/components/items/ConsolePanelItem.js.map +1 -1
- package/lib/module/ui/components/items/NetworkPanelItem.js +50 -38
- package/lib/module/ui/components/items/NetworkPanelItem.js.map +1 -1
- package/lib/module/ui/components/panels/ConsolePanel.js +15 -14
- package/lib/module/ui/components/panels/ConsolePanel.js.map +1 -1
- package/lib/module/ui/components/panels/NetworkPanel.js +13 -10
- package/lib/module/ui/components/panels/NetworkPanel.js.map +1 -1
- package/lib/module/ui/components/panels/Panel.js +25 -13
- package/lib/module/ui/components/panels/Panel.js.map +1 -1
- package/lib/module/ui/components/search-bar/SearchBar.js +5 -13
- package/lib/module/ui/components/search-bar/SearchBar.js.map +1 -1
- package/lib/typescript/src/core/constants.d.ts +2 -0
- package/lib/typescript/src/core/constants.d.ts.map +1 -1
- package/lib/typescript/src/core/refs.d.ts +2 -1
- package/lib/typescript/src/core/refs.d.ts.map +1 -1
- package/lib/typescript/src/core/utils.d.ts +2 -1
- package/lib/typescript/src/core/utils.d.ts.map +1 -1
- package/lib/typescript/src/hooks/useNetworkInterceptor.d.ts.map +1 -1
- package/lib/typescript/src/ui/components/common/Empty.d.ts +3 -0
- package/lib/typescript/src/ui/components/common/Empty.d.ts.map +1 -0
- package/lib/typescript/src/ui/components/handle/Handle.d.ts +2 -0
- package/lib/typescript/src/ui/components/handle/Handle.d.ts.map +1 -0
- package/lib/typescript/src/ui/components/headers/DebuggerHeader.d.ts.map +1 -1
- package/lib/typescript/src/ui/components/items/ConsolePanelItem.d.ts +2 -2
- package/lib/typescript/src/ui/components/items/ConsolePanelItem.d.ts.map +1 -1
- package/lib/typescript/src/ui/components/items/NetworkPanelItem.d.ts +2 -2
- package/lib/typescript/src/ui/components/items/NetworkPanelItem.d.ts.map +1 -1
- package/lib/typescript/src/ui/components/panels/ConsolePanel.d.ts.map +1 -1
- package/lib/typescript/src/ui/components/panels/NetworkPanel.d.ts.map +1 -1
- package/lib/typescript/src/ui/components/panels/Panel.d.ts.map +1 -1
- package/lib/typescript/src/ui/components/search-bar/SearchBar.d.ts.map +1 -1
- package/package.json +2 -1
- package/src/assets/icons/arrow-left.png +0 -0
- package/src/assets/icons/beautify.png +0 -0
- package/src/assets/icons/bug.png +0 -0
- package/src/assets/icons/close.png +0 -0
- package/src/assets/icons/delete.png +0 -0
- package/src/assets/icons/hide.png +0 -0
- package/src/assets/icons/move.png +0 -0
- package/src/assets/icons/record.png +0 -0
- package/src/assets/icons/search.png +0 -0
- package/src/assets/icons/share.png +0 -0
- package/src/core/constants.ts +2 -0
- package/src/core/global.d.ts +0 -26
- package/src/core/refs.ts +10 -1
- package/src/core/utils.ts +7 -1
- package/src/hooks/useNetworkInterceptor.ts +11 -5
- package/src/ui/components/bubble/Bubble.tsx +1 -1
- package/src/ui/components/common/Empty.tsx +15 -0
- package/src/ui/components/handle/Handle.tsx +60 -0
- package/src/ui/components/headers/DebuggerHeader.tsx +3 -2
- package/src/ui/components/items/ConsolePanelItem.tsx +28 -14
- package/src/ui/components/items/NetworkPanelItem.tsx +70 -57
- package/src/ui/components/panels/ConsolePanel.tsx +16 -13
- package/src/ui/components/panels/NetworkPanel.tsx +17 -8
- package/src/ui/components/panels/Panel.tsx +28 -9
- package/src/ui/components/search-bar/SearchBar.tsx +9 -13
@@ -7,7 +7,7 @@ import {
|
|
7
7
|
type ViewStyle,
|
8
8
|
} from 'react-native';
|
9
9
|
import { MainContext } from '../../../contexts';
|
10
|
-
import
|
10
|
+
import { NETWORK_ITEM_HEIGHT } from '../../../core/constants';
|
11
11
|
import {
|
12
12
|
DebuggerPanel,
|
13
13
|
NetworkType,
|
@@ -15,11 +15,9 @@ import {
|
|
15
15
|
type ID,
|
16
16
|
type WebSocketRequest,
|
17
17
|
} from '../../../types';
|
18
|
-
import
|
18
|
+
import Empty from '../common/Empty';
|
19
19
|
import NetworkPanelItem from '../items/NetworkPanelItem';
|
20
20
|
|
21
|
-
const Separator = () => <Divider type="horizontal" />;
|
22
|
-
|
23
21
|
const NetworkPanel = forwardRef<FlatList, { style?: StyleProp<ViewStyle> }>(({ style }, ref) => {
|
24
22
|
const {
|
25
23
|
debuggerState: { searchQuery },
|
@@ -50,8 +48,6 @@ const NetworkPanel = forwardRef<FlatList, { style?: StyleProp<ViewStyle> }>(({ s
|
|
50
48
|
endTime={item.endTime}
|
51
49
|
status={item.status}
|
52
50
|
onPress={() => {
|
53
|
-
refs.header.current?.setCurrentIndex(HeaderState.Network);
|
54
|
-
refs.panel.current?.setCurrentIndex(PanelState.NetworkDetail);
|
55
51
|
setDebuggerState(draft => {
|
56
52
|
draft.detailsData = {
|
57
53
|
type: DebuggerPanel.Network,
|
@@ -66,15 +62,28 @@ const NetworkPanel = forwardRef<FlatList, { style?: StyleProp<ViewStyle> }>(({ s
|
|
66
62
|
[setDebuggerState],
|
67
63
|
);
|
68
64
|
|
65
|
+
const getItemLayout = useCallback(
|
66
|
+
(
|
67
|
+
_: ArrayLike<[NonNullable<ID>, HttpRequest | WebSocketRequest]> | null | undefined,
|
68
|
+
index: number,
|
69
|
+
) => ({
|
70
|
+
length: NETWORK_ITEM_HEIGHT,
|
71
|
+
offset: NETWORK_ITEM_HEIGHT * index,
|
72
|
+
index,
|
73
|
+
}),
|
74
|
+
[],
|
75
|
+
);
|
76
|
+
|
69
77
|
return (
|
70
78
|
<FlatList
|
71
|
-
inverted
|
79
|
+
inverted={!!data.length}
|
72
80
|
data={data}
|
73
81
|
ref={ref}
|
74
82
|
renderItem={renderItem}
|
75
83
|
keyExtractor={([key]) => key}
|
76
|
-
ItemSeparatorComponent={Separator}
|
77
84
|
style={[styles.container, style]}
|
85
|
+
ListEmptyComponent={<Empty>No records yet</Empty>}
|
86
|
+
getItemLayout={getItemLayout}
|
78
87
|
/>
|
79
88
|
);
|
80
89
|
});
|
@@ -1,33 +1,51 @@
|
|
1
|
-
import { Platform, StyleSheet, View, type ViewProps } from 'react-native';
|
2
|
-
import refs, { PanelState } from '../../../core/refs';
|
1
|
+
import { Animated, Platform, StyleSheet, View, type ViewProps } from 'react-native';
|
2
|
+
import refs, { HeaderState, PanelState } from '../../../core/refs';
|
3
3
|
import IndexedStack from '../common/IndexedStack';
|
4
4
|
import LogMessageDetails from '../details/LogMessageDetails';
|
5
5
|
import NetworkRequestDetails from '../details/NetworkRequestDetails';
|
6
6
|
import ConsolePanel from './ConsolePanel';
|
7
7
|
import NetworkPanel from './NetworkPanel';
|
8
8
|
import colors from '../../../theme/colors';
|
9
|
-
import { forwardRef, useContext, useMemo } from 'react';
|
9
|
+
import { forwardRef, useContext, useEffect, useMemo } from 'react';
|
10
10
|
import Header from '../headers/Header';
|
11
11
|
import { SafeAreaProvider } from 'react-native-safe-area-context';
|
12
12
|
import SafeArea from '../common/SafeArea';
|
13
13
|
import { MainContext } from '../../../contexts';
|
14
|
+
import Handle from '../handle/Handle';
|
15
|
+
import { DebuggerPanel } from '../../../types';
|
14
16
|
|
15
17
|
interface PanelProps extends ViewProps {}
|
16
18
|
|
17
19
|
const Panel = forwardRef<View, PanelProps>(({ style, ...props }, ref) => {
|
18
20
|
const {
|
19
|
-
debuggerState: { position },
|
20
|
-
dimensions: { width: screenWidth, height: screenHeight },
|
21
|
+
debuggerState: { position, detailsData },
|
21
22
|
} = useContext(MainContext)!;
|
22
23
|
|
23
24
|
const containerStyle = useMemo(
|
24
|
-
() => [
|
25
|
-
|
25
|
+
() => [
|
26
|
+
styles.container,
|
27
|
+
{ [position]: 0, width: refs.panelSize.current?.x, height: refs.panelSize.current?.y },
|
28
|
+
],
|
29
|
+
[position],
|
26
30
|
);
|
27
31
|
|
32
|
+
useEffect(() => {
|
33
|
+
switch (detailsData?.type) {
|
34
|
+
case DebuggerPanel.Network:
|
35
|
+
refs.header.current?.setCurrentIndex(HeaderState.Network);
|
36
|
+
refs.panel.current?.setCurrentIndex(PanelState.NetworkDetail);
|
37
|
+
break;
|
38
|
+
case DebuggerPanel.Console:
|
39
|
+
refs.header.current?.setCurrentIndex(HeaderState.Console);
|
40
|
+
refs.panel.current?.setCurrentIndex(PanelState.ConsoleDetail);
|
41
|
+
break;
|
42
|
+
}
|
43
|
+
}, [detailsData?.type]);
|
44
|
+
|
28
45
|
return (
|
29
|
-
<View style={[containerStyle, style]} ref={ref} {...props}>
|
46
|
+
<Animated.View style={[containerStyle, style]} ref={ref} {...props}>
|
30
47
|
<SafeAreaProvider>
|
48
|
+
{position === 'bottom' && <Handle />}
|
31
49
|
{position === 'top' && <SafeArea inset="top" />}
|
32
50
|
|
33
51
|
<Header />
|
@@ -39,9 +57,10 @@ const Panel = forwardRef<View, PanelProps>(({ style, ...props }, ref) => {
|
|
39
57
|
<LogMessageDetails />
|
40
58
|
</IndexedStack>
|
41
59
|
|
60
|
+
{position === 'top' && <Handle />}
|
42
61
|
{position === 'bottom' && <SafeArea inset="bottom" />}
|
43
62
|
</SafeAreaProvider>
|
44
|
-
</View>
|
63
|
+
</Animated.View>
|
45
64
|
);
|
46
65
|
});
|
47
66
|
|
@@ -20,6 +20,8 @@ import SafeArea from '../common/SafeArea';
|
|
20
20
|
|
21
21
|
interface SearchBarProps extends ViewProps {}
|
22
22
|
|
23
|
+
const ICON_SIZE = 20;
|
24
|
+
|
23
25
|
const SearchBar = forwardRef<View, SearchBarProps>(({ style, ...props }, ref) => {
|
24
26
|
const {
|
25
27
|
debuggerState: { searchQuery },
|
@@ -34,7 +36,7 @@ const SearchBar = forwardRef<View, SearchBarProps>(({ style, ...props }, ref) =>
|
|
34
36
|
};
|
35
37
|
|
36
38
|
const onClear = () => {
|
37
|
-
|
39
|
+
setValue('');
|
38
40
|
};
|
39
41
|
|
40
42
|
const onSubmitEditing = ({
|
@@ -53,7 +55,7 @@ const SearchBar = forwardRef<View, SearchBarProps>(({ style, ...props }, ref) =>
|
|
53
55
|
<SafeArea inset="top" />
|
54
56
|
|
55
57
|
<View style={styles.inputWrapper}>
|
56
|
-
<Icon source={icons.search} size={
|
58
|
+
<Icon source={icons.search} size={ICON_SIZE} />
|
57
59
|
|
58
60
|
<TextInput
|
59
61
|
autoCapitalize="none"
|
@@ -71,9 +73,11 @@ const SearchBar = forwardRef<View, SearchBarProps>(({ style, ...props }, ref) =>
|
|
71
73
|
onSubmitEditing={onSubmitEditing}
|
72
74
|
/>
|
73
75
|
|
74
|
-
|
75
|
-
<
|
76
|
-
|
76
|
+
{!!value.length && (
|
77
|
+
<Touchable hitSlop={8} onPress={onClear}>
|
78
|
+
<Icon source={icons.close} size={ICON_SIZE} color={colors.black} />
|
79
|
+
</Touchable>
|
80
|
+
)}
|
77
81
|
</View>
|
78
82
|
</View>
|
79
83
|
|
@@ -116,14 +120,6 @@ const styles = StyleSheet.create({
|
|
116
120
|
color: colors.black,
|
117
121
|
flex: 1,
|
118
122
|
},
|
119
|
-
closeButton: {
|
120
|
-
justifyContent: 'center',
|
121
|
-
alignItems: 'center',
|
122
|
-
width: 18,
|
123
|
-
height: 18,
|
124
|
-
borderRadius: 9,
|
125
|
-
backgroundColor: colors.gray,
|
126
|
-
},
|
127
123
|
});
|
128
124
|
|
129
125
|
export default SearchBar;
|