AAA Refactor app structure to use SafeAreaProvider, update StatusBar configuration, and enhance tab navigator styles. Add expo-system-ui dependency for improved status bar handling.
This commit is contained in:
@@ -3,6 +3,7 @@ import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
|
||||
import { Ionicons } from '@expo/vector-icons';
|
||||
import { COLORS } from '../constants/colors';
|
||||
import { View, ActivityIndicator, Platform } from 'react-native';
|
||||
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
||||
|
||||
import HomeScreen from '../screens/Main/HomeScreen';
|
||||
import MenuNavigator from './MenuNavigator';
|
||||
@@ -11,6 +12,8 @@ import ProfileScreen from '../screens/Main/ProfileScreen';
|
||||
const Tab = createBottomTabNavigator();
|
||||
|
||||
const MainNavigator = () => {
|
||||
const insets = useSafeAreaInsets();
|
||||
|
||||
return (
|
||||
<Tab.Navigator
|
||||
screenOptions={({ route }) => ({
|
||||
@@ -34,9 +37,17 @@ const MainNavigator = () => {
|
||||
backgroundColor: COLORS.white,
|
||||
borderTopWidth: 1,
|
||||
borderTopColor: COLORS.gray[200],
|
||||
paddingBottom: Platform.OS === 'android' ? 16 : 8,
|
||||
paddingBottom: Math.max(insets.bottom, Platform.OS === 'android' ? 16 : 8),
|
||||
paddingTop: 8,
|
||||
height: Platform.OS === 'android' ? 96 : 88,
|
||||
height: 82 + Math.max(insets.bottom, Platform.OS === 'android' ? 16 : 8),
|
||||
elevation: 8,
|
||||
shadowColor: COLORS.gray[900],
|
||||
shadowOffset: {
|
||||
width: 0,
|
||||
height: -2,
|
||||
},
|
||||
shadowOpacity: 0.1,
|
||||
shadowRadius: 4,
|
||||
},
|
||||
tabBarLabelStyle: {
|
||||
fontSize: 12,
|
||||
@@ -44,7 +55,7 @@ const MainNavigator = () => {
|
||||
marginTop: 4,
|
||||
},
|
||||
tabBarItemStyle: {
|
||||
paddingVertical: 4,
|
||||
paddingVertical: 2,
|
||||
},
|
||||
})}
|
||||
>
|
||||
|
||||
@@ -3,7 +3,6 @@ import {
|
||||
View,
|
||||
Text,
|
||||
StyleSheet,
|
||||
SafeAreaView,
|
||||
ScrollView,
|
||||
TouchableOpacity,
|
||||
ActivityIndicator,
|
||||
@@ -12,6 +11,7 @@ import {
|
||||
} from 'react-native';
|
||||
import { StatusBar } from 'expo-status-bar';
|
||||
import { Ionicons } from '@expo/vector-icons';
|
||||
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
||||
import { useAuth } from '../../contexts/AuthContext';
|
||||
import { COLORS } from '../../constants/colors';
|
||||
import MetricCard from '../../components/MetricCard';
|
||||
@@ -103,6 +103,7 @@ const STATIC_TRANSACTIONS = [
|
||||
|
||||
const HomeScreen = () => {
|
||||
const { user, logout } = useAuth();
|
||||
const insets = useSafeAreaInsets();
|
||||
const [metrics, setMetrics] = useState(null);
|
||||
const [loadingMetrics, setLoadingMetrics] = useState(true);
|
||||
const [cardBalance, setCardBalance] = useState(null);
|
||||
@@ -244,7 +245,7 @@ const HomeScreen = () => {
|
||||
};
|
||||
|
||||
return (
|
||||
<SafeAreaView style={styles.container}>
|
||||
<View style={[styles.container, { paddingTop: insets.top }]}>
|
||||
<StatusBar style="dark" />
|
||||
|
||||
<ScrollView
|
||||
@@ -320,7 +321,7 @@ const HomeScreen = () => {
|
||||
</View>
|
||||
)}
|
||||
</ScrollView>
|
||||
</SafeAreaView>
|
||||
</View>
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@ import {
|
||||
View,
|
||||
Text,
|
||||
StyleSheet,
|
||||
SafeAreaView,
|
||||
ScrollView,
|
||||
TouchableOpacity,
|
||||
Alert,
|
||||
@@ -13,6 +12,7 @@ import {
|
||||
} from 'react-native';
|
||||
import { StatusBar } from 'expo-status-bar';
|
||||
import { Ionicons } from '@expo/vector-icons';
|
||||
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
||||
import { useAuth } from '../../contexts/AuthContext';
|
||||
import apiService from '../../services/apiService';
|
||||
import EditProfileModal from '../../components/EditProfileModal';
|
||||
@@ -20,6 +20,7 @@ import { COLORS } from '../../constants/colors';
|
||||
|
||||
const ProfileScreen = () => {
|
||||
const { user, logout, fetchUserProfile } = useAuth();
|
||||
const insets = useSafeAreaInsets();
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
const [isRefreshing, setIsRefreshing] = useState(false);
|
||||
const [profileData, setProfileData] = useState(null);
|
||||
@@ -279,7 +280,7 @@ const ProfileScreen = () => {
|
||||
const currentUser = profileData || user;
|
||||
|
||||
return (
|
||||
<SafeAreaView style={styles.container}>
|
||||
<View style={[styles.container, { paddingTop: insets.top }]}>
|
||||
<StatusBar style="dark" />
|
||||
|
||||
<View style={styles.header}>
|
||||
@@ -388,7 +389,7 @@ const ProfileScreen = () => {
|
||||
initialData={profileData || user}
|
||||
isLoading={isUpdatingProfile}
|
||||
/>
|
||||
</SafeAreaView>
|
||||
</View>
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user