+
+
+
+```tsx
+import { Calendar, useDateRange } from "@marceloterreiro/flash-calendar";
+
+export const TwoCalendarsMounted = () => {
+ const dateRangeOne = useDateRange();
+ const dateRangeTwo = useDateRange();
+ return (
+
+
+ First calendar
+
+
+
+ Second calendar
+
+
+
+ );
+};
+```
+
+
+
+
+
+
diff --git a/apps/example/src/components/PerfTestCalendar/PerfTestCalendar.tsx b/apps/example/src/components/PerfTestCalendar/PerfTestCalendar.tsx
index 18589a9..ea3fc9d 100644
--- a/apps/example/src/components/PerfTestCalendar/PerfTestCalendar.tsx
+++ b/apps/example/src/components/PerfTestCalendar/PerfTestCalendar.tsx
@@ -96,10 +96,9 @@ BasePerfTestCalendar.displayName = "BasePerfTestCalendar";
export const PerfTestCalendar = memo(
({ calendarActiveDateRanges, calendarMonthId, ...props }: CalendarProps) => {
useEffect(() => {
- activeDateRangesEmitter.emit(
- "onSetActiveDateRanges",
- calendarActiveDateRanges ?? []
- );
+ activeDateRangesEmitter.emit("onSetActiveDateRanges", {
+ ranges: calendarActiveDateRanges ?? [],
+ });
/**
* While `calendarMonthId` is not used by the effect, we still need it in
* the dependency array since [FlashList uses recycling
diff --git a/packages/flash-calendar/src/components/Calendar.stories.tsx b/packages/flash-calendar/src/components/Calendar.stories.tsx
index 5328c55..7331223 100644
--- a/packages/flash-calendar/src/components/Calendar.stories.tsx
+++ b/packages/flash-calendar/src/components/Calendar.stories.tsx
@@ -1,12 +1,14 @@
import type { Meta, StoryObj } from "@storybook/react";
import { addDays, subDays } from "date-fns";
import { format } from "date-fns/fp/format";
-import { useState } from "react";
+import { useRef, useState } from "react";
+import { Text } from "react-native";
import { paddingDecorator } from "@/developer/decorators";
import { loggingHandler } from "@/developer/loggginHandler";
import { endOfMonth, startOfMonth, toDateId } from "@/helpers/dates";
import { useDateRange } from "@/hooks/useDateRange";
+import { VStack } from "@/components/VStack";
import { Calendar } from "./Calendar";
@@ -128,7 +130,7 @@ export const WithCustomFormatting = (args: typeof KichenSink.args) => {
};
export const DatePicker = (args: typeof KichenSink.args) => {
- const [activeDateId, setActiveDateId] = useState