From 7fe7fffa7a1a31e9a77f880c13bb82571b2b02ae Mon Sep 17 00:00:00 2001 From: Inbal Tish Date: Mon, 9 Aug 2021 09:39:46 +0300 Subject: [PATCH 01/10] fix types; move types file out of directory; fix refs --- example/src/screens/timelineCalendar.js | 4 +-- src/agenda/index.tsx | 38 +++++++++------------ src/agenda/platform-style.ios.ts | 2 +- src/agenda/platform-style.ts | 2 +- src/agenda/reservation-list/index.tsx | 7 ++-- src/agenda/reservation-list/reservation.tsx | 2 +- src/agenda/reservation-list/style.ts | 2 +- src/agenda/style.ts | 2 +- src/calendar-list/index.tsx | 8 ++--- src/calendar-list/item.tsx | 2 +- src/calendar-list/style.ts | 2 +- src/calendar/day/basic/index.tsx | 2 +- src/calendar/day/basic/style.ts | 2 +- src/calendar/day/dot/index.tsx | 2 +- src/calendar/day/dot/style.ts | 2 +- src/calendar/day/marking/index.tsx | 2 +- src/calendar/day/marking/style.ts | 2 +- src/calendar/day/period/index.tsx | 2 +- src/calendar/day/period/style.ts | 2 +- src/calendar/header/index.tsx | 2 +- src/calendar/header/style.ts | 2 +- src/calendar/index.tsx | 4 +-- src/calendar/style.ts | 2 +- src/{commons => }/types.ts | 27 +++++++++------ 24 files changed, 63 insertions(+), 61 deletions(-) rename src/{commons => }/types.ts (72%) diff --git a/example/src/screens/timelineCalendar.js b/example/src/screens/timelineCalendar.js index 3217edca66..830f006967 100644 --- a/example/src/screens/timelineCalendar.js +++ b/example/src/screens/timelineCalendar.js @@ -85,13 +85,13 @@ export default class TimelineCalendarScreen extends Component { }; onDateChanged = date => { - // console.warn('ExpandableCalendarScreen onDateChanged: ', date, updateSource); + // console.warn('TimelineCalendarScreen onDateChanged: ', date, updateSource); // fetch and set data for date + week ahead this.setState({currentDate: date}); }; onMonthChange = (/* month, updateSource */) => { - // console.warn('ExpandableCalendarScreen onMonthChange: ', month, updateSource); + // console.warn('TimelineCalendarScreen onMonthChange: ', month, updateSource); }; renderEmptyItem() { diff --git a/src/agenda/index.tsx b/src/agenda/index.tsx index 4e19d9f9d8..db441868c6 100644 --- a/src/agenda/index.tsx +++ b/src/agenda/index.tsx @@ -113,10 +113,10 @@ export default class Agenda extends Component { private currentMonth: XDate; private knobTracker: any; private _isMounted: boolean | undefined; - private scrollPad: any; - private calendar: any; - private knob: any; - public list: any; + private scrollPad: React.RefObject = React.createRef(); + private calendar: React.RefObject = React.createRef(); + private knob: React.RefObject = React.createRef(); + public list: React.RefObject = React.createRef(); constructor(props: AgendaProps) { super(props); @@ -180,11 +180,11 @@ export default class Agenda extends Component { }; setScrollPadPosition = (y: number, animated: boolean) => { - if (this.scrollPad?.scrollTo) { - this.scrollPad.scrollTo({x: 0, y, animated}); + if (this.scrollPad?.current?.scrollTo) { + this.scrollPad.current.scrollTo({x: 0, y, animated}); } else { // Support for RN O.61 (Expo 37) - this.scrollPad.getNode().scrollTo({x: 0, y, animated}); + this.scrollPad?.current?.getNode().scrollTo({x: 0, y, animated}); } }; @@ -209,7 +209,7 @@ export default class Agenda extends Component { // in CalendarList listView, but that might impact performance when scrolling // month list in expanded CalendarList. // Further info https://github.com/facebook/react-native/issues/1831 - this.calendar.scrollToDay(this.state.selectedDay, this.calendarOffset() + 1, true); + this.calendar?.current?.scrollToDay(this.state.selectedDay, this.calendarOffset() + 1, true); } loadReservations(props: AgendaProps) { @@ -246,7 +246,7 @@ export default class Agenda extends Component { } this.setScrollPadPosition(this.initialScrollPadPosition(), true); - this.calendar.scrollToDay(day, this.calendarOffset(), true); + this.calendar?.current?.scrollToDay(day, this.calendarOffset(), true); _.invoke(this.props, 'loadItemsForMonth', xdateToData(day)); _.invoke(this.props, 'onDayPress', xdateToData(day)); @@ -276,7 +276,7 @@ export default class Agenda extends Component { }; onCalendarListLayout = () => { - this.calendar.scrollToDay(this.state.selectedDay.clone(), this.calendarOffset(), false); + this.calendar?.current?.scrollToDay(this.state.selectedDay.clone(), this.calendarOffset(), false); }; onLayout = (event: LayoutChangeEvent) => { @@ -287,15 +287,11 @@ export default class Agenda extends Component { onTouchStart = () => { this.headerState = 'touched'; - if (this.knob) { - this.knob.setNativeProps({style: {opacity: 0.5}}); - } + this.knob?.current?.setNativeProps({style: {opacity: 0.5}}); }; onTouchEnd = () => { - if (this.knob) { - this.knob.setNativeProps({style: {opacity: 1}}); - } + this.knob?.current?.setNativeProps({style: {opacity: 1}}); if (this.headerState === 'touched') { const isOpen = this.state.calendarScrollable; @@ -341,7 +337,7 @@ export default class Agenda extends Component { const newDate = parseDate(day); const withAnimation = dateutils.sameMonth(newDate, this.state.selectedDay); - this.calendar.scrollToDay(day, this.calendarOffset(), withAnimation); + this.calendar?.current?.scrollToDay(day, this.calendarOffset(), withAnimation); this.setState({ selectedDay: newDate }); @@ -355,7 +351,7 @@ export default class Agenda extends Component { return ( (this.list = c)} + ref={this.list} reservations={this.props.items} selectedDay={this.state.selectedDay} topDay={this.state.topDay} @@ -373,7 +369,7 @@ export default class Agenda extends Component { return ( (this.calendar = c)} + ref={this.calendar} current={this.currentMonth} markedDates={this.generateMarkings(this.state.selectedDay, markedDates, items)} calendarWidth={this.viewWidth} @@ -394,7 +390,7 @@ export default class Agenda extends Component { const knobView = renderKnob ? renderKnob() : ; knob = !this.state.calendarScrollable || showClosingKnob ? ( - (this.knob = c)}>{knobView} + {knobView} ) : null; } @@ -484,7 +480,7 @@ export default class Agenda extends Component { {this.renderWeekDaysNames(weekDaysNames)} (this.scrollPad = ref)} + ref={this.scrollPad} style={[this.style.scrollPadStyle, scrollPadStyle]} overScrollMode="never" showsHorizontalScrollIndicator={false} diff --git a/src/agenda/platform-style.ios.ts b/src/agenda/platform-style.ios.ts index a6ea5a50a0..cca46a7e01 100644 --- a/src/agenda/platform-style.ios.ts +++ b/src/agenda/platform-style.ios.ts @@ -1,4 +1,4 @@ -import {Theme} from '../commons/types'; +import {Theme} from '../types'; export default function platformStyles(appStyle: Theme) { return { diff --git a/src/agenda/platform-style.ts b/src/agenda/platform-style.ts index d57581de3e..92fe497a4a 100644 --- a/src/agenda/platform-style.ts +++ b/src/agenda/platform-style.ts @@ -1,5 +1,5 @@ import {ViewStyle} from 'react-native'; -import {Theme} from '../commons/types'; +import {Theme} from '../types'; export default function platformStyles(appStyle: Theme) { return { diff --git a/src/agenda/reservation-list/index.tsx b/src/agenda/reservation-list/index.tsx index af58b5d237..b940c3d0a0 100644 --- a/src/agenda/reservation-list/index.tsx +++ b/src/agenda/reservation-list/index.tsx @@ -103,7 +103,8 @@ class ReservationList extends Component | null; + private list: React.RefObject = React.createRef(); + constructor(props: ReservationListProps) { super(props); @@ -153,7 +154,7 @@ class ReservationList extends Component (this.list = c)} + ref={this.list} style={style} contentContainerStyle={this.style.content} data={this.state.reservations} diff --git a/src/agenda/reservation-list/reservation.tsx b/src/agenda/reservation-list/reservation.tsx index 07d6ac6e35..44aab03817 100644 --- a/src/agenda/reservation-list/reservation.tsx +++ b/src/agenda/reservation-list/reservation.tsx @@ -12,7 +12,7 @@ import dateutils from '../../dateutils'; // @ts-expect-error import {RESERVATION_DATE} from '../../testIDs'; import styleConstructor from './style'; -import {Theme} from '../../commons/types'; +import {Theme} from '../../types'; import {DayReservations} from './index'; diff --git a/src/agenda/reservation-list/style.ts b/src/agenda/reservation-list/style.ts index 5c4d859dc9..0e0dfd916d 100644 --- a/src/agenda/reservation-list/style.ts +++ b/src/agenda/reservation-list/style.ts @@ -1,6 +1,6 @@ import {StyleSheet} from 'react-native'; import * as defaultStyle from '../../style'; -import {Theme} from '../../commons/types'; +import {Theme} from '../../types'; export default function styleConstructor(theme: Theme = {}) { diff --git a/src/agenda/style.ts b/src/agenda/style.ts index 8df4e90680..6ac9b1c631 100644 --- a/src/agenda/style.ts +++ b/src/agenda/style.ts @@ -1,7 +1,7 @@ import {StyleSheet} from 'react-native'; import * as defaultStyle from '../style'; import platformStyles from './platform-style'; -import {Theme} from '../commons/types'; +import {Theme} from '../types'; export default function styleConstructor(theme: Theme = {}) { diff --git a/src/calendar-list/index.tsx b/src/calendar-list/index.tsx index 9ef19e0331..e431b81f70 100644 --- a/src/calendar-list/index.tsx +++ b/src/calendar-list/index.tsx @@ -131,7 +131,7 @@ class CalendarList extends Component { }; style: any; - listView: FlatList | undefined | null; + list: React.RefObject = React.createRef(); viewabilityConfig = { itemVisiblePercentThreshold: 20 }; @@ -216,7 +216,7 @@ class CalendarList extends Component { } } } - this.listView?.scrollToOffset({offset: scrollAmount, animated}); + this.list?.current?.scrollToOffset({offset: scrollAmount, animated}); } scrollToMonth = (m: XDate) => { @@ -227,7 +227,7 @@ class CalendarList extends Component { const size = horizontal ? calendarWidth : calendarHeight; const scrollAmount = size * pastScrollRange + diffMonths * size; - this.listView?.scrollToOffset({offset: scrollAmount, animated: animateScroll}); + this.list?.current?.scrollToOffset({offset: scrollAmount, animated: animateScroll}); }; getItemLayout = (_: Array | undefined | null, index: number) => { @@ -349,7 +349,7 @@ class CalendarList extends Component { return ( (this.listView = c)} + ref={this.list} style={[this.style.container, style]} // @ts-ignore initialListSize={pastScrollRange + futureScrollRange + 1} // ListView deprecated diff --git a/src/calendar-list/item.tsx b/src/calendar-list/item.tsx index 3c18c8a824..9b6a2ea1c1 100644 --- a/src/calendar-list/item.tsx +++ b/src/calendar-list/item.tsx @@ -4,7 +4,7 @@ import memoize from 'memoize-one'; import React, {Component} from 'react'; import {Text, View} from 'react-native'; -import {Theme} from '../commons/types'; +import {Theme} from '../types'; // @ts-expect-error import {extractComponentProps} from '../component-updater'; import Calendar, {CalendarProps} from '../calendar'; diff --git a/src/calendar-list/style.ts b/src/calendar-list/style.ts index fc2754f7bf..b229646b5c 100644 --- a/src/calendar-list/style.ts +++ b/src/calendar-list/style.ts @@ -1,6 +1,6 @@ import {Platform, StyleSheet} from 'react-native'; import * as defaultStyle from '../style'; -import {Theme} from '../commons/types'; +import {Theme} from '../types'; export default function getStyle(theme: Theme = {}) { const appStyle = {...defaultStyle, ...theme}; diff --git a/src/calendar/day/basic/index.tsx b/src/calendar/day/basic/index.tsx index dda322fe5a..2c3f3716f1 100644 --- a/src/calendar/day/basic/index.tsx +++ b/src/calendar/day/basic/index.tsx @@ -7,7 +7,7 @@ import {TouchableOpacity, Text, View} from 'react-native'; import {shouldUpdate} from '../../../component-updater'; import styleConstructor from './style'; import Marking, {MarkingTypes, MarkingProps} from '../marking'; -import {Theme} from '../../../commons/types'; +import {Theme} from '../../../types'; export interface BasicDayProps { state?: 'selected' | 'disabled' | 'today'; diff --git a/src/calendar/day/basic/style.ts b/src/calendar/day/basic/style.ts index 1f0a1d5c93..380f1721b4 100644 --- a/src/calendar/day/basic/style.ts +++ b/src/calendar/day/basic/style.ts @@ -1,6 +1,6 @@ import {StyleSheet, Platform} from 'react-native'; import * as defaultStyle from '../../../style'; -import {Theme} from '../../../commons/types'; +import {Theme} from '../../../types'; export default function styleConstructor(theme: Theme = {}) { const appStyle = {...defaultStyle, ...theme}; diff --git a/src/calendar/day/dot/index.tsx b/src/calendar/day/dot/index.tsx index e89bad91cd..927de00d1e 100644 --- a/src/calendar/day/dot/index.tsx +++ b/src/calendar/day/dot/index.tsx @@ -2,7 +2,7 @@ import PropTypes from 'prop-types'; import React from 'react'; import {View} from 'react-native'; import styleConstructor from './style'; -import {Theme} from '../../../commons/types'; +import {Theme} from '../../../types'; export interface DotProps { theme?: Theme; diff --git a/src/calendar/day/dot/style.ts b/src/calendar/day/dot/style.ts index 63f93f8fe4..4326d40664 100644 --- a/src/calendar/day/dot/style.ts +++ b/src/calendar/day/dot/style.ts @@ -1,6 +1,6 @@ import {StyleSheet} from 'react-native'; import * as defaultStyle from '../../../style'; -import {Theme} from '../../../commons/types'; +import {Theme} from '../../../types'; export default function styleConstructor(theme: Theme = {}) { const appStyle = {...defaultStyle, ...theme}; diff --git a/src/calendar/day/marking/index.tsx b/src/calendar/day/marking/index.tsx index afb55eebfb..c4b869854f 100644 --- a/src/calendar/day/marking/index.tsx +++ b/src/calendar/day/marking/index.tsx @@ -7,7 +7,7 @@ import {View, ViewStyle, TextStyle} from 'react-native'; import {shouldUpdate, extractComponentProps} from '../../../component-updater'; import styleConstructor from './style'; import Dot, {DotProps} from '../dot'; -import {Theme} from '../../../commons/types'; +import {Theme} from '../../../types'; export enum MarkingTypes { DOT = 'dot', diff --git a/src/calendar/day/marking/style.ts b/src/calendar/day/marking/style.ts index b268290337..b0b15bd14d 100644 --- a/src/calendar/day/marking/style.ts +++ b/src/calendar/day/marking/style.ts @@ -1,6 +1,6 @@ import {StyleSheet} from 'react-native'; import * as defaultStyle from '../../style'; -import {Theme} from '../../../commons/types'; +import {Theme} from '../../../types'; export default function styleConstructor(theme: Theme = {}) { const appStyle = {...defaultStyle, ...theme}; diff --git a/src/calendar/day/period/index.tsx b/src/calendar/day/period/index.tsx index 3584d1190b..becc0ff052 100644 --- a/src/calendar/day/period/index.tsx +++ b/src/calendar/day/period/index.tsx @@ -10,7 +10,7 @@ import * as defaultStyle from '../../../style'; import styleConstructor from './style'; import Dot from '../dot'; import {MarkingProps} from '../marking'; -import {Theme} from '../../../commons/types'; +import {Theme} from '../../../types'; interface PeriodDayProps { state?: 'selected' | 'disabled' | 'today' | ''; diff --git a/src/calendar/day/period/style.ts b/src/calendar/day/period/style.ts index 1d0ee09e4f..5f06b9a2cc 100644 --- a/src/calendar/day/period/style.ts +++ b/src/calendar/day/period/style.ts @@ -1,6 +1,6 @@ import {StyleSheet} from 'react-native'; import * as defaultStyle from '../../../style'; -import {Theme} from '../../../commons/types'; +import {Theme} from '../../../types'; const FILLER_HEIGHT = 34; diff --git a/src/calendar/header/index.tsx b/src/calendar/header/index.tsx index 934ee8a14d..9f5e73a5db 100644 --- a/src/calendar/header/index.tsx +++ b/src/calendar/header/index.tsx @@ -18,7 +18,7 @@ import { // @ts-expect-error } from '../../testIDs'; import styleConstructor from './style'; -import {Theme} from '../../commons/types'; +import {Theme} from '../../types'; type Direction = 'left' | 'right'; export interface CalendarHeaderProps { diff --git a/src/calendar/header/style.ts b/src/calendar/header/style.ts index 86e7a64993..495dd8cdfa 100644 --- a/src/calendar/header/style.ts +++ b/src/calendar/header/style.ts @@ -1,6 +1,6 @@ import {StyleSheet, Platform} from 'react-native'; import * as defaultStyle from '../../style'; -import {Theme} from '../../commons/types'; +import {Theme} from '../../types'; export default function (theme: Theme = {}) { const appStyle = {...defaultStyle, ...theme}; diff --git a/src/calendar/index.tsx b/src/calendar/index.tsx index cae10b7287..47f791403b 100644 --- a/src/calendar/index.tsx +++ b/src/calendar/index.tsx @@ -24,7 +24,7 @@ import CalendarHeader, {CalendarHeaderProps} from './header'; import Day, {DayProps} from './day/index'; import BasicDay from './day/basic'; import {MarkingProps} from './day/marking'; -import {Theme} from '../commons/types'; +import {Theme} from '../types'; type MarkedDatesType = { @@ -59,7 +59,7 @@ export interface CalendarProps extends CalendarHeaderProps, DayProps { /** Handler which gets executed on day long press */ onDayLongPress?: (date: Date) => any; /** Handler which gets executed when month changes in calendar */ - onMonthChange?: () => void; + onMonthChange?: () => object; /** Handler which gets executed when visible month changes in calendar */ onVisibleMonthsChange?: () => void; /** Disables changing month when click on days of other months (when hideExtraDays is false) */ diff --git a/src/calendar/style.ts b/src/calendar/style.ts index 577ab647ab..08c8061a68 100644 --- a/src/calendar/style.ts +++ b/src/calendar/style.ts @@ -1,6 +1,6 @@ import {StyleSheet} from 'react-native'; import * as defaultStyle from '../style'; -import {Theme} from '../commons/types'; +import {Theme} from '../types'; export default function getStyle(theme: Theme = {}) { const appStyle = {...defaultStyle, ...theme}; diff --git a/src/commons/types.ts b/src/types.ts similarity index 72% rename from src/commons/types.ts rename to src/types.ts index eb6fb75d42..08e500c4fe 100644 --- a/src/commons/types.ts +++ b/src/types.ts @@ -1,7 +1,10 @@ -import {ColorValue, TextStyle} from 'react-native'; +import {ColorValue, ViewStyle, TextStyle} from 'react-native'; +import {UPDATE_SOURCES} from './expandableCalendar/commons'; + + export interface Theme { container?: object; - contentStyle?: object; + contentStyle?: ViewStyle; header?: object; headerText?: object; arrowButton?: object; @@ -22,6 +25,7 @@ export interface Theme { marking?: object; 'calendar-list'?: {main?: object}; agenda?: {main?: object, list?: object}; + expandable?: {main?: object} }; textSectionTitleColor?: string; textSectionTitleDisabledColor?: string; @@ -35,11 +39,11 @@ export interface Theme { dotColor?: string; selectedDotColor?: string; disabledArrowColor?: string; - textDayFontFamily?: string; - textMonthFontFamily?: string; - textDayHeaderFontFamily?: string; - textDayFontWeight?: string; - textMonthFontWeight?: string; + textDayFontFamily?: TextStyle['fontFamily']; + textMonthFontFamily?: TextStyle['fontFamily']; + textDayHeaderFontFamily?: TextStyle['fontFamily']; + textDayFontWeight?: TextStyle['fontWeight']; + textMonthFontWeight?: TextStyle['fontWeight']; textDayHeaderFontWeight?: TextStyle['fontWeight']; textDayFontSize?: number; textMonthFontSize?: number; @@ -57,12 +61,12 @@ export interface Theme { textDefaultColor?: string; textColor?: string; textLinkColor?: string; - todayButtonFontFamily?: string; - todayButtonFontWeight?: string; + todayButtonFontFamily?: TextStyle['fontFamily']; + todayButtonFontWeight?: TextStyle['fontWeight']; todayButtonFontSize?: number; - textDayStyle?: object; + textDayStyle?: TextStyle; dotStyle?: object; - arrowStyle?: object; + arrowStyle?: ViewStyle; todayBackgroundColor?: string; disabledDotColor?: string; todayDotColor?: string; @@ -71,3 +75,4 @@ export interface Theme { arrowHeight?: number; arrowWidth?: number; } +export type UpdateSource = keyof typeof UPDATE_SOURCES; From 64e9110ab68265434f2e591c4080ad14243d2320 Mon Sep 17 00:00:00 2001 From: Inbal Tish Date: Mon, 9 Aug 2021 10:11:15 +0300 Subject: [PATCH 02/10] Adding `DateData` type (returns from interface.xdatetodata function) --- src/agenda/index.tsx | 5 +++-- src/calendar/index.tsx | 8 ++++---- src/types.ts | 10 +++++++++- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/src/agenda/index.tsx b/src/agenda/index.tsx index db441868c6..ba68d7d882 100644 --- a/src/agenda/index.tsx +++ b/src/agenda/index.tsx @@ -15,9 +15,10 @@ import dateutils from '../dateutils'; // @ts-expect-error import {AGENDA_CALENDAR_KNOB} from '../testIDs'; // @ts-expect-error +import {DateData} from '../types'; import {VelocityTracker} from '../input'; -import CalendarList, {CalendarListProps} from '../calendar-list'; import styleConstructor from './style'; +import CalendarList, {CalendarListProps} from '../calendar-list'; import ReservationList, {ReservationListProps} from './reservation-list'; @@ -42,7 +43,7 @@ export type AgendaProps = CalendarListProps & ReservationListProps & { considered that the date in question is not yet loaded */ items: ReservationsType; /** callback that gets called when items for a certain month should be loaded (month became visible) */ - loadItemsForMonth?: (data: any) => void; + loadItemsForMonth?: (data: any) => DateData; /** callback that fires when the calendar is opened or closed */ onCalendarToggled?: (enabled: boolean) => void; /** callback that gets called on day press */ diff --git a/src/calendar/index.tsx b/src/calendar/index.tsx index 47f791403b..091bf2983f 100644 --- a/src/calendar/index.tsx +++ b/src/calendar/index.tsx @@ -24,7 +24,7 @@ import CalendarHeader, {CalendarHeaderProps} from './header'; import Day, {DayProps} from './day/index'; import BasicDay from './day/basic'; import {MarkingProps} from './day/marking'; -import {Theme} from '../types'; +import {Theme, DateData} from '../types'; type MarkedDatesType = { @@ -59,9 +59,9 @@ export interface CalendarProps extends CalendarHeaderProps, DayProps { /** Handler which gets executed on day long press */ onDayLongPress?: (date: Date) => any; /** Handler which gets executed when month changes in calendar */ - onMonthChange?: () => object; + onMonthChange?: () => DateData; /** Handler which gets executed when visible month changes in calendar */ - onVisibleMonthsChange?: () => void; + onVisibleMonthsChange?: () => DateData[]; /** Disables changing month when click on days of other months (when hideExtraDays is false) */ disableMonthChange?: boolean; /** Enable the option to swipe between months */ @@ -157,7 +157,7 @@ class Calendar extends Component { }); }; - handleDayInteraction(date: Date, interaction?: (date: Date) => any) { + handleDayInteraction(date: Date, interaction?: (date: Date) => DateData) { const {disableMonthChange} = this.props; const day = parseDate(date); const minDate = parseDate(this.props.minDate); diff --git a/src/types.ts b/src/types.ts index 08e500c4fe..23b306debe 100644 --- a/src/types.ts +++ b/src/types.ts @@ -1,7 +1,16 @@ +import { string } from 'prop-types'; import {ColorValue, ViewStyle, TextStyle} from 'react-native'; import {UPDATE_SOURCES} from './expandableCalendar/commons'; +export type UpdateSource = keyof typeof UPDATE_SOURCES; +export type DateData = { + year: number, + month: number, + day: number, + timestamp: number, + dateString: string +} export interface Theme { container?: object; contentStyle?: ViewStyle; @@ -75,4 +84,3 @@ export interface Theme { arrowHeight?: number; arrowWidth?: number; } -export type UpdateSource = keyof typeof UPDATE_SOURCES; From 72ce59c0b5d6f9eac03830a49ab40ed268806c4a Mon Sep 17 00:00:00 2001 From: Inbal Tish Date: Mon, 9 Aug 2021 13:00:48 +0300 Subject: [PATCH 03/10] fix style type --- src/agenda/index.tsx | 10 ++++------ src/agenda/reservation-list/index.tsx | 4 ++-- src/calendar-list/index.tsx | 17 +++++++++-------- src/calendar/header/index.tsx | 13 +++++++------ src/calendar/index.tsx | 8 ++++---- 5 files changed, 26 insertions(+), 26 deletions(-) diff --git a/src/agenda/index.tsx b/src/agenda/index.tsx index ba68d7d882..344402dde0 100644 --- a/src/agenda/index.tsx +++ b/src/agenda/index.tsx @@ -4,7 +4,7 @@ import XDate from 'xdate'; import memoize from 'memoize-one'; import React, {Component} from 'react'; -import {Text, View, Dimensions, Animated, ViewStyle, LayoutChangeEvent, NativeSyntheticEvent, NativeScrollEvent} from 'react-native'; +import {Text, View, Dimensions, Animated, StyleProp, ViewStyle, LayoutChangeEvent, NativeSyntheticEvent, NativeScrollEvent} from 'react-native'; // @ts-expect-error import {extractComponentProps} from '../component-updater.js'; @@ -36,8 +36,6 @@ export type ReservationsType = { } export type AgendaProps = CalendarListProps & ReservationListProps & { - /** agenda container style */ - style?: ViewStyle; /** the list of items that have to be displayed in agenda. If you want to render item as empty date the value of date key has to be an empty array []. If there exists no value for date key it is considered that the date in question is not yet loaded */ @@ -47,9 +45,9 @@ export type AgendaProps = CalendarListProps & ReservationListProps & { /** callback that fires when the calendar is opened or closed */ onCalendarToggled?: (enabled: boolean) => void; /** callback that gets called on day press */ - onDayPress?: (data: any) => void; + onDayPress?: (data: any) => DateData; /** callback that gets called when day changes while scrolling agenda list */ - onDaychange?: (data: any) => void; //TODO: Should be renamed 'onDayChange' + onDayChange?: (data: any) => void; /** specify how agenda knob should look like */ renderKnob?: () => JSX.Element; /** initially selected day */ @@ -95,7 +93,7 @@ export default class Agenda extends Component { /** callback that gets called on day press */ onDayPress: PropTypes.func, /** callback that gets called when day changes while scrolling agenda list */ - onDaychange: PropTypes.func, //TODO: Should be renamed 'onDayChange' + onDayChange: PropTypes.func, /** specify how agenda knob should look like */ renderKnob: PropTypes.func, /** initially selected day */ diff --git a/src/agenda/reservation-list/index.tsx b/src/agenda/reservation-list/index.tsx index b940c3d0a0..4663753ffc 100644 --- a/src/agenda/reservation-list/index.tsx +++ b/src/agenda/reservation-list/index.tsx @@ -3,7 +3,7 @@ import PropTypes from 'prop-types'; import XDate from 'xdate'; import React, {Component} from 'react'; -import {ActivityIndicator, View, FlatList, ViewStyle, TextStyle, NativeSyntheticEvent, NativeScrollEvent, LayoutChangeEvent} from 'react-native'; +import {ActivityIndicator, View, FlatList, StyleProp, ViewStyle, TextStyle, NativeSyntheticEvent, NativeScrollEvent, LayoutChangeEvent} from 'react-native'; // @ts-expect-error import {extractComponentProps} from '../../component-updater'; @@ -35,7 +35,7 @@ export type ReservationListProps = ReservationProps & { onDayChange?: (day: Date) => void; /** specify what should be rendered instead of ActivityIndicator */ renderEmptyData: () => JSX.Element; - style?: ViewStyle; + style?: StyleProp; /** onScroll ListView event */ onScroll?: (yOffset: number) => void; diff --git a/src/calendar-list/index.tsx b/src/calendar-list/index.tsx index e431b81f70..9aaeeb9d69 100644 --- a/src/calendar-list/index.tsx +++ b/src/calendar-list/index.tsx @@ -3,7 +3,7 @@ import PropTypes from 'prop-types'; import XDate from 'xdate'; import React, {Component} from 'react'; -import {FlatList, Platform, Dimensions, View, ViewStyle, LayoutChangeEvent} from 'react-native'; +import {FlatList, Platform, Dimensions, View, ViewStyle, LayoutChangeEvent, FlatListProps} from 'react-native'; // @ts-expect-error import {extractComponentProps} from '../component-updater'; @@ -24,7 +24,7 @@ const CALENDAR_HEIGHT = 360; const PAST_SCROLL_RANGE = 50; const FUTURE_SCROLL_RANGE = 50; -export type CalendarListProps = CalendarProps & { +interface Props extends CalendarProps, FlatListProps { /** Max amount of months allowed to scroll to the past. Default = 50 */ pastScrollRange?: number; /** Max amount of months allowed to scroll to the future. Default = 50 */ @@ -60,11 +60,12 @@ export type CalendarListProps = CalendarProps & { /** onLayout event */ onLayout?: (event: LayoutChangeEvent) => void; removeClippedSubviews: boolean; -}; +} +export type CalendarListProps = Props; type XDateAndBump = XDate & {propBump?: number} ; -type CalendarListState = { +type State = { rows: Array; texts: Array; openDate: XDate; @@ -78,7 +79,7 @@ type CalendarListState = { * @example: https://github.com/wix/react-native-calendars/blob/master/example/src/screens/calendarsList.js * @gif: https://github.com/wix/react-native-calendars/blob/master/demo/calendar-list.gif */ -class CalendarList extends Component { +class CalendarList extends Component { static displayName = 'CalendarList'; static propTypes = { @@ -136,7 +137,7 @@ class CalendarList extends Component { itemVisiblePercentThreshold: 20 }; - constructor(props: CalendarListProps) { + constructor(props: Props) { super(props); this.style = styleConstructor(props.theme); @@ -172,7 +173,7 @@ class CalendarList extends Component { }; } - componentDidUpdate(prevProps: CalendarListProps) { + componentDidUpdate(prevProps: Props) { const prevCurrent = parseDate(prevProps.current); const current = parseDate(this.props.current); @@ -181,7 +182,7 @@ class CalendarList extends Component { } } - static getDerivedStateFromProps(_: CalendarListProps, prevState: CalendarListState) { + static getDerivedStateFromProps(_: Props, prevState: State) { const rowClone = prevState.rows; const newRows = []; diff --git a/src/calendar/header/index.tsx b/src/calendar/header/index.tsx index 9f5e73a5db..2248e7d012 100644 --- a/src/calendar/header/index.tsx +++ b/src/calendar/header/index.tsx @@ -4,7 +4,7 @@ import memoize from 'memoize-one'; import XDate from 'xdate'; import React, {Component, Fragment, ReactNode} from 'react'; -import {ActivityIndicator, Platform, View, Text, TouchableOpacity, Image, ViewStyle, AccessibilityActionEvent, ColorValue} from 'react-native'; +import {ActivityIndicator, Platform, View, Text, TouchableOpacity, Image, StyleProp, ViewStyle, AccessibilityActionEvent, ColorValue} from 'react-native'; // @ts-expect-error import {shouldUpdate} from '../../component-updater'; // @ts-expect-error @@ -21,7 +21,7 @@ import styleConstructor from './style'; import {Theme} from '../../types'; type Direction = 'left' | 'right'; -export interface CalendarHeaderProps { +interface Props { theme?: Theme; firstDay?: number; displayLoadingIndicator?: boolean; @@ -51,12 +51,13 @@ export interface CalendarHeaderProps { /** Provide aria-level for calendar heading for proper accessibility when used with web (react-native-web) */ webAriaLevel?: number; testID?: string; - style?: ViewStyle; + style?: StyleProp; accessibilityElementsHidden?: boolean; importantForAccessibility?: 'auto' | 'yes' | 'no' | 'no-hide-descendants'; } +export type CalendarHeaderProps = Props; -class CalendarHeader extends Component { +class CalendarHeader extends Component { static displayName = 'IGNORE'; static propTypes = { @@ -96,13 +97,13 @@ class CalendarHeader extends Component { }; style: any; - constructor(props: CalendarHeaderProps) { + constructor(props: Props) { super(props); this.style = styleConstructor(props.theme); } - shouldComponentUpdate(nextProps: CalendarHeaderProps) { + shouldComponentUpdate(nextProps: Props) { if (nextProps.month?.toString('yyyy MM') !== this.props.month?.toString('yyyy MM')) { return true; } diff --git a/src/calendar/index.tsx b/src/calendar/index.tsx index 091bf2983f..dc967cb8a4 100644 --- a/src/calendar/index.tsx +++ b/src/calendar/index.tsx @@ -4,7 +4,7 @@ import XDate from 'xdate'; import memoize from 'memoize-one'; import React, {Component, RefObject} from 'react'; -import {View, ViewStyle} from 'react-native'; +import {View, ViewStyle, StyleProp} from 'react-native'; // @ts-expect-error import GestureRecognizer, {swipeDirections} from 'react-native-swipe-gestures'; @@ -19,12 +19,12 @@ import {getState} from '../day-state-manager'; import {extractComponentProps} from '../component-updater'; // @ts-expect-error import {WEEK_NUMBER} from '../testIDs'; +import {Theme, DateData} from '../types'; import styleConstructor from './style'; import CalendarHeader, {CalendarHeaderProps} from './header'; import Day, {DayProps} from './day/index'; import BasicDay from './day/basic'; import {MarkingProps} from './day/marking'; -import {Theme, DateData} from '../types'; type MarkedDatesType = { @@ -35,7 +35,7 @@ export interface CalendarProps extends CalendarHeaderProps, DayProps { /** Specify theme properties to override specific styles for calendar parts */ theme?: Theme; /** Specify style for calendar container element */ - style?: ViewStyle; + style?: StyleProp; /** Initially visible month */ current?: XDate; /** Minimum date that can be selected, dates before minDate will be grayed out */ @@ -55,7 +55,7 @@ export interface CalendarProps extends CalendarHeaderProps, DayProps { /** Always show six weeks on each month (only when hideExtraDays = false) */ showSixWeeks?: boolean; /** Handler which gets executed on day press */ - onDayPress?: (date: Date) => any; + onDayPress?: (date: Date) => DateData; /** Handler which gets executed on day long press */ onDayLongPress?: (date: Date) => any; /** Handler which gets executed when month changes in calendar */ From c7f27a80f39f4d63a5c9ba47b290f9540ee03f64 Mon Sep 17 00:00:00 2001 From: Inbal Tish Date: Mon, 9 Aug 2021 13:14:38 +0300 Subject: [PATCH 04/10] fix comment --- src/agenda/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/agenda/index.tsx b/src/agenda/index.tsx index 344402dde0..21e551814d 100644 --- a/src/agenda/index.tsx +++ b/src/agenda/index.tsx @@ -15,8 +15,8 @@ import dateutils from '../dateutils'; // @ts-expect-error import {AGENDA_CALENDAR_KNOB} from '../testIDs'; // @ts-expect-error -import {DateData} from '../types'; import {VelocityTracker} from '../input'; +import {DateData} from '../types'; import styleConstructor from './style'; import CalendarList, {CalendarListProps} from '../calendar-list'; import ReservationList, {ReservationListProps} from './reservation-list'; From 61b43373f6067468d4eade191949e496b06cb11c Mon Sep 17 00:00:00 2001 From: Inbal Tish Date: Mon, 9 Aug 2021 13:42:45 +0300 Subject: [PATCH 05/10] fix for BasicDay onPress and components' `onDayPress` --- src/agenda/index.tsx | 2 +- src/calendar/day/basic/index.tsx | 5 +++-- src/calendar/index.tsx | 6 +++--- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/agenda/index.tsx b/src/agenda/index.tsx index 21e551814d..6694ce5940 100644 --- a/src/agenda/index.tsx +++ b/src/agenda/index.tsx @@ -45,7 +45,7 @@ export type AgendaProps = CalendarListProps & ReservationListProps & { /** callback that fires when the calendar is opened or closed */ onCalendarToggled?: (enabled: boolean) => void; /** callback that gets called on day press */ - onDayPress?: (data: any) => DateData; + onDayPress?: (data: DateData) => void; /** callback that gets called when day changes while scrolling agenda list */ onDayChange?: (data: any) => void; /** specify how agenda knob should look like */ diff --git a/src/calendar/day/basic/index.tsx b/src/calendar/day/basic/index.tsx index 2c3f3716f1..b20c3ce247 100644 --- a/src/calendar/day/basic/index.tsx +++ b/src/calendar/day/basic/index.tsx @@ -3,11 +3,12 @@ import PropTypes from 'prop-types'; import React, {Component, Fragment} from 'react'; import {TouchableOpacity, Text, View} from 'react-native'; + +import {Theme, DateData} from '../../../types'; // @ts-expect-error import {shouldUpdate} from '../../../component-updater'; import styleConstructor from './style'; import Marking, {MarkingTypes, MarkingProps} from '../marking'; -import {Theme} from '../../../types'; export interface BasicDayProps { state?: 'selected' | 'disabled' | 'today'; @@ -18,7 +19,7 @@ export interface BasicDayProps { /** Theme object */ theme?: Theme; /** onPress callback */ - onPress?: (date: Date) => void; + onPress?: (date: DateData) => void; /** onLongPress callback */ onLongPress?: (date: Date) => void; /** The date to return from press callbacks */ diff --git a/src/calendar/index.tsx b/src/calendar/index.tsx index dc967cb8a4..ae1ce6c592 100644 --- a/src/calendar/index.tsx +++ b/src/calendar/index.tsx @@ -55,9 +55,9 @@ export interface CalendarProps extends CalendarHeaderProps, DayProps { /** Always show six weeks on each month (only when hideExtraDays = false) */ showSixWeeks?: boolean; /** Handler which gets executed on day press */ - onDayPress?: (date: Date) => DateData; + onDayPress?: (date: DateData) => void; /** Handler which gets executed on day long press */ - onDayLongPress?: (date: Date) => any; + onDayLongPress?: (date: DateData) => void; /** Handler which gets executed when month changes in calendar */ onMonthChange?: () => DateData; /** Handler which gets executed when visible month changes in calendar */ @@ -157,7 +157,7 @@ class Calendar extends Component { }); }; - handleDayInteraction(date: Date, interaction?: (date: Date) => DateData) { + handleDayInteraction(date: Date, interaction?: (date: DateData) => void) { const {disableMonthChange} = this.props; const day = parseDate(date); const minDate = parseDate(this.props.minDate); From 9dc7e28cf739e22ea93967167c7d136ec13a49e0 Mon Sep 17 00:00:00 2001 From: Inbal Tish Date: Mon, 9 Aug 2021 14:32:41 +0300 Subject: [PATCH 06/10] moving Direction to types --- src/calendar/header/index.tsx | 3 +-- src/types.ts | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/calendar/header/index.tsx b/src/calendar/header/index.tsx index 2248e7d012..9a8e620905 100644 --- a/src/calendar/header/index.tsx +++ b/src/calendar/header/index.tsx @@ -18,9 +18,8 @@ import { // @ts-expect-error } from '../../testIDs'; import styleConstructor from './style'; -import {Theme} from '../../types'; +import {Theme, Direction} from '../../types'; -type Direction = 'left' | 'right'; interface Props { theme?: Theme; firstDay?: number; diff --git a/src/types.ts b/src/types.ts index 23b306debe..f526f4c47a 100644 --- a/src/types.ts +++ b/src/types.ts @@ -2,7 +2,7 @@ import { string } from 'prop-types'; import {ColorValue, ViewStyle, TextStyle} from 'react-native'; import {UPDATE_SOURCES} from './expandableCalendar/commons'; - +export type Direction = 'left' | 'right'; export type UpdateSource = keyof typeof UPDATE_SOURCES; export type DateData = { year: number, From fe650ce4778a9e3dbe7f29fdf209299847ccee1f Mon Sep 17 00:00:00 2001 From: Inbal Tish Date: Mon, 9 Aug 2021 14:38:13 +0300 Subject: [PATCH 07/10] fix `onVisibleMonthsChange` type --- src/agenda/index.tsx | 2 +- src/calendar/index.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/agenda/index.tsx b/src/agenda/index.tsx index 6694ce5940..638caca7f6 100644 --- a/src/agenda/index.tsx +++ b/src/agenda/index.tsx @@ -318,7 +318,7 @@ export default class Agenda extends Component { this.enableCalendarScrolling(snapY === 0); }; - onVisibleMonthsChange = (months: string[]) => { + onVisibleMonthsChange = (months: DateData[]) => { _.invoke(this.props, 'onVisibleMonthsChange', months); if (this.props.items && !this.state.firstReservationLoad) { diff --git a/src/calendar/index.tsx b/src/calendar/index.tsx index ae1ce6c592..0ec1cf2a00 100644 --- a/src/calendar/index.tsx +++ b/src/calendar/index.tsx @@ -61,7 +61,7 @@ export interface CalendarProps extends CalendarHeaderProps, DayProps { /** Handler which gets executed when month changes in calendar */ onMonthChange?: () => DateData; /** Handler which gets executed when visible month changes in calendar */ - onVisibleMonthsChange?: () => DateData[]; + onVisibleMonthsChange?: (months: DateData[]) => void; /** Disables changing month when click on days of other months (when hideExtraDays is false) */ disableMonthChange?: boolean; /** Enable the option to swipe between months */ From 7c218db0d5181ec6b684a5942a9bf79385531eac Mon Sep 17 00:00:00 2001 From: Inbal Tish Date: Mon, 9 Aug 2021 15:26:03 +0300 Subject: [PATCH 08/10] fix ts errors --- src/agenda/index.tsx | 2 +- src/types.ts | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/agenda/index.tsx b/src/agenda/index.tsx index 638caca7f6..bb0695a465 100644 --- a/src/agenda/index.tsx +++ b/src/agenda/index.tsx @@ -4,7 +4,7 @@ import XDate from 'xdate'; import memoize from 'memoize-one'; import React, {Component} from 'react'; -import {Text, View, Dimensions, Animated, StyleProp, ViewStyle, LayoutChangeEvent, NativeSyntheticEvent, NativeScrollEvent} from 'react-native'; +import {Text, View, Dimensions, Animated, ViewStyle, LayoutChangeEvent, NativeSyntheticEvent, NativeScrollEvent} from 'react-native'; // @ts-expect-error import {extractComponentProps} from '../component-updater.js'; diff --git a/src/types.ts b/src/types.ts index f526f4c47a..a1cf01d86b 100644 --- a/src/types.ts +++ b/src/types.ts @@ -1,7 +1,8 @@ -import { string } from 'prop-types'; import {ColorValue, ViewStyle, TextStyle} from 'react-native'; +// @ts-expect-error import {UPDATE_SOURCES} from './expandableCalendar/commons'; + export type Direction = 'left' | 'right'; export type UpdateSource = keyof typeof UPDATE_SOURCES; export type DateData = { From f857c3acd5755acb881c45347f3c4c04ad072398 Mon Sep 17 00:00:00 2001 From: Inbal Tish Date: Mon, 9 Aug 2021 16:37:34 +0300 Subject: [PATCH 09/10] podfile.lock --- ios/Podfile.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 9af25240bd..de19a258ed 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -377,10 +377,10 @@ EXTERNAL SOURCES: SPEC CHECKSUMS: boost-for-react-native: 39c7adb57c4e60d6c5479dd8623128eb5b3f0f2c - DoubleConversion: cde416483dac037923206447da6e1454df403714 + DoubleConversion: cf9b38bf0b2d048436d9a82ad2abe1404f11e7de FBLazyVector: e686045572151edef46010a6f819ade377dfeb4b FBReactNativeSpec: 92869e54fbef651850edc0f8ad2e5e53421f5fbe - glog: 40a13f7840415b9a77023fbcae0f1e6f43192af3 + glog: 73c2498ac6884b13ede40eda8228cb1eee9d9d62 RCT-Folly: ec7a233ccc97cc556cf7237f0db1ff65b986f27c RCTRequired: 6d3e854f0e7260a648badd0d44fc364bc9da9728 RCTTypeSafety: c1f31d19349c6b53085766359caac425926fafaa From 94fd761d18674a47899fe23fd358fa2fbabeb711 Mon Sep 17 00:00:00 2001 From: Inbal Tish Date: Tue, 10 Aug 2021 12:11:26 +0300 Subject: [PATCH 10/10] fix imports ts errors with // @ts-expect-error --- src/agenda/reservation-list/index.tsx | 3 +++ src/agenda/reservation-list/reservation.tsx | 3 +++ src/calendar-list/index.tsx | 3 +++ src/calendar/day/index.tsx | 4 ++++ src/calendar/index.tsx | 2 ++ 5 files changed, 15 insertions(+) diff --git a/src/agenda/reservation-list/index.tsx b/src/agenda/reservation-list/index.tsx index de43dfd1c8..eb3fbb52c9 100644 --- a/src/agenda/reservation-list/index.tsx +++ b/src/agenda/reservation-list/index.tsx @@ -7,12 +7,15 @@ import {ActivityIndicator, View, FlatList, StyleProp, ViewStyle, TextStyle, Nati // @ts-expect-error import {extractComponentProps} from '../../component-updater'; +// @ts-expect-error import {sameDate} from '../../dateutils'; +// @ts-expect-error import {toMarkingFormat} from '../../interface'; import styleConstructor from './style'; import Reservation, {ReservationProps} from './reservation'; import {ReservationItemType, ReservationsType} from 'agenda'; + export interface DayReservations { reservation?: ReservationItemType; date?: XDate; diff --git a/src/agenda/reservation-list/reservation.tsx b/src/agenda/reservation-list/reservation.tsx index acb8f8f039..047b9ad27b 100644 --- a/src/agenda/reservation-list/reservation.tsx +++ b/src/agenda/reservation-list/reservation.tsx @@ -7,12 +7,15 @@ import {View, Text} from 'react-native'; // @ts-expect-error import {xdateToData} from '../../interface'; +// @ts-expect-error import {isToday} from '../../dateutils'; +// @ts-expect-error import {RESERVATION_DATE} from '../../testIDs'; import styleConstructor from './style'; import {Theme} from '../../types'; import {DayReservations} from './index'; + export interface ReservationProps { item: DayReservations; /** Specify theme properties to override specific styles for reservation parts. Default = {} */ diff --git a/src/calendar-list/index.tsx b/src/calendar-list/index.tsx index 1120e94391..726a1c3a51 100644 --- a/src/calendar-list/index.tsx +++ b/src/calendar-list/index.tsx @@ -9,13 +9,16 @@ import {FlatList, Platform, Dimensions, View, ViewStyle, LayoutChangeEvent, Flat import {extractComponentProps} from '../component-updater'; // @ts-expect-error import {xdateToData, parseDate} from '../interface'; +// @ts-expect-error import {page, sameDate} from '../dateutils'; +// @ts-expect-error import {STATIC_HEADER} from '../testIDs'; import styleConstructor from './style'; import Calendar, {CalendarProps} from '../calendar'; import CalendarListItem from './item'; import CalendarHeader from '../calendar/header/index'; + const {width} = Dimensions.get('window'); const CALENDAR_WIDTH = width; const CALENDAR_HEIGHT = 360; diff --git a/src/calendar/day/index.tsx b/src/calendar/day/index.tsx index 6c475e7ebb..f1777d0fdd 100644 --- a/src/calendar/day/index.tsx +++ b/src/calendar/day/index.tsx @@ -4,9 +4,12 @@ import XDate from 'xdate'; import memoize from 'memoize-one'; import React, {Component} from 'react'; + // @ts-expect-error import {shouldUpdate} from '../../component-updater'; +// @ts-expect-error import {isToday as dateutils_isToday} from '../../dateutils'; +// @ts-expect-error import {xdateToData} from '../../interface'; // @ts-expect-error import {SELECT_DATE_SLOT} from '../../testIDs'; @@ -14,6 +17,7 @@ import BasicDay, {BasicDayProps} from './basic'; import PeriodDay from './period'; import {MarkingProps} from './marking'; + const basicDayPropsTypes = _.omit(BasicDay.propTypes, 'date'); export interface DayProps extends Omit { diff --git a/src/calendar/index.tsx b/src/calendar/index.tsx index 69047bd0cd..9d72e0b665 100644 --- a/src/calendar/index.tsx +++ b/src/calendar/index.tsx @@ -8,7 +8,9 @@ import {View, ViewStyle, StyleProp} from 'react-native'; // @ts-expect-error import GestureRecognizer, {swipeDirections} from 'react-native-swipe-gestures'; +// @ts-expect-error import {page, isGTE, isLTE, sameMonth} from '../dateutils'; +// @ts-expect-error import {xdateToData, parseDate, toMarkingFormat} from '../interface'; // @ts-expect-error import {getState} from '../day-state-manager';