Commit a982692a authored by Lorenzo Trujillo Rojas's avatar Lorenzo Trujillo Rojas
Browse files

Merge branch 'main' into 'main'

Router de la aplicación

See merge request pueblosmagicosconia!8
parents 76b6aa6a 55161da1
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
import { StatusBar } from 'expo-status-bar';
import { StyleSheet, Text, View } from 'react-native';
import { StateSelectionPage } from './src/screens/state_selection/state_selection_page';
import { DataContextProvider } from './src/contexts/data_context';

export default function App() {
  return (
    <View style={styles.container}>
      <Text>Open up App.tsx to start working on your app!</Text>
      <StatusBar style="auto" />
    </View>
      <DataContextProvider>
        <StateSelectionPage />
      </DataContextProvider>
  );
}

+16 −2
Original line number Diff line number Diff line
{
  "expo": {
    "name": "mobile",
    "name": "pueblos-magicos",
    "scheme": "myapp",
    "slug": "mobile",
    "version": "1.0.0",
    "orientation": "portrait",
@@ -21,10 +22,23 @@
      "adaptiveIcon": {
        "foregroundImage": "./assets/adaptive-icon.png",
        "backgroundColor": "#ffffff"
      }
      },
      "package": "com.lorenzotrujillo.mobile"
    },
    "web": {
      "favicon": "./assets/favicon.png"
    },
    "plugins": [
      "expo-router",
      "expo-secure-store"
    ],
    "extra": {
      "router": {
        "origin": false
      },
      "eas": {
        "projectId": "e886fd36-a509-4844-bc03-c722bb61a245"
      }
    }
  }
}
+16 −0
Original line number Diff line number Diff line
import { View, Text } from "react-native";
import { TownSelectionPage } from "../../src/screens/town_selection/town_selection_page";
import { useLocalSearchParams } from "expo-router";
import { FullPageLoader } from "../../src/components/full_page_loader/full_page_loader";

export default function Main () {
    const { id } = useLocalSearchParams<{ id: string }>();
    if (!id) {
        return (
            <FullPageLoader/>
        );
    }
    return (
        <TownSelectionPage stateId={+id}/>
    );
}
 No newline at end of file
+61 −0
Original line number Diff line number Diff line
import { Redirect, Tabs } from "expo-router";
import { Ionicons } from "@expo/vector-icons";
import { FontAwesome5 } from "@expo/vector-icons";
import { LIGTHT_THEME } from "../../src/constants/theme";
import { useAuth } from "../../src/contexts/auth_context";

export default function Layout() {
  const { user } = useAuth();
  console.log(user);
  if (!user) {
    return <Redirect href={'/login'}/>;
  }
  
  return (
    <Tabs
      initialRouteName="index"
      screenOptions={{
        tabBarActiveTintColor: LIGTHT_THEME.color.primary,
        tabBarInactiveTintColor: LIGTHT_THEME.color.secondary,
        headerTitleAlign: "center",
      }}
    >
      <Tabs.Screen
        name="index"
        options={{
          title: "Home",
          tabBarIcon: ({ color, focused }) => {
            if (focused) {
              return <Ionicons name="home" size={24} color={color} />;
            }
            return <Ionicons name="home-outline" size={24} color={color} />;
          },
        }}
      />
      <Tabs.Screen
        name="travel_history"
        options={{
          title: "Travel History",
          tabBarIcon: ({ color, focused }) => {
            if (focused) {
              return <FontAwesome5 name="history" size={24} color={color} />;
            }
            return <FontAwesome5 name="history" size={24} color={color} />;
          },
        }}
      />
      <Tabs.Screen
        name="account"
        options={{
          title: "Account",
          tabBarIcon: ({ color, focused }) => {
            if (focused) {
              return <Ionicons name="person" size={24} color={color} />;
            }
            return <Ionicons name="person-outline" size={24} color={color} />;
          },
        }}
        />
    </Tabs>
  );
}
+7 −0
Original line number Diff line number Diff line
import { AccountPage } from "../../src/screens/account/account_page";

export default function AccountScreen() {
    return (
        <AccountPage />
    );
}
 No newline at end of file
Loading