eletrotupi / tcc/ commit / fefd5bc

frontend: load tamagui provider

Pedro Lucas Porcellis porcellis@eletrotupi.com · 6 months ago fefd5bc0998aefd740a98217859545750905cc81 Browse files
Parents 865cfb9
Changed files
2
Additions
+22
Deletions
-20
frontend/app/(tabs)/_layout.tsx
1 1
import { Tabs, Redirect, router } from 'expo-router';
2 2
import React, { useEffect } from 'react';
3 3
import { View, ActivityIndicator } from 'react-native';
4 4

5 5
import { HapticTab } from '@/components/misc/haptic-tab';
31 31
  }
32 32

33 33
  return (
34 34
    <Tabs
35 35
      screenOptions={{
36 -
        tabBarActiveTintColor: Colors[colorScheme ?? 'light'].tint,
36 +
        tabBarActiveTintColor: Colors['light'].tint,
37 37
        headerShown: false,
38 38
        tabBarButton: HapticTab,
39 39
      }}>
40 40

41 41
      <Tabs.Screen
62 62
        }}
63 63
      />
64 64
    </Tabs>
65 65
  );
66 66
}
frontend/app/_layout.tsx modified+21 -19
frontend/app/_layout.tsx
1 -
import { DarkTheme, DefaultTheme, ThemeProvider } from '@react-navigation/native';
1 +
//import '@tamagui/native/setup-teleport';
2 +
import { DarkTheme, DefaultTheme, ThemeProvider } from '@react-navigation/native'
2 3
import { Stack } from 'expo-router';
3 -
import { StatusBar } from 'expo-status-bar';
4 -
import 'react-native-reanimated';
4 +
import { useColorScheme } from 'react-native'
5 +
import { createTamagui, TamaguiProvider, View } from 'tamagui';
6 +
import { tamaguiConfig } from '../tamagui.config'
5 7

6 -
import { useColorScheme } from '@/hooks/use-color-scheme';
7 8
import { AuthProvider } from '@/context/AuthContext';
8 9

9 10
export const unstable_settings = {
10 11
  anchor: '(tabs)',
11 12
};
12 13

13 14
export default function RootLayout() {
14 15
  const colorScheme = useColorScheme();
15 16

16 17
  return (
17 -
    <AuthProvider>
18 -
      <ThemeProvider value={colorScheme === 'dark' ? DarkTheme : DefaultTheme}>
19 -
        <Stack>
20 -
          <Stack.Screen name="(tabs)" options={{ headerShown: false }} />
21 -
          <Stack.Screen
22 -
            name="auth"
23 -
            options={{
24 -
              headerShown: false,
25 -
              presentation: 'modal'
26 -
            }}
27 -
          />
28 -
          <Stack.Screen name="modal" options={{ presentation: 'modal', title: 'Modal' }} />
29 -
        </Stack>
30 -
        <StatusBar style="auto" />
18 +
    <TamaguiProvider config={tamaguiConfig} defaultTheme={colorScheme!} >
19 +
      <ThemeProvider value={DefaultTheme}>
20 +
        <AuthProvider>
21 +
          <Stack>
22 +
            <Stack.Screen name="(tabs)" options={{ headerShown: false }} />
23 +
            <Stack.Screen
24 +
              name="auth"
25 +
              options={{
26 +
                headerShown: false,
27 +
                presentation: 'modal'
28 +
              }}
29 +
            />
30 +
            <Stack.Screen name="modal" options={{ presentation: 'modal', title: 'Modal' }} />
31 +
          </Stack>
32 +
        </AuthProvider>
31 33
      </ThemeProvider>
32 -
    </AuthProvider>
34 +
    </TamaguiProvider>
33 35
  );
34 36
}