首页 > 解决方案 > 按下时如何更改选定的日期背景颜色

问题描述

我尝试过使用 selectedDayBackgroundColor。但它不起作用。当按下 selDate 时,背景颜色应该会改变。

                <Calendar style={{
                    borderRadius: 20,
                    height: 370,
                    marginTop: -1,
                    width: 350,
                    borderTopLeftRadius: 0,
                    borderTopRightRadius: 0

                }} enableSwipeMonths={true}
                onDayPress={(date) => {
                    (date)
                    const currentDate = Moment(date.dateString).add(1, "days").toISOString();
                    dispatch(getEvents(currentDate));
                    dispatch(getOnLeaveDeveloper(currentDate))
                    setCurrentDateToday(currentDate);
                    // @ts-ignore
                    setSelDate(currentDate);
                    console.log(selDate);
                }
                }
                theme={{
                    todayTextColor: "#FFFFFF",
                    monthTextColor: "#FFFFFF",
                    textColor: "#FFFFFF",
                    arrowColor: "#FFFFFF",
                    dayTextColor: "white",
                    calendarBackground: "#171717",
                    textDayFontSize: 10,
                }}
            />

标签: reactjstypescript

解决方案


推荐阅读