Skip to content

Commit dbe3d58

Browse files
committed
fix: 修复picker组件改变后引起的bug
1 parent a7f8412 commit dbe3d58

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

.changeset/strange-flies-stare.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@td-design/react-native-calendar': patch
3+
---
4+
5+
修复picker组件修改后引起的bug

packages/react-native-calendar/src/components/Calendar/useCalendar.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { ReactNode, useEffect, useRef } from 'react';
1+
import React, { ReactNode, useEffect } from 'react';
22
import { FlingGestureHandlerStateChangeEvent, State } from 'react-native-gesture-handler';
33
import Animated from 'react-native-reanimated';
44

@@ -31,7 +31,6 @@ export default function useCalendar({
3131
...restProps
3232
}: CalendarProps) {
3333
const theme = useTheme<Theme>();
34-
const datePickerRef = useRef<{ getValue: () => { date: Date; formatDate: string } }>(null);
3534
const [currentMonth, setCurrentMonth] = useSafeState<Dayjs>(current || dayjs());
3635
const [curMarkedDates, setCurMarkedDates] = useSafeState<MarkedDates>({});
3736
const [isFold, { setTrue, setFalse }] = useBoolean(true);
@@ -193,7 +192,7 @@ export default function useCalendar({
193192
};
194193

195194
const renderDatePicker = () => {
196-
return <DatePicker ref={datePickerRef} value={currentMonth.toDate()} onChange={handleChange} />;
195+
return <DatePicker value={currentMonth.toDate()} onChange={handleChange} />;
197196
};
198197

199198
const renderCalendar = () => (

0 commit comments

Comments
 (0)