/* eslint-disable no-use-before-define */
import { StackScreenProps } from '@react-navigation/stack';
import * as React from 'react';
import { useFocusEffect, useNavigation } from '@react-navigation/native';
import { Div, Button, Image, Text, Avatar } from 'react-native-magnus';
import { ScrollView, FlatList } from 'react-native-gesture-handler';
import { createMaterialTopTabNavigator } from '@react-navigation/material-top-tabs';
import Constants from 'expo-constants';
import { useTranslation } from 'react-i18next';
import useModel from 'flooks';
import { useMount } from '@umijs/hooks';
import IM from './model.ts';
import User from '../flooks/User';
import NoticeCom from './NoticeCom.tsx';
const NoticeTab = createMaterialTopTabNavigator();
export default function NoticeScreen({ navigation }: StackScreenProps) {
const { t } = useTranslation();
const webRef = React.useRef();
const { initChat } = useModel(IM, []);
useFocusEffect(
React.useCallback(() => {
initChat();
}, [])
);
return (
);
}
function SysNoticeScreen({ navigation }) {
const { sysNoticeList } = useModel(IM, ['sysNoticeList']);
const { t } = useTranslation();
return (
{
return (
{
navigation.navigate('NoticeStack', {
screen: 'EmailDetail',
params: {
emailId: item.id,
},
});
}}
/>
);
}}
data={sysNoticeList}
keyExtractor={(item, index) => `email${index}`}
ListEmptyComponent={() => {
return (
{t('zan-wu-shu-ju')}
);
}}
contentContainerStyle={{ flexGrow: 1, backgroundColor: '#fff' }}
/>
);
}
function UserChatScreen({ navigation }) {
const { chatList } = useModel(IM, ['chatList']);
const { id } = useModel(User, ['id']);
const { t } = useTranslation();
return (
{
const isReceive = item.receiveUserId === id;
const toUserId = isReceive ? item.sendUserId : item.receiveUserId;
const toUserName = isReceive ? item.sendNickname : item.receiveNickname;
return (
{
navigation.navigate('NoticeStack', {
screen: 'Chat',
params: {
toUserId,
toUserName,
},
});
}}
/>
);
}}
data={chatList}
keyExtractor={(item, index) => `chat${index}`}
contentContainerStyle={{ flexGrow: 1, backgroundColor: '#fff' }}
ListEmptyComponent={() => {
return (
{t('zan-wu-shu-ju')}
);
}}
/>
);
}