import React, { useState } from 'react'; import { Text, View } from 'react-native'; import { Calendar, DateData } from '@xrnjs/ui'; import dayjs from 'dayjs'; import { styles } from './style'; const CustomThemeDemo = () => { const formatter = 'YYYY-MM-DD'; const [selectedDate, setSelectedDate] = useState( dayjs().format(formatter) ); const onSelect = (current: DateData) => { setSelectedDate(current?.dateString); }; const customTheme = { calendarBackground: '#f0f8ff', headerHeight: 50, knob: { backgroundColor: '#4169e1', }, selectedDayBackgroundColor: '#4169e1', selectedDayTextColor: '#ffffff', todayTextColor: '#4169e1', dayTextColor: '#333333', textDisabledColor: '#cccccc', dotColor: '#4169e1', selectedDotColor: '#ffffff', }; return ( 自定义主题 选中日期: {selectedDate} ); }; export default CustomThemeDemo;