mirror of
https://github.com/urosran/cally.git
synced 2025-07-16 18:16:17 +00:00
Init date fix
This commit is contained in:
@ -1,11 +1,11 @@
|
||||
import React, {useRef, useState} from "react";
|
||||
import {LayoutChangeEvent} from "react-native";
|
||||
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 {AddEventDialog} from "@/components/pages/calendar/AddEventDialog";
|
||||
import {useGetEvents} from "@/hooks/firebase/useGetEvents";
|
||||
import { useAuthContext } from "@/contexts/AuthContext";
|
||||
import {useAuthContext} from "@/contexts/AuthContext";
|
||||
import {ManuallyAddEventModal} from "@/components/pages/calendar/ManuallyAddEventModal";
|
||||
|
||||
const modeMap = new Map([
|
||||
@ -20,7 +20,7 @@ const months = [
|
||||
];
|
||||
|
||||
export default function Screen() {
|
||||
const { profileData } = useAuthContext();
|
||||
const {profileData} = useAuthContext();
|
||||
const [calendarHeight, setCalendarHeight] = useState(0);
|
||||
const [mode, setMode] = useState<"week" | "month" | "day">("week");
|
||||
const [selectedDate, setSelectedDate] = useState<Date>(new Date());
|
||||
@ -28,7 +28,7 @@ export default function Screen() {
|
||||
|
||||
|
||||
const calendarContainerRef = useRef(null);
|
||||
const { data: events} = useGetEvents()
|
||||
const {data: events} = useGetEvents()
|
||||
|
||||
const onLayout = (event: LayoutChangeEvent) => {
|
||||
const {height} = event.nativeEvent.layout;
|
||||
@ -52,7 +52,7 @@ export default function Screen() {
|
||||
setSelectedDate(updatedDate);
|
||||
};
|
||||
|
||||
console.log(events)
|
||||
console.log({events})
|
||||
|
||||
return (
|
||||
<View style={{flex: 1, height: "100%", padding: 10}}>
|
||||
@ -78,7 +78,7 @@ export default function Screen() {
|
||||
backgroundColor: "#f9f9f9",
|
||||
marginBottom: 10,
|
||||
shadowColor: "#000",
|
||||
shadowOffset: { width: 0, height: 2 },
|
||||
shadowOffset: {width: 0, height: 2},
|
||||
shadowOpacity: 0.1,
|
||||
shadowRadius: 5,
|
||||
elevation: 3,
|
||||
@ -96,15 +96,15 @@ export default function Screen() {
|
||||
</Picker>
|
||||
|
||||
<View>
|
||||
<SegmentedControl
|
||||
segments={[
|
||||
{label: "D"},
|
||||
{label: "W"},
|
||||
{label: "M"}
|
||||
]}
|
||||
onChangeIndex={handleSegmentChange}
|
||||
initialIndex={[...modeMap.entries()].find(([_, value]) => value === mode)?.[0] || 1}
|
||||
/>
|
||||
<SegmentedControl
|
||||
segments={[
|
||||
{label: "D"},
|
||||
{label: "W"},
|
||||
{label: "M"}
|
||||
]}
|
||||
onChangeIndex={handleSegmentChange}
|
||||
initialIndex={[...modeMap.entries()].find(([_, value]) => value === mode)?.[0] || 1}
|
||||
/>
|
||||
</View>
|
||||
</View>
|
||||
|
||||
@ -123,9 +123,8 @@ export default function Screen() {
|
||||
)}
|
||||
</View>
|
||||
|
||||
<AddEventDialog />
|
||||
<ManuallyAddEventModal show={!!selectedNewEventDate} close={() => setSelectedNewEndDate(undefined)}/>
|
||||
|
||||
<AddEventDialog/>
|
||||
<ManuallyAddEventModal key={`${selectedNewEventDate}`} initialDate={selectedNewEventDate} show={!!selectedNewEventDate} close={() => setSelectedNewEndDate(undefined)}/>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
@ -1,7 +1,10 @@
|
||||
import Entry from "@/components/pages/main/Entry";
|
||||
import {SafeAreaView} from "react-native-safe-area-context";
|
||||
|
||||
export default function Screen() {
|
||||
return (
|
||||
<Entry/>
|
||||
<SafeAreaView>
|
||||
<Entry/>
|
||||
</SafeAreaView>
|
||||
)
|
||||
}
|
@ -20,11 +20,11 @@ SplashScreen.preventAutoHideAsync();
|
||||
const queryClient = new QueryClient()
|
||||
|
||||
|
||||
if (__DEV__) {
|
||||
functions().useEmulator('localhost', 5001);
|
||||
firestore().useEmulator("localhost", 5471);
|
||||
auth().useEmulator("http://localhost:9099");
|
||||
}
|
||||
// if (__DEV__) {
|
||||
// functions().useEmulator('localhost', 5001);
|
||||
// firestore().useEmulator("localhost", 5471);
|
||||
// auth().useEmulator("http://localhost:9099");
|
||||
// }
|
||||
|
||||
export default function RootLayout() {
|
||||
const [loaded] = useFonts({
|
||||
|
@ -12,12 +12,13 @@ import {
|
||||
} from "react-native-ui-lib";
|
||||
import { ScrollView, TouchableOpacity } from "react-native-gesture-handler";
|
||||
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
||||
import { useState } from "react";
|
||||
import {useEffect, useState} from "react";
|
||||
import { MaterialIcons } from "@expo/vector-icons";
|
||||
import { PickerMultiValue } from "react-native-ui-lib/src/components/picker/types";
|
||||
import { useAuthContext } from "@/contexts/AuthContext";
|
||||
import { useCreateEvent } from "@/hooks/firebase/useCreateEvent";
|
||||
import { EventData } from "@/hooks/firebase/types/eventData";
|
||||
import {addHours} from "date-fns";
|
||||
|
||||
const daysOfWeek = [
|
||||
{ label: "Monday", value: "monday" },
|
||||
@ -45,10 +46,10 @@ export const ManuallyAddEventModal = ({
|
||||
|
||||
const [isAllDay, setIsAllDay] = useState(false);
|
||||
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 [endDate, setEndDate] = useState(new Date());
|
||||
const [startDate, setStartDate] = useState(initialDate ?? new Date());
|
||||
const [endDate, setEndDate] = useState(initialDate ?? new Date());
|
||||
|
||||
const [repeatInterval, setRepeatInterval] = useState<PickerMultiValue>([]);
|
||||
|
||||
@ -144,6 +145,8 @@ export const ManuallyAddEventModal = ({
|
||||
);
|
||||
}
|
||||
|
||||
console.log(startDate, startTime)
|
||||
|
||||
return (
|
||||
<Modal
|
||||
visible={show}
|
||||
|
Reference in New Issue
Block a user