mirror of
https://github.com/urosran/cally.git
synced 2025-11-26 08:24:55 +00:00
Init date fix
This commit is contained in:
@ -1,7 +1,7 @@
|
|||||||
import React, {useRef, useState} from "react";
|
import React, {useRef, useState} from "react";
|
||||||
import {LayoutChangeEvent} from "react-native";
|
import {LayoutChangeEvent} from "react-native";
|
||||||
import {Calendar} from "react-native-big-calendar";
|
import {Calendar} from "react-native-big-calendar";
|
||||||
import {Button, Picker, PickerModes, SegmentedControl, Text, View} from "react-native-ui-lib";
|
import {Picker, PickerModes, SegmentedControl, Text, View} from "react-native-ui-lib";
|
||||||
import {MaterialIcons} from "@expo/vector-icons";
|
import {MaterialIcons} from "@expo/vector-icons";
|
||||||
import {AddEventDialog} from "@/components/pages/calendar/AddEventDialog";
|
import {AddEventDialog} from "@/components/pages/calendar/AddEventDialog";
|
||||||
import {useGetEvents} from "@/hooks/firebase/useGetEvents";
|
import {useGetEvents} from "@/hooks/firebase/useGetEvents";
|
||||||
@ -52,7 +52,7 @@ export default function Screen() {
|
|||||||
setSelectedDate(updatedDate);
|
setSelectedDate(updatedDate);
|
||||||
};
|
};
|
||||||
|
|
||||||
console.log(events)
|
console.log({events})
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={{flex: 1, height: "100%", padding: 10}}>
|
<View style={{flex: 1, height: "100%", padding: 10}}>
|
||||||
@ -124,8 +124,7 @@ export default function Screen() {
|
|||||||
</View>
|
</View>
|
||||||
|
|
||||||
<AddEventDialog/>
|
<AddEventDialog/>
|
||||||
<ManuallyAddEventModal show={!!selectedNewEventDate} close={() => setSelectedNewEndDate(undefined)}/>
|
<ManuallyAddEventModal key={`${selectedNewEventDate}`} initialDate={selectedNewEventDate} show={!!selectedNewEventDate} close={() => setSelectedNewEndDate(undefined)}/>
|
||||||
|
|
||||||
</View>
|
</View>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,10 @@
|
|||||||
import Entry from "@/components/pages/main/Entry";
|
import Entry from "@/components/pages/main/Entry";
|
||||||
|
import {SafeAreaView} from "react-native-safe-area-context";
|
||||||
|
|
||||||
export default function Screen() {
|
export default function Screen() {
|
||||||
return (
|
return (
|
||||||
|
<SafeAreaView>
|
||||||
<Entry/>
|
<Entry/>
|
||||||
|
</SafeAreaView>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@ -20,11 +20,11 @@ SplashScreen.preventAutoHideAsync();
|
|||||||
const queryClient = new QueryClient()
|
const queryClient = new QueryClient()
|
||||||
|
|
||||||
|
|
||||||
if (__DEV__) {
|
// if (__DEV__) {
|
||||||
functions().useEmulator('localhost', 5001);
|
// functions().useEmulator('localhost', 5001);
|
||||||
firestore().useEmulator("localhost", 5471);
|
// firestore().useEmulator("localhost", 5471);
|
||||||
auth().useEmulator("http://localhost:9099");
|
// auth().useEmulator("http://localhost:9099");
|
||||||
}
|
// }
|
||||||
|
|
||||||
export default function RootLayout() {
|
export default function RootLayout() {
|
||||||
const [loaded] = useFonts({
|
const [loaded] = useFonts({
|
||||||
|
|||||||
@ -12,12 +12,13 @@ import {
|
|||||||
} from "react-native-ui-lib";
|
} from "react-native-ui-lib";
|
||||||
import { ScrollView, TouchableOpacity } from "react-native-gesture-handler";
|
import { ScrollView, TouchableOpacity } from "react-native-gesture-handler";
|
||||||
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
||||||
import { useState } from "react";
|
import {useEffect, useState} from "react";
|
||||||
import { MaterialIcons } from "@expo/vector-icons";
|
import { MaterialIcons } from "@expo/vector-icons";
|
||||||
import { PickerMultiValue } from "react-native-ui-lib/src/components/picker/types";
|
import { PickerMultiValue } from "react-native-ui-lib/src/components/picker/types";
|
||||||
import { useAuthContext } from "@/contexts/AuthContext";
|
import { useAuthContext } from "@/contexts/AuthContext";
|
||||||
import { useCreateEvent } from "@/hooks/firebase/useCreateEvent";
|
import { useCreateEvent } from "@/hooks/firebase/useCreateEvent";
|
||||||
import { EventData } from "@/hooks/firebase/types/eventData";
|
import { EventData } from "@/hooks/firebase/types/eventData";
|
||||||
|
import {addHours} from "date-fns";
|
||||||
|
|
||||||
const daysOfWeek = [
|
const daysOfWeek = [
|
||||||
{ label: "Monday", value: "monday" },
|
{ label: "Monday", value: "monday" },
|
||||||
@ -45,10 +46,10 @@ export const ManuallyAddEventModal = ({
|
|||||||
|
|
||||||
const [isAllDay, setIsAllDay] = useState(false);
|
const [isAllDay, setIsAllDay] = useState(false);
|
||||||
const [startTime, setStartTime] = useState(initialDate ?? new Date());
|
const [startTime, setStartTime] = useState(initialDate ?? new Date());
|
||||||
const [endTime, setEndTime] = useState(new Date());
|
const [endTime, setEndTime] = useState(initialDate ? addHours(initialDate, 1) : new Date());
|
||||||
|
|
||||||
const [startDate, setStartDate] = useState(new Date());
|
const [startDate, setStartDate] = useState(initialDate ?? new Date());
|
||||||
const [endDate, setEndDate] = useState(new Date());
|
const [endDate, setEndDate] = useState(initialDate ?? new Date());
|
||||||
|
|
||||||
const [repeatInterval, setRepeatInterval] = useState<PickerMultiValue>([]);
|
const [repeatInterval, setRepeatInterval] = useState<PickerMultiValue>([]);
|
||||||
|
|
||||||
@ -144,6 +145,8 @@ export const ManuallyAddEventModal = ({
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log(startDate, startTime)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Modal
|
<Modal
|
||||||
visible={show}
|
visible={show}
|
||||||
|
|||||||
Reference in New Issue
Block a user