📦 new(NotifElementLocal.tsx): add component to handle local notifications 📦 new(NotifElementRemote.tsx): add component to handle remote notifications 📦 new(NotifList.tsx): add component to list notifications 📦 new(NotifView.tsx): add main view for notifications 📦 new(NotifViewLocal.tsx): add view for local notifications 📦 new(NotifViewRemote.tsx): add view for remote notifications 🔧 refactor: use react-native-toast-notifications for user feedback 🔧 refactor: use redux for state management 🔧 refactor: use axios for HTTP requests 🔧 refactor: use react-native-paper for UI components 🔧 refactor: use expo-clipboard for clipboard interactions 🎯 goal: improve user experience by providing local and remote notifications
24 lines
817 B
TypeScript
24 lines
817 B
TypeScript
import React from 'react';
|
|
import {FlatList, ScrollView} from 'react-native';
|
|
import { nanoid } from '@reduxjs/toolkit';
|
|
import NotifElementLocal from './NotifElementLocal';
|
|
import NotifElementRemote from './NotifElementRemote';
|
|
|
|
export default function NotifList({type,notifs}:{type:string,notifs:Array<object>}) {
|
|
if (type === 'local') {
|
|
return <FlatList
|
|
data={notifs}
|
|
renderItem={({item}) => <NotifElementLocal title={item.title} content={item.content} />}
|
|
keyExtractor={item => nanoid()}
|
|
/>
|
|
} else {
|
|
return <FlatList
|
|
data={notifs}
|
|
renderItem={({item}) => <NotifElementRemote title={item.title} content={item.content} deviceName={item.device_name} timestamp={item.timestamp}/>}
|
|
keyExtractor={item => nanoid()}
|
|
/>
|
|
;
|
|
}
|
|
}
|
|
|