Skip to content

Commit d83df91

Browse files
committed
chore: apply patch
1 parent 32a5eed commit d83df91

File tree

13 files changed

+11681
-829
lines changed

13 files changed

+11681
-829
lines changed

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"name": "react-native-calendars",
3-
"version": "1.22.0",
2+
"name": "@unifyapps/react-native-calendars",
3+
"version": "1.22.0-ua",
44
"main": "src/index.ts",
55
"types": "src/index.d.ts",
66
"description": "React Native Calendar Components",
@@ -79,6 +79,8 @@
7979
"lint-staged": "^10.2.11",
8080
"metro-react-native-babel-preset": "0.73.7",
8181
"mocha": "^7.1.0",
82+
"patch-package": "^8.0.0",
83+
"postinstall-postinstall": "^2.1.0",
8284
"prettier": "2.8.8",
8385
"prettier-eslint": "^16.3.0",
8486
"react": "18.2.0",

pnpm-lock.yaml

Lines changed: 10752 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/calendar/day/basic/index.tsx

Lines changed: 44 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import React, {Fragment, useCallback, useRef} from 'react';
2-
import {TouchableOpacity, Text, View, ViewProps} from 'react-native';
3-
import {xdateToData} from '../../../interface';
4-
import {Theme, DayState, MarkingTypes, DateData} from '../../../types';
5-
import Marking, {MarkingProps} from '../marking';
1+
import React, { Fragment, useCallback, useRef } from 'react';
2+
import { TouchableOpacity, Text, View, ViewProps } from 'react-native';
3+
import { xdateToData } from '../../../interface';
4+
import { Theme, DayState, MarkingTypes, DateData } from '../../../types';
5+
import Marking, { MarkingProps } from '../marking';
66
import styleConstructor from './style';
77

88

@@ -31,24 +31,10 @@ export interface BasicDayProps extends ViewProps {
3131
testID?: string;
3232
}
3333

34-
const BasicDay = (props: BasicDayProps) => {
35-
const {
36-
theme,
37-
date,
38-
onPress,
39-
onLongPress,
40-
markingType,
41-
marking,
42-
state,
43-
disableAllTouchEventsForDisabledDays,
44-
disableAllTouchEventsForInactiveDays,
45-
accessibilityLabel,
46-
children,
47-
testID
48-
} = props;
34+
const BasicDay = (props) => {
35+
const { theme, date, onPress, onLongPress, markingType, marking, state, disableAllTouchEventsForDisabledDays, disableAllTouchEventsForInactiveDays, accessibilityLabel, children, testID } = props;
4936
const dateData = date ? xdateToData(date) : undefined;
5037
const style = useRef(styleConstructor(theme));
51-
5238
const _marking = marking || {};
5339
const isSelected = _marking.selected || state === 'selected';
5440
const isDisabled = typeof _marking.disabled !== 'undefined' ? _marking.disabled : state === 'disabled';
@@ -57,143 +43,101 @@ const BasicDay = (props: BasicDayProps) => {
5743
const isMultiDot = markingType === Marking.markings.MULTI_DOT;
5844
const isMultiPeriod = markingType === Marking.markings.MULTI_PERIOD;
5945
const isCustom = markingType === Marking.markings.CUSTOM;
60-
6146
const shouldDisableTouchEvent = () => {
62-
const {disableTouchEvent} = _marking;
47+
const { disableTouchEvent } = _marking;
6348
let disableTouch = false;
64-
6549
if (typeof disableTouchEvent === 'boolean') {
6650
disableTouch = disableTouchEvent;
67-
} else if (typeof disableAllTouchEventsForDisabledDays === 'boolean' && isDisabled) {
51+
}
52+
else if (typeof disableAllTouchEventsForDisabledDays === 'boolean' && isDisabled) {
6853
disableTouch = disableAllTouchEventsForDisabledDays;
69-
} else if (typeof disableAllTouchEventsForInactiveDays === 'boolean' && isInactive) {
54+
}
55+
else if (typeof disableAllTouchEventsForInactiveDays === 'boolean' && isInactive) {
7056
disableTouch = disableAllTouchEventsForInactiveDays;
7157
}
7258
return disableTouch;
7359
};
74-
7560
const getContainerStyle = () => {
76-
const {customStyles, selectedColor} = _marking;
61+
const { customStyles, selectedColor } = _marking;
7762
const styles = [style.current.base];
78-
7963
if (isSelected) {
8064
styles.push(style.current.selected);
8165
if (selectedColor) {
82-
styles.push({backgroundColor: selectedColor});
66+
styles.push({ backgroundColor: selectedColor });
8367
}
84-
} else if (isToday) {
68+
}
69+
else if (isToday) {
8570
styles.push(style.current.today);
8671
}
87-
8872
//Custom marking type
8973
if (isCustom && customStyles && customStyles.container) {
9074
if (customStyles.container.borderRadius === undefined) {
9175
customStyles.container.borderRadius = 16;
9276
}
9377
styles.push(customStyles.container);
9478
}
95-
9679
return styles;
9780
};
98-
9981
const getTextStyle = () => {
100-
const {customStyles, selectedTextColor} = _marking;
82+
const { customStyles, selectedTextColor } = _marking;
10183
const styles = [style.current.text];
102-
10384
if (isSelected) {
10485
styles.push(style.current.selectedText);
10586
if (selectedTextColor) {
106-
styles.push({color: selectedTextColor});
87+
styles.push({ color: selectedTextColor });
10788
}
108-
} else if (isDisabled) {
89+
}
90+
else if (isDisabled) {
10991
styles.push(style.current.disabledText);
110-
} else if (isToday) {
92+
}
93+
else if (isToday) {
11194
styles.push(style.current.todayText);
112-
} else if (isInactive) {
95+
}
96+
else if (isInactive) {
11397
styles.push(style.current.inactiveText);
11498
}
115-
11699
// Custom marking type
117100
if (isCustom && customStyles && customStyles.text) {
118101
styles.push(customStyles.text);
119102
}
120-
121103
return styles;
122104
};
123-
124105
const _onPress = useCallback(() => {
125106
onPress?.(dateData);
126107
}, [onPress, date]);
127-
128108
const _onLongPress = useCallback(() => {
129109
onLongPress?.(dateData);
130110
}, [onLongPress, date]);
131-
132111
const renderMarking = () => {
133-
const {marked, dotColor, dots, periods} = _marking;
134-
135-
return (
136-
<Marking
137-
type={markingType}
138-
theme={theme}
139-
marked={isMultiDot ? true : marked}
140-
selected={isSelected}
141-
disabled={isDisabled}
142-
inactive={isInactive}
143-
today={isToday}
144-
dotColor={dotColor}
145-
dots={dots}
146-
periods={periods}
147-
/>
148-
);
112+
const { marked, dotColor, dots, periods } = _marking;
113+
// if marking is not set or is multi dot, return null
114+
// we are doing this as it takes the space in bottom of day making text move upwards.
115+
if (!marked || isMultiDot) return null;
116+
return (<Marking type={markingType} theme={theme} marked={isMultiDot ? true : marked} selected={isSelected} disabled={isDisabled} inactive={isInactive} today={isToday} dotColor={dotColor} dots={dots} periods={periods} />);
149117
};
150-
151118
const renderText = () => {
152-
return (
153-
<Text allowFontScaling={false} style={getTextStyle()} testID={`${testID}.text`}>
154-
{String(children)}
155-
</Text>
156-
);
119+
return (<Text allowFontScaling={false} style={getTextStyle()} testID={`${testID}.text`}>
120+
{String(children)}
121+
</Text>);
157122
};
158-
159123
const renderContent = () => {
160-
return (
161-
<Fragment>
162-
{renderText()}
163-
{renderMarking()}
164-
</Fragment>
165-
);
124+
return (<Fragment>
125+
{renderText()}
126+
{renderMarking()}
127+
</Fragment>);
166128
};
167-
168129
const renderContainer = () => {
169-
const {activeOpacity} = _marking;
170-
171-
return (
172-
<TouchableOpacity
173-
testID={testID}
174-
style={getContainerStyle()}
175-
activeOpacity={activeOpacity}
176-
disabled={shouldDisableTouchEvent()}
177-
onPress={!shouldDisableTouchEvent() ? _onPress : undefined}
178-
onLongPress={!shouldDisableTouchEvent() ? _onLongPress : undefined}
179-
accessible
180-
accessibilityRole={isDisabled ? undefined : 'button'}
181-
accessibilityLabel={accessibilityLabel}
182-
>
183-
{isMultiPeriod ? renderText() : renderContent()}
184-
</TouchableOpacity>
185-
);
130+
const { activeOpacity } = _marking;
131+
return (<TouchableOpacity testID={testID} style={getContainerStyle()} activeOpacity={activeOpacity} disabled={shouldDisableTouchEvent()} onPress={!shouldDisableTouchEvent() ? _onPress : undefined} onLongPress={!shouldDisableTouchEvent() ? _onLongPress : undefined} accessible accessibilityRole={isDisabled ? undefined : 'button'} accessibilityLabel={accessibilityLabel}>
132+
{isMultiPeriod ? renderText() : renderContent()}
133+
</TouchableOpacity>);
186134
};
187-
188135
const renderPeriodsContainer = () => {
189-
return (
190-
<View style={style.current.container}>
191-
{renderContainer()}
192-
{renderMarking()}
193-
</View>
194-
);
136+
return (<View style={style.current.container}>
137+
{renderContainer()}
138+
{renderMarking()}
139+
</View>);
195140
};
196-
197141
return isMultiPeriod ? renderPeriodsContainer() : renderContainer();
198142
};
199143

0 commit comments

Comments
 (0)