@lazerlen/legend-calendar 1.2.0 → 1.3.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lazerlen/legend-calendar",
3
- "version": "1.2.0",
3
+ "version": "1.3.0",
4
4
  "private": false,
5
5
  "description": "A better calendar for React Native.",
6
6
  "repository": {
@@ -304,6 +304,12 @@ interface CalendarItemDayContainerTheme {
304
304
  /** An absolute positioned filler to join the active days together in a single
305
305
  * complete range. */
306
306
  activeDayFiller?: ViewStyle | ((params: CalendarDayMetadata) => ViewStyle);
307
+ /** An absolutely-positioned background view rendered inside the spacer,
308
+ * behind the day button. Useful for rendering a range band that doesn't
309
+ * extend behind the circular edge days. */
310
+ activeDayRangeBackground?:
311
+ | ViewStyle
312
+ | ((params: CalendarDayMetadata) => ViewStyle | undefined);
307
313
  }
308
314
 
309
315
  export interface CalendarItemDayContainerProps {
@@ -361,8 +367,24 @@ export const CalendarItemDayContainer = memo(function CalendarItemDayContainer({
361
367
  : theme?.activeDayFiller),
362
368
  };
363
369
 
370
+ const rangeBackgroundTheme =
371
+ typeof theme?.activeDayRangeBackground === "function" && metadata
372
+ ? theme.activeDayRangeBackground(metadata)
373
+ : theme?.activeDayRangeBackground;
374
+ const rangeBackground: ViewStyle | null = rangeBackgroundTheme
375
+ ? {
376
+ position: "absolute",
377
+ top: 0,
378
+ bottom: 0,
379
+ left: 0,
380
+ right: 0,
381
+ ...rangeBackgroundTheme,
382
+ }
383
+ : null;
384
+
364
385
  return (
365
386
  <View style={spacerStyles}>
387
+ {rangeBackground ? <View style={rangeBackground} /> : null}
366
388
  {activeDayFiller ? <View style={activeDayFiller} /> : null}
367
389
  {children}
368
390
  </View>