在react-native-calendars中动态分配某一天的文本内容

问题描述 投票:0回答:1

例如。当我点击日期“3月7日”时,文本“21天”将在21天后的日历日期而不是“3月28日”出现。

enter image description here

react-native
1个回答
2
投票

您可能应该根据需要创建新的Day Component。

  1. 您可以在react本机日历中创建一个新的Day Component:react-native-calendars / src / calendar / day /
  2. 您可以使用react本机日历的API创建一个新的Day Component,在这里查看文档https://github.com/wix/react-native-calendars#overriding-day-component: dayComponent = {({date,state})=> {return(customDayComponent); }}

或者,如果没有日期组件,您将必须获得所需日期的左侧和顶部位置,并在当天放置一个重叠的视图(位置:'绝对',zIndex:1)。

© www.soinside.com 2019 - 2024. All rights reserved.