fixed warning in all tsx file except for CameraView.tsx

This commit is contained in:
2024-06-10 21:54:22 +08:00
parent 4dfbbe7cbd
commit 7e0e9ec1bb
4 changed files with 41 additions and 25 deletions

View File

@@ -3,8 +3,10 @@ import { View, Text, StyleSheet, FlatList } from 'react-native';
import { QRCodeContext } from '../types';
const HistoryScreen: React.FC = () => {
const { qrCodes } = useContext(QRCodeContext);
const qrCodeContext = useContext(QRCodeContext);
// Safely access qrCodes and handle the case when the context is null
const qrCodes = qrCodeContext ? qrCodeContext.qrCodes : [];
return (
<View style={styles.container}>
<Text style={styles.welcomeText}>History Screen</Text>