Refactor MenuScreen to use useSafeAreaInsets for dynamic padding, replacing SafeAreaView with View for improved layout handling.

This commit is contained in:
Mekan1206
2025-09-11 12:45:47 +05:00
parent 2eb41db2e5
commit 27f16f3c38

View File

@@ -4,16 +4,17 @@ import {
View, View,
Text, Text,
StyleSheet, StyleSheet,
SafeAreaView,
ScrollView, ScrollView,
TouchableOpacity, TouchableOpacity,
} from 'react-native'; } from 'react-native';
import { StatusBar } from 'expo-status-bar'; import { StatusBar } from 'expo-status-bar';
import { Ionicons } from '@expo/vector-icons'; import { Ionicons } from '@expo/vector-icons';
import { useSafeAreaInsets } from 'react-native-safe-area-context';
import { COLORS } from '../../constants/colors'; import { COLORS } from '../../constants/colors';
const MenuScreen = () => { const MenuScreen = () => {
const navigation = useNavigation(); const navigation = useNavigation();
const insets = useSafeAreaInsets();
const menuSections = [ const menuSections = [
{ {
@@ -66,7 +67,7 @@ const MenuScreen = () => {
}; };
return ( return (
<SafeAreaView style={styles.container}> <View style={[styles.container, { paddingTop: insets.top }]}>
<StatusBar style="dark" /> <StatusBar style="dark" />
<View style={styles.header}> <View style={styles.header}>
@@ -105,7 +106,7 @@ const MenuScreen = () => {
<View style={styles.bottomSpacing} /> <View style={styles.bottomSpacing} />
</ScrollView> </ScrollView>
</SafeAreaView> </View>
); );
}; };