20260629222128

This commit is contained in:
oneao committed 2026-06-29 22:21:28 +08:00
1 parent 6ab4ae9c77
commit 96299ba9a2
20 files changed
+614 -409

No files matched your search

+30 -30
View File
@@ -63,8 +63,7 @@ export default function DateTime({
}
}, [show, value]);
// 关闭:BottomSheet 的 onOpenChange(false) 或 confirm 后 setOpen(false)
// 立刻通知父组件,不延迟 —— BottomSheet 自身驱动关闭动画
// 关闭
useEffect(() => {
if (!open && show) {
onCloseRef.current?.();
@@ -87,35 +86,36 @@ export default function DateTime({
}, [loading, tempDate, finalFormat, onConfirm]);
return (
<BottomSheet isOpen={open} onOpenChange={setOpen}>
<BottomSheet.Portal>
<BottomSheet.Overlay />
<BottomSheet.Content animateOnMount={false}>
<View className="w-full items-center">
<DateTimePicker
mode="single"
date={tempDate}
initialView={modeViewMap[mode]}
timePicker={mode === "time" || mode === "datetime"}
selectedItemColor={accentColor}
onChange={({ date }) => {
if (date) setTempDate(dayjs(date));
}}
/>
<BottomSheet
isOpen={open}
onOpenChange={setOpen}
backdropOpacity={0.35}
>
<BottomSheet.Content className="pb-6">
<View className="w-full items-center">
<DateTimePicker
mode="single"
date={tempDate}
initialView={modeViewMap[mode]}
timePicker={mode === "time" || mode === "datetime"}
selectedItemColor={accentColor}
onChange={({ date }) => {
if (date) setTempDate(dayjs(date));
}}
/>
<Button className="w-full" onPress={handleConfirm} isDisabled={loading}>
{loading ? (
<Spinner entering={FadeIn.delay(50)} color="white" />
) : (
<>
<CheckIcon color="#fff" />
<Button.Label>确认</Button.Label>
</>
)}
</Button>
</View>
</BottomSheet.Content>
</BottomSheet.Portal>
<Button className="w-full" onPress={handleConfirm} isDisabled={loading}>
{loading ? (
<Spinner entering={FadeIn.delay(50)} color="white" />
) : (
<>
<CheckIcon color="#fff" />
<Button.Label>确认</Button.Label>
</>
)}
</Button>
</View>
</BottomSheet.Content>
</BottomSheet>
);
}