Commit cb2bce55 authored by Omar Luna Hernández's avatar Omar Luna Hernández
Browse files
parents f15f250e a982692a
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -2,3 +2,5 @@
/backend/.env
/web/node_modules
/mobile/node_modules
/mobile/.expo
/mobile/metro
 No newline at end of file
+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>
  );
}
Loading