Skip to content

Commit 6c970da

Browse files
fix: fixed bug with grid height
1 parent 02c052d commit 6c970da

File tree

4 files changed

+21
-10
lines changed

4 files changed

+21
-10
lines changed

example/ios/example.xcodeproj/project.pbxproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -855,7 +855,7 @@
855855
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
856856
GCC_WARN_UNUSED_FUNCTION = YES;
857857
GCC_WARN_UNUSED_VARIABLE = YES;
858-
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
858+
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
859859
LD_RUNPATH_SEARCH_PATHS = "/usr/lib/swift $(inherited)";
860860
LIBRARY_SEARCH_PATHS = (
861861
"\"$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)\"",
@@ -908,7 +908,7 @@
908908
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
909909
GCC_WARN_UNUSED_FUNCTION = YES;
910910
GCC_WARN_UNUSED_VARIABLE = YES;
911-
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
911+
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
912912
LD_RUNPATH_SEARCH_PATHS = "/usr/lib/swift $(inherited)";
913913
LIBRARY_SEARCH_PATHS = (
914914
"\"$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)\"",

src/Date/Day.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as React from 'react'
2-
import { Text, TouchableRipple, useTheme } from 'react-native-paper'
2+
import { DarkTheme, Text, TouchableRipple } from 'react-native-paper'
33
import { StyleSheet, View } from 'react-native'
44
import DayRange from './DayRange'
55
import { daySize } from './dateUtils'
@@ -10,6 +10,7 @@ function EmptyDayPure() {
1010
export const EmptyDay = React.memo(EmptyDayPure)
1111

1212
function Day(props: {
13+
theme: typeof DarkTheme
1314
textColorOnPrimary: string
1415
day: number
1516
month: number
@@ -38,8 +39,9 @@ function Day(props: {
3839
isToday,
3940
disabled,
4041
textColorOnPrimary,
42+
theme,
4143
} = props
42-
const theme = useTheme()
44+
// console.log(month, { day })
4345
const onPress = React.useCallback(() => {
4446
onPressDate(new Date(year, month, day))
4547
}, [onPressDate, year, month, day])

src/Date/Month.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,7 @@ function Month(props: MonthSingleProps | MonthRangeProps | MonthMultiProps) {
333333
) : (
334334
<Day
335335
key={gd.dayIndex}
336+
theme={theme}
336337
day={gd.dayOfMonth}
337338
month={gd.month}
338339
year={gd.year}
@@ -417,7 +418,7 @@ function weeksOffset(index: number): number {
417418
}
418419
} else {
419420
for (let i = 0; i < startAtIndex - index; i++) {
420-
const cIndex = startAtIndex - i
421+
const cIndex = startAtIndex - i - 1
421422
off -= gridCounts[cIndex] || getGridCount(cIndex)
422423
}
423424
}
@@ -454,6 +455,7 @@ export function getVerticalMonthsOffset(index: number) {
454455
const ob = weeksOffset(index)
455456
const monthsHeight = weekSize * ob
456457
const c = monthsHeight + count * (dayNamesHeight + montHeaderHeight)
458+
457459
return (c || 0) + beginOffset
458460
}
459461

src/Date/Swiper.native.tsx

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ const styles = StyleSheet.create({
2222
viewPager: {
2323
flex: 1,
2424
},
25+
inner: {
26+
position: 'relative',
27+
},
2528
})
2629
const visibleArray = (i: number) => [i - 2, i - 1, i, i + 1, i + 2]
2730

@@ -148,11 +151,15 @@ function SwiperInner({
148151
scrollEventThrottle={10}
149152
>
150153
<View
151-
style={{
152-
height: isHorizontal ? height : estimatedMonthHeight * totalMonths,
153-
width: isHorizontal ? width * totalMonths : width,
154-
position: 'relative',
155-
}}
154+
style={[
155+
styles.inner,
156+
{
157+
height: isHorizontal
158+
? height
159+
: estimatedMonthHeight * totalMonths,
160+
width: isHorizontal ? width * totalMonths : width,
161+
},
162+
]}
156163
>
157164
{visibleIndexes
158165
? [0, 1, 2, 3, 4].map((vi) => (

0 commit comments

Comments
 (0)