mirror of
https://github.com/urosran/cally.git
synced 2025-11-26 16:34:54 +00:00
Offset starting minutes to now
This commit is contained in:
@ -15,6 +15,8 @@ import {CalendarEvent} from "@/components/pages/calendar/interfaces";
|
|||||||
|
|
||||||
interface EventCalendarProps {
|
interface EventCalendarProps {
|
||||||
calendarHeight: number;
|
calendarHeight: number;
|
||||||
|
// WAS USED FOR SCROLLABLE CALENDARS, PERFORMANCE WAS NOT OPTIMAL
|
||||||
|
calendarWidth: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
const getTotalMinutes = () => {
|
const getTotalMinutes = () => {
|
||||||
@ -95,8 +97,6 @@ export const EventCalendar: React.FC<EventCalendarProps> = React.memo(({calendar
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(offsetMinutes)
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Calendar
|
<Calendar
|
||||||
bodyContainerStyle={styles.calHeader}
|
bodyContainerStyle={styles.calHeader}
|
||||||
|
|||||||
@ -10,11 +10,13 @@ import {EventCalendar} from "@/components/pages/calendar/EventCalendar";
|
|||||||
|
|
||||||
export const InnerCalendar = () => {
|
export const InnerCalendar = () => {
|
||||||
const [calendarHeight, setCalendarHeight] = useState(0);
|
const [calendarHeight, setCalendarHeight] = useState(0);
|
||||||
|
const [calendarWidth, setCalendarWidth] = useState(0);
|
||||||
const calendarContainerRef = useRef(null);
|
const calendarContainerRef = useRef(null);
|
||||||
|
|
||||||
const onLayout = (event: LayoutChangeEvent) => {
|
const onLayout = (event: LayoutChangeEvent) => {
|
||||||
const {height} = event.nativeEvent.layout;
|
const {height, width} = event.nativeEvent.layout;
|
||||||
setCalendarHeight(height);
|
setCalendarHeight(height);
|
||||||
|
setCalendarWidth(width);
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -28,6 +30,7 @@ export const InnerCalendar = () => {
|
|||||||
{calendarHeight > 0 && (
|
{calendarHeight > 0 && (
|
||||||
<EventCalendar
|
<EventCalendar
|
||||||
calendarHeight={calendarHeight}
|
calendarHeight={calendarHeight}
|
||||||
|
calendarWidth={calendarWidth}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</View>
|
</View>
|
||||||
|
|||||||
Reference in New Issue
Block a user