Skip to content

Commit d792631

Browse files
committed
feat: add WebSocket debugging support with tabbed interface
- Add WebSocketLogger for intercepting and logging WebSocket connections - Add DebuggerOverlay with HTTP and WebSocket tabs in a unified modal - Create WebSocketLogItem component for displaying connection details and messages - Reorganize source into features/, helpers/, icons/, and components/common/ - Add WebSocket color theming and state indicators - Update example app with bottom tabs for testing HTTP and WebSocket requests - Add WebSocketScreen for testing WebSocket connections in example app
1 parent 5d701f4 commit d792631

29 files changed

Lines changed: 3301 additions & 565 deletions

example/src/App.tsx

Lines changed: 27 additions & 518 deletions
Large diffs are not rendered by default.
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
import React from 'react';
2+
import { View, Text, TouchableOpacity, StyleSheet } from 'react-native';
3+
4+
export interface Tab {
5+
key: string;
6+
label: string;
7+
icon: string;
8+
}
9+
10+
interface BottomTabsProps {
11+
tabs: Tab[];
12+
activeTab: string;
13+
onTabPress: (key: string) => void;
14+
}
15+
16+
export const BottomTabs: React.FC<BottomTabsProps> = ({
17+
tabs,
18+
activeTab,
19+
onTabPress,
20+
}) => {
21+
return (
22+
<View style={styles.container}>
23+
{tabs.map((tab) => {
24+
const isActive = tab.key === activeTab;
25+
return (
26+
<TouchableOpacity
27+
key={tab.key}
28+
style={styles.tab}
29+
onPress={() => onTabPress(tab.key)}
30+
activeOpacity={0.7}
31+
>
32+
<View
33+
style={[
34+
styles.iconContainer,
35+
isActive && styles.iconContainerActive,
36+
]}
37+
>
38+
<Text style={[styles.icon, isActive && styles.iconActive]}>
39+
{tab.icon}
40+
</Text>
41+
</View>
42+
<Text style={[styles.label, isActive && styles.labelActive]}>
43+
{tab.label}
44+
</Text>
45+
</TouchableOpacity>
46+
);
47+
})}
48+
</View>
49+
);
50+
};
51+
52+
const styles = StyleSheet.create({
53+
container: {
54+
flexDirection: 'row',
55+
backgroundColor: '#fff',
56+
borderTopWidth: 1,
57+
borderTopColor: '#e0e0e0',
58+
paddingVertical: 8,
59+
paddingHorizontal: 16,
60+
},
61+
tab: {
62+
flex: 1,
63+
alignItems: 'center',
64+
justifyContent: 'center',
65+
paddingVertical: 4,
66+
},
67+
iconContainer: {
68+
width: 32,
69+
height: 32,
70+
borderRadius: 8,
71+
justifyContent: 'center',
72+
alignItems: 'center',
73+
backgroundColor: '#f0f0f0',
74+
marginBottom: 4,
75+
},
76+
iconContainerActive: {
77+
backgroundColor: '#E3F2FD',
78+
},
79+
icon: {
80+
fontSize: 14,
81+
fontWeight: '700',
82+
color: '#8E8E93',
83+
},
84+
iconActive: {
85+
color: '#007AFF',
86+
},
87+
label: {
88+
fontSize: 12,
89+
fontWeight: '500',
90+
color: '#8E8E93',
91+
},
92+
labelActive: {
93+
color: '#007AFF',
94+
fontWeight: '600',
95+
},
96+
});

0 commit comments

Comments
 (0)