PC端的部分适配
This commit is contained in:
@@ -45,16 +45,36 @@ import {
|
||||
ChatHeader,
|
||||
MessageBubble,
|
||||
ChatInput,
|
||||
GroupInfoPanel,
|
||||
PANEL_HEIGHTS,
|
||||
} from './components/ChatScreen';
|
||||
|
||||
export const ChatScreen: React.FC = () => {
|
||||
const navigation = useNavigation();
|
||||
const navigation = useNavigation<any>();
|
||||
const insets = useSafeAreaInsets();
|
||||
|
||||
// 响应式布局
|
||||
const isWideScreen = useBreakpointGTE('lg');
|
||||
const styles = baseStyles;
|
||||
|
||||
// 监听屏幕宽度变化,当变为大屏幕时自动跳转到web端首页
|
||||
useEffect(() => {
|
||||
if (isWideScreen) {
|
||||
// 导航到大屏幕模式的主界面首页
|
||||
navigation.reset({
|
||||
index: 0,
|
||||
routes: [
|
||||
{
|
||||
name: 'Main',
|
||||
params: {
|
||||
screen: 'HomeTab',
|
||||
params: { screen: 'Home' }
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
}, [isWideScreen, navigation]);
|
||||
|
||||
// 输入框区域高度(用于定位浮动 mention 面板)
|
||||
const [inputWrapperHeight, setInputWrapperHeight] = useState(60);
|
||||
@@ -93,6 +113,19 @@ export const ChatScreen: React.FC = () => {
|
||||
setShowImageViewer(false);
|
||||
};
|
||||
|
||||
// 群信息面板状态
|
||||
const [showGroupInfoPanel, setShowGroupInfoPanel] = useState(false);
|
||||
|
||||
// 打开群信息面板
|
||||
const handleGroupInfoPress = useCallback(() => {
|
||||
setShowGroupInfoPanel(true);
|
||||
}, []);
|
||||
|
||||
// 关闭群信息面板
|
||||
const handleCloseGroupInfoPanel = useCallback(() => {
|
||||
setShowGroupInfoPanel(false);
|
||||
}, []);
|
||||
|
||||
const {
|
||||
// 状态
|
||||
messages,
|
||||
@@ -125,6 +158,7 @@ export const ChatScreen: React.FC = () => {
|
||||
messageMap,
|
||||
loadingMore,
|
||||
hasMoreHistory,
|
||||
conversationId,
|
||||
|
||||
// Refs
|
||||
flatListRef,
|
||||
@@ -222,6 +256,8 @@ export const ChatScreen: React.FC = () => {
|
||||
onBack={() => navigation.goBack()}
|
||||
onTitlePress={navigateToInfo}
|
||||
onMorePress={navigateToChatSettings}
|
||||
onGroupInfoPress={handleGroupInfoPress}
|
||||
isWideScreen={isWideScreen}
|
||||
/>
|
||||
|
||||
{/* 消息列表 */}
|
||||
@@ -369,6 +405,33 @@ export const ChatScreen: React.FC = () => {
|
||||
onClose={handleCloseImageViewer}
|
||||
enableSave
|
||||
/>
|
||||
|
||||
{/* 群信息侧边栏面板 - 仅大屏幕显示 */}
|
||||
<GroupInfoPanel
|
||||
visible={showGroupInfoPanel}
|
||||
groupId={routeGroupId ? String(routeGroupId) : undefined}
|
||||
groupInfo={groupInfo as any}
|
||||
conversationId={conversationId || undefined}
|
||||
currentUserId={currentUserId}
|
||||
isPinned={false}
|
||||
onClose={handleCloseGroupInfoPanel}
|
||||
onTogglePin={(pinned) => {
|
||||
// TODO: 实现置顶功能
|
||||
console.log('Toggle pin:', pinned);
|
||||
}}
|
||||
onLeaveGroup={() => {
|
||||
// TODO: 实现退出群聊功能
|
||||
console.log('Leave group');
|
||||
}}
|
||||
onInviteMembers={() => {
|
||||
// TODO: 实现邀请新成员功能
|
||||
console.log('Invite members');
|
||||
}}
|
||||
onViewAllMembers={() => {
|
||||
// TODO: 实现查看全部成员功能
|
||||
console.log('View all members');
|
||||
}}
|
||||
/>
|
||||
</KeyboardAvoidingView>
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user