@lazerlen/legend-calendar 1.4.0 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,4 @@
1
1
  import type { ReactNode } from "react";
2
- import { memo } from "react";
3
2
  import type { TextStyle, ViewStyle } from "react-native";
4
3
  import { StyleSheet, View } from "react-native";
5
4
 
@@ -34,7 +33,7 @@ export interface CalendarRowMonthProps {
34
33
  theme?: CalendarRowMonthTheme;
35
34
  }
36
35
 
37
- export const CalendarRowMonth = memo(function CalendarRowMonth({
36
+ export const CalendarRowMonth = function CalendarRowMonth({
38
37
  children,
39
38
  height,
40
39
  theme,
@@ -52,4 +51,4 @@ export const CalendarRowMonth = memo(function CalendarRowMonth({
52
51
  <Text style={contentStyles}>{children}</Text>
53
52
  </View>
54
53
  );
55
- });
54
+ };
@@ -1,5 +1,4 @@
1
1
  import type { ReactNode } from "react";
2
- import { memo } from "react";
3
2
  import type { ViewStyle } from "react-native";
4
3
  import { StyleSheet } from "react-native";
5
4
 
@@ -22,7 +21,7 @@ const styles = StyleSheet.create({
22
21
  },
23
22
  });
24
23
 
25
- export const CalendarRowWeek = memo(function CalendarRowWeek({
24
+ export const CalendarRowWeek = function CalendarRowWeek({
26
25
  children,
27
26
  spacing = 0,
28
27
  theme,
@@ -39,4 +38,4 @@ export const CalendarRowWeek = memo(function CalendarRowWeek({
39
38
  {children}
40
39
  </HStack>
41
40
  );
42
- });
41
+ };
@@ -43,6 +43,10 @@ export type {
43
43
  CalendarListRef,
44
44
  CalendarMonthEnhanced,
45
45
  } from "@/components/CalendarList";
46
+ export {
47
+ useCalendarListConfig,
48
+ type CalendarListConfig,
49
+ } from "@/components/CalendarListConfigContext";
46
50
  export type { CalendarRowMonthProps } from "@/components/CalendarRowMonth";
47
51
  export type { CalendarRowWeekProps } from "@/components/CalendarRowWeek";
48
52
  export type { HStackProps } from "@/components/HStack";
@@ -1,6 +1,6 @@
1
- import type { PropsWithChildren, ReactNode } from "react";
2
1
  import { StatusBar } from "expo-status-bar";
3
- import { memo, useMemo } from "react";
2
+ import type { PropsWithChildren, ReactNode } from "react";
3
+ import { useMemo } from "react";
4
4
  import { StyleSheet, View, type ViewStyle } from "react-native";
5
5
 
6
6
  import { useTheme } from "@/hooks/useTheme";
@@ -28,7 +28,7 @@ export const paddingDecorator = (storyFn: () => ReactNode) => (
28
28
  <View style={styles.paddedContainer}>{storyFn()}</View>
29
29
  );
30
30
 
31
- const BackgroundStory = memo(({ children }: PropsWithChildren) => {
31
+ const BackgroundStory = ({ children }: PropsWithChildren) => {
32
32
  const { colors } = useTheme();
33
33
  const containerStyles = useMemo<ViewStyle[]>(
34
34
  () => [
@@ -46,7 +46,7 @@ const BackgroundStory = memo(({ children }: PropsWithChildren) => {
46
46
  {children}
47
47
  </View>
48
48
  );
49
- });
49
+ };
50
50
  BackgroundStory.displayName = "BackgroundStory";
51
51
 
52
52
  export const backgroundDecorator = (storyFn: () => ReactNode) => (
@@ -156,6 +156,9 @@ export const useCalendarList = ({
156
156
  * Append new months to the list.
157
157
  */
158
158
  const appendMonths = (numberOfMonths: number) => {
159
+ if (numberOfMonths <= 0) {
160
+ return monthList;
161
+ }
159
162
  // Last month + 1
160
163
  const startingMonth = addMonths(monthList[monthList.length - 1].date, 1);
161
164
 
@@ -188,6 +191,9 @@ export const useCalendarList = ({
188
191
  };
189
192
 
190
193
  const prependMonths = (numberOfMonths: number) => {
194
+ if (numberOfMonths <= 0) {
195
+ return monthList;
196
+ }
191
197
  const endingMonth = subMonths(monthList[0].date, 1);
192
198
 
193
199
  const startingMonth = getStartingMonth(
package/CHANGELOG.md DELETED
@@ -1,127 +0,0 @@
1
- # @marceloterreiro/flash-calendar
2
-
3
- ## 1.0.0
4
-
5
- ### Major Changes
6
-
7
- - 7eb13ae: Remove CalendarScrollComponent prop from Calendar.List
8
-
9
- The `CalendarScrollComponent` prop has been removed from `Calendar.List`. LegendList is now the only supported list implementation and cannot be replaced.
10
-
11
- **Migration:**
12
-
13
- If you were using `CalendarScrollComponent` to integrate with bottom sheets or other custom scroll containers:
14
-
15
- 1. Wrap `Calendar.List` in your custom scroll container, or
16
- 2. Use the standalone `Calendar` component with your own list implementation
17
-
18
- This change simplifies the API and reduces maintenance burden by focusing on a single, well-supported list implementation.
19
-
20
- ## 1.6.0
21
-
22
- ### Minor Changes
23
-
24
- - 256b67d: Add callback support to `activeDayFiller` for dynamic styling based on day metadata
25
-
26
- ## 1.5.0
27
-
28
- ### Minor Changes
29
-
30
- - 3b65183: Fixes an infinite loop triggered when calendarMaxDateId is today and calendarFutureScrollRangeInMonths is one.
31
-
32
- ## 1.4.0
33
-
34
- ### Minor Changes
35
-
36
- - f291f09: Add support for passing custom pressable components
37
-
38
- ## 1.3.0
39
-
40
- ### Minor Changes
41
-
42
- - b66668c: Added support for react-native-web Pressable InteractionState to support hovered and focused alongside pressed
43
-
44
- ## 1.2.0
45
-
46
- ### Minor Changes
47
-
48
- - f3b9ec8: Add the ability to pass TextProps to the <Text> fields especially when supporting accessibility
49
-
50
- ## 1.1.0
51
-
52
- ### Minor Changes
53
-
54
- - 863edce: Add the ability to mount more than one calendar at once
55
-
56
- ## 1.0.0
57
-
58
- ### Major Changes
59
-
60
- - 9bf22ed: Flash Calendar 1.0.0 🚢 🎉
61
-
62
- This release officially marks the package as production-ready (`1.0.0`).
63
- While it's been stable since the first release, bumping to `1.0.0` was something
64
- I had in mind for a while.
65
-
66
- - New: Add `.scrollToMonth` and `.scrollToDate`, increasing the options available for imperative scrolling.
67
-
68
- ## Breaking changes
69
-
70
- This release introduces one small change in behavior if your app uses
71
- imperative scrolling. Previously, `.scrollToDate` would scroll to the month
72
- containing the date instead of the exact date. Now, `.scrollToDate` scrolls
73
- to the exact date as implied by the name.
74
-
75
- If you intentionally want to scroll to the month instead, a new `.scrollToMonth`
76
- method is available (same signature).
77
-
78
- I don't expect this to cause any issues, but worth mentioned
79
- nonetheless.
80
-
81
- ## 0.0.9
82
-
83
- ### Patch Changes
84
-
85
- - 6d00992: - Add an optional `calendarColorScheme` prop that enables overriding the color scheme used by Flash Calendar.
86
-
87
- ## 0.0.8
88
-
89
- ### Patch Changes
90
-
91
- - 4fe1276: Remove `borderRadius` type from `itemDay.container`, given it gets overwritten by the base component.
92
-
93
- ## 0.0.7
94
-
95
- ### Patch Changes
96
-
97
- - ee6b4e5: Fix incorrect scroll position when using the `calendarMinDateId` prop
98
-
99
- ## 0.0.6
100
-
101
- ### Patch Changes
102
-
103
- - 5363835: Fix `<Calendar.List />` losing track of the active date ranges when the list is scrolled past certain amount
104
-
105
- ## 0.0.5
106
-
107
- ### Patch Changes
108
-
109
- - cbc7728: Update the registry to Github Packages
110
-
111
- ## 0.0.4
112
-
113
- ### Patch Changes
114
-
115
- - 801bc18: Fix locale not being forwarded to `Calendar` component
116
-
117
- ## 0.0.3
118
-
119
- ### Patch Changes
120
-
121
- - e680a96: Add the `calendarFormatLocale` prop
122
-
123
- ## 0.0.2
124
-
125
- ### Patch Changes
126
-
127
- - First release to test the publish scripts