screen bug fix

This commit is contained in:
Samandar Turgunboyev
2025-12-10 11:02:58 +05:00
parent 87bd8cdea6
commit c426b729b9
24 changed files with 663 additions and 403 deletions

41
App.tsx
View File

@@ -7,14 +7,7 @@ import { navigationRef } from 'components/NavigationRef';
import i18n from 'i18n/i18n';
import React, { useEffect, useMemo, useRef, useState } from 'react';
import { I18nextProvider } from 'react-i18next';
import {
Animated,
Dimensions,
LogBox,
StatusBar,
StyleSheet,
View,
} from 'react-native';
import { Animated, Dimensions, LogBox, StatusBar, View } from 'react-native';
import Toast from 'react-native-toast-message';
import SplashScreen from './src/components/SplashScreen';
@@ -68,6 +61,7 @@ export default function App() {
const [isSplashVisible, setIsSplashVisible] = useState(true);
const isMounted = useRef(false);
const currentAnimation = useRef<Animated.CompositeAnimation | null>(null);
const token = getToken();
useEffect(() => {
loadInitialAuthData();
@@ -165,8 +159,19 @@ export default function App() {
[],
);
if (initialRoute === null) {
return <View style={{ flex: 1, backgroundColor: '#000' }} />;
if (!initialRoute || isSplashVisible || !currentAnimation) {
return (
<View
style={{
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#ffff',
}}
>
<SplashScreen onFinish={handleSplashFinish} />
</View>
);
}
return (
@@ -178,10 +183,9 @@ export default function App() {
<Stack.Navigator
screenOptions={{
headerShown: false,
animation: 'none',
animation: 'slide_from_right',
gestureEnabled: false,
}}
// initialRouteName set once (we ensure it's available before first render)
initialRouteName={initialRoute}
>
<Stack.Screen name="Onboarding">
@@ -225,19 +229,6 @@ export default function App() {
</Stack.Navigator>
</NavigationContainer>
{/* Splash transition */}
{isSplashVisible && (
<Animated.View
style={{
...StyleSheet.absoluteFillObject,
transform: [{ translateX: slideAnim }],
zIndex: 10,
}}
>
<SplashScreen onFinish={handleSplashFinish} />
</Animated.View>
)}
<Toast config={toastConfig} />
</View>
</I18nextProvider>