Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
builder-247 committed Jul 18, 2024
1 parent c3493c2 commit 5557400
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions elements/timetable/Timetable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ const Timetable = () => {
const [eventDayIndex, setEventDayIndex] = useState(0);

const callback = useCallback((position: number) => {
console.log('Hey', `You are on ${position + 1} page`);
setEventDayIndex(position);
}, []);
const { ref, nextPage, previousPage, ...navigationPanel } = useNavigationPanel(callback);
const { ref, nextPage, previousPage, onPageSelected } = useNavigationPanel(callback);

useEffect(() => {
getEvents().then((eventRes) => {
Expand All @@ -44,7 +44,7 @@ const Timetable = () => {
const index = eventsGroupedByDay.findIndex(
(events) => events[events.length - 1].end.getTime() > new Date().getTime()
); // If last event of the day has ended, it's not the current day
// setEventDayIndex(index === -1 ? eventsGroupedByDay.length - 1 : index);
setEventDayIndex(index === -1 ? eventsGroupedByDay.length - 1 : index);
});
}, []);

Expand All @@ -71,7 +71,7 @@ const Timetable = () => {
ref={ref}
useNext={false}
initialPage={eventDayIndex}
{...navigationPanel}
onPageSelected={onPageSelected}
layoutDirection='ltr'
orientation='horizontal'
style={{ flex: 1 }}
Expand Down
2 changes: 1 addition & 1 deletion hooks/useNavigationPanel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export function useNavigationPanel(onPageSelectedCallback: (position: number) =>
setActivePage(position);
onPageSelectedCallback(position);
},
useNativeDriver: true,
useNativeDriver: false,
}
),
[]
Expand Down

0 comments on commit 5557400

Please sign in to comment.