fixed warning in all tsx file except for CameraView.tsx
This commit is contained in:
@@ -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>
|
||||
|
||||
@@ -109,7 +109,7 @@ const QRScannerScreen: React.FC = () => {
|
||||
return (
|
||||
<View style={styles.container}>
|
||||
<View style={styles.banner}>
|
||||
<Text style={styles.headerText}>SafeQR</Text>
|
||||
<Text style={styles.headerText}>SafeQR v0.16</Text>
|
||||
</View>
|
||||
<Text style={styles.welcomeText}>Welcome to SafeQR code Scanner</Text>
|
||||
<View style={styles.cameraContainer}>
|
||||
|
||||
@@ -3,8 +3,12 @@ import { View, Text, StyleSheet, TouchableOpacity } from 'react-native';
|
||||
import { QRCodeContext } from '../types';
|
||||
|
||||
const SettingsScreen: React.FC = () => {
|
||||
const { setQrCodes } = useContext(QRCodeContext);
|
||||
const qrCodeContext = useContext(QRCodeContext);
|
||||
|
||||
// Safely access setQrCodes and handle the case when the context is null
|
||||
const setQrCodes = qrCodeContext ? qrCodeContext.setQrCodes : () => {};
|
||||
|
||||
|
||||
const clearHistory = () => {
|
||||
setQrCodes([]);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user