feat: 适配 headerbar ios26
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
||||
import { StyleSheet, Text, TouchableOpacity, View } from 'react-native';
|
||||
import WheelPickerExpo from 'react-native-wheel-picker-expo';
|
||||
import dayjs from 'dayjs';
|
||||
import { FloatingSelectionCard } from '@/components/ui/FloatingSelectionCard';
|
||||
import { Colors } from '@/constants/Colors';
|
||||
import { useColorScheme } from '@/hooks/useColorScheme';
|
||||
import dayjs from 'dayjs';
|
||||
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
||||
import { StyleSheet, Text, TouchableOpacity, View } from 'react-native';
|
||||
import WheelPickerExpo from 'react-native-wheel-picker-expo';
|
||||
|
||||
type FastingStartPickerModalProps = {
|
||||
visible: boolean;
|
||||
@@ -119,20 +119,17 @@ export function FastingStartPickerModal({
|
||||
lastAppliedTimestamp.current = recommendedDate.getTime();
|
||||
};
|
||||
|
||||
const pickerIndicatorStyle = useMemo(
|
||||
() => ({
|
||||
backgroundColor: `${colors.primary}12`,
|
||||
borderRadius: 12,
|
||||
}),
|
||||
[colors.primary]
|
||||
);
|
||||
|
||||
const textStyle = {
|
||||
fontSize: 18,
|
||||
fontWeight: '600' as const,
|
||||
color: '#2E3142',
|
||||
};
|
||||
|
||||
// 自定义渲染函数,用于应用文本样式
|
||||
const renderItem = ({ fontSize, label, fontColor, textAlign }: { fontSize: number; label: string; fontColor: string; textAlign: 'center' | 'auto' | 'left' | 'right' | 'justify' }) => (
|
||||
<Text style={[textStyle, { fontSize, color: fontColor, textAlign }]}>{label}</Text>
|
||||
);
|
||||
|
||||
return (
|
||||
<FloatingSelectionCard
|
||||
visible={visible}
|
||||
@@ -148,8 +145,7 @@ export function FastingStartPickerModal({
|
||||
items={dayOptions.map((item) => ({ label: item.label, value: item.offset }))}
|
||||
onChange={({ index }) => setIndexes((prev) => ({ ...prev, dayIndex: index }))}
|
||||
backgroundColor="transparent"
|
||||
itemTextStyle={textStyle}
|
||||
selectedIndicatorStyle={pickerIndicatorStyle}
|
||||
renderItem={renderItem}
|
||||
haptics
|
||||
/>
|
||||
<WheelPickerExpo
|
||||
@@ -160,8 +156,7 @@ export function FastingStartPickerModal({
|
||||
items={HOURS.map((hour) => ({ label: hour.toString().padStart(2, '0'), value: hour }))}
|
||||
onChange={({ index }) => setIndexes((prev) => ({ ...prev, hourIndex: index }))}
|
||||
backgroundColor="transparent"
|
||||
itemTextStyle={textStyle}
|
||||
selectedIndicatorStyle={pickerIndicatorStyle}
|
||||
renderItem={renderItem}
|
||||
haptics
|
||||
/>
|
||||
<WheelPickerExpo
|
||||
@@ -175,8 +170,7 @@ export function FastingStartPickerModal({
|
||||
}))}
|
||||
onChange={({ index }) => setIndexes((prev) => ({ ...prev, minuteIndex: index }))}
|
||||
backgroundColor="transparent"
|
||||
itemTextStyle={textStyle}
|
||||
selectedIndicatorStyle={pickerIndicatorStyle}
|
||||
renderItem={renderItem}
|
||||
haptics
|
||||
/>
|
||||
</View>
|
||||
|
||||
Reference in New Issue
Block a user