Commit 5f22cb4b authored by Lorenzo Trujillo Rojas's avatar Lorenzo Trujillo Rojas
Browse files

Merge branch 'main' into 'main'

Se agregó la funcion de historial de viajes

See merge request pueblosmagicosconia!25
parents 15d43330 af31a702
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -24,7 +24,6 @@ export default function Layout() {
          color: LIGTHT_THEME.color.white,
        },
        headerTitleAlign: "center",
        
      }}
    >
      <Tabs.Screen
+2 −3
Original line number Diff line number Diff line
import { View } from "react-native";
import { TravelHistoryPage } from "../../src/screens/travel_history/travel_history_page";

export default function TravelHistoryScreen() {
  return (
    <View >

    </View>
    <TravelHistoryPage/>
  );
}
 No newline at end of file
+35 −9
Original line number Diff line number Diff line
@@ -4,13 +4,16 @@ import { LIGTHT_THEME } from "../src/constants/theme";
import { AuthContextProvider, useAuth } from "../src/contexts/auth_context";
import { ActivityIndicator } from "react-native";
import { GestureHandlerRootView } from "react-native-gesture-handler";
import { AudioContextProvider } from "../src/contexts/audio_context";

export default function Root() {
  return (
    <GestureHandlerRootView style={{ flex: 1 }}>
      <DataContextProvider>
        <AuthContextProvider>
          <AudioContextProvider>
            <MainLayout />
          </AudioContextProvider>
        </AuthContextProvider>
      </DataContextProvider>
    </GestureHandlerRootView>
@@ -26,7 +29,13 @@ const MainLayout = () => {

  return (
    <Stack initialRouteName="(tabs)">
      <Stack.Screen name="(tabs)" options={{ headerShown: false, statusBarColor: LIGTHT_THEME.color.primary }} />
      <Stack.Screen
        name="(tabs)"
        options={{
          headerShown: false,
          statusBarColor: LIGTHT_THEME.color.primary,
        }}
      />
      <Stack.Screen
        name="state"
        options={{
@@ -43,11 +52,9 @@ const MainLayout = () => {
      />
      <Stack.Screen
        name="sign_up"
        options = {
          {
            headerShown: false
          }
        }
        options={{
          headerShown: false,
        }}
      />
      <Stack.Screen
        name="profile"
@@ -56,6 +63,25 @@ const MainLayout = () => {
          headerShown: false,
        }}
      />
      <Stack.Screen
        name="scan"
        options={{
          title: "Scan",
          statusBarColor: LIGTHT_THEME.color.primary,
          headerStyle: {
            backgroundColor: LIGTHT_THEME.color.primary,
          },
          headerTitleStyle: {
            color: LIGTHT_THEME.color.white,
          },
          headerTitleAlign: "center",
          headerTintColor: LIGTHT_THEME.color.white,
        }}
      />
      <Stack.Screen name="travel_history" options={{
        headerShown: false,
        statusBarColor: LIGTHT_THEME.color.primary,
      }}/>
    </Stack>
  );
};
+1 −1
Original line number Diff line number Diff line
import { LoginPage } from "../src/screens/login/login_page";
import { LoginPage } from "../src/auth/pages/login_page";

const LoginScreen = () => {
  return (
+3 −109
Original line number Diff line number Diff line
import { View, Text, Button, StyleSheet, Animated } from "react-native";
import { useQRScanner } from "../src/hooks/useQRScanner";
import { CameraView } from "expo-camera/next";
import { BarCodeScanningResult } from "expo-camera";
import { useEffect, useRef } from "react";
import ScanPage from "../src/screens/scan/scan_page";

export default function ScanScreen() {
  const { hasPermission, getPermission, scanning, onQRScanned, qrData } =
    useQRScanner();

  const qrAnimation = useRef(new Animated.Value(0)).current;

  const startAnimation = () => {
    Animated.loop(
      Animated.sequence([
        Animated.timing(qrAnimation, {
          toValue: 1,
          duration: 1000,
          useNativeDriver: true,
        }),
        Animated.timing(qrAnimation, {
          toValue: 0,
          duration: 1000,
          useNativeDriver: true,
        }),
      ])
    ).start();
  };

  useEffect(() => {
    return () => {
      qrAnimation.stopAnimation();
    };
  }, []);

  if (!hasPermission) {
    return (
      <View>
        <Text>No permission</Text>
        <Button title="Request permission" onPress={getPermission} />
      </View>
    );
  }

  if (!scanning) {
  return (
      <View>
        <Text>{qrData}</Text>
      </View>
    <ScanPage/>
  );
}
 No newline at end of file

  startAnimation();

  return (
    <View style={styles.container}>
      <View style={{borderRadius: 10, overflow: 'hidden'}}>
        <CameraView
          style={styles.camera}
          barcodeScannerSettings={{
            barcodeTypes: ["qr"],
          }}
          onBarcodeScanned={onQRScanned}
          zoom={0.5}
        >
          <View style={styles.square}>
            <Animated.View
              style={{
                width: "100%",
                height: 2,
                borderColor: "white",
                borderWidth: 1,
                borderRadius: 10,
                transform: [
                  {
                    translateY: qrAnimation.interpolate({
                      inputRange: [0, 1],
                      outputRange: [-10, 200],
                    }),
                  },
                ],
              }}
            />
          </View>
        </CameraView>
      </View>
    </View>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: "center",
    alignItems: "center",
  },
  camera: {
    width: 250,
    aspectRatio: 1,
    justifyContent: "center",
    alignItems: "center",
    borderRadius: 10,
  },
  square: {
    width: 200,
    aspectRatio: 1,
    borderWidth: 2,
    borderColor: "white",
    borderRadius: 10,
    overflow: "hidden",
    backgroundColor: "rgba(0,0,0,0.2)",
  },
});
Loading