import { StackScreenProps } from '@react-navigation/stack';
import * as React from 'react';
import { useFocusEffect } from '@react-navigation/native';
import { Div, Button, Image, Text, Avatar } from 'react-native-magnus';
import { ScrollView, FlatList } from 'react-native-gesture-handler';
import { useNavigation } from '@react-navigation/native';
import { createMaterialTopTabNavigator } from '@react-navigation/material-top-tabs';
import Constants from 'expo-constants';
import {useModel} from 'flooks';
import { useMount } from 'ahooks';
import IM from './model';
import User from '../stores/User';
import NoticeCom from './NoticeCom';
import { SoundPlay } from '../utils/SoundUtils';
const NoticeTab = createMaterialTopTabNavigator();
export default function NoticeScreen({
navigation,
}: StackScreenProps) {
const webRef = React.useRef();
const { initChat } = useModel("IMModel");
useFocusEffect(
React.useCallback(() => {
initChat();
}, [])
);
return (
);
}
function SysNoticeScreen({ navigation }) {
const { sysNoticeList, sendPushNotification } = 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 (
暂无数据
);
}}
contentContainerStyle={{ flexGrow: 1, backgroundColor: '#fff' }}
/>
>
);
}
function UserChatScreen({ navigation }) {
const { chatList } = useModel(IM, ['chatList']);
const { id } = useModel(User, ['id']);
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 (
暂无数据
);
}}
/>
);
}