У меня есть React native шаблон есть файл _layout.tsx import { DarkTheme, DefaultTheme,…
- User
У меня есть React native шаблон
есть файл _layout.tsx
import { DarkTheme, DefaultTheme, ThemeProvider } from '@react-navigation/native'; import { useFonts } from 'expo-font'; import { Stack } from 'expo-router'; import * as SplashScreen from 'expo-splash-screen'; import { useEffect } from 'react'; import 'react-native-reanimated';
import { useColorScheme } from '@/hooks/useColorScheme';
// Prevent the splash screen from auto-hiding before asset loading is complete. SplashScreen.preventAutoHideAsync();
export default function RootLayout() { const colorScheme = useColorScheme(); const [loaded] = useFonts({ SpaceMono: require('../assets/fonts/SpaceMono-Regular.ttf'), });
useEffect(() => { if (loaded) { SplashScreen.hideAsync(); } }, [loaded]);
if (!loaded) { return null; }
return ( <ThemeProvider value={colorScheme === 'dark' ? DarkTheme : DefaultTheme}> <Stack.Screen name="(tabs)" options={{ headerShown: false }} /> <Stack.Screen name="+not-found" /> ); }
есть папка (tabs)
в ней файл explore.tsx import Ionicons from '@expo/vector-icons/Ionicons'; import { StyleSheet, Image, Platform } from 'react-native';
import { Collapsible } from '@/components/Collapsible'; import { ExternalLink } from '@/components/ExternalLink'; import ParallaxScrollView from '@/components/ParallaxScrollView'; import { ThemedText } from '@/components/ThemedText'; import { ThemedView } from '@/components/ThemedView';
export default function TabTwoScreen() { return ( <ParallaxScrollView headerBackgroundColor={{ light: '#D0D0D0', dark: '#353636' }} headerImage={}> Explore This app includes example code to help you get started. This app has two screens:{' '} app/(tabs)/index.tsx and{' '} app/(tabs)/explore.tsx The layout file in app/(tabs)/_layout.tsx{' '} sets up the tab navigator. Learn more You can open this project on Android, iOS, and the web. To open the web version, press{' '} w in the terminal running this project. For static images, you can use the @2x and{' '} @3x suffixes to provide files for different screen densities <Image source={require('@/assets/images/react-logo.png')} style={{ alignSelf: 'center' }} /> Learn more Open app/_layout.tsx to see how to load{' '} <ThemedText style={{ fontFamily: 'SpaceMono' }}> custom fonts such as this one. Learn more This template has light and dark mode support. The{' '} useColorScheme() hook lets you inspect what the user's current color scheme is, and so you can adjust UI colors accordingly. Learn more This template includes an example of an animated component. The{' '} components/HelloWave.tsx component uses the powerful react-native-reanimated library to create a waving hand animation. {Platform.select({ ios: ( The components/ParallaxScrollView.tsx{' '} component provides a parallax effect for the header image. ), })} ); }
- Assistant