【问题标题】:Render image on each date using react-native-calendars使用 react-native-calendars 在每个日期渲染图像
【发布时间】:2021-09-24 17:07:55
【问题描述】:

我有一个用例,我必须在每个日期渲染一张图像。最初,我在考虑react-native-calendar,但找不到任何有用的东西。在这里,我将附上我想要实现的屏幕截图。

【问题讨论】:

    标签: react-native react-native-calendars


    【解决方案1】:

    根据文档,您可以使用 dayComponent 属性覆盖 component

    <Calendar
      style={[styles.calendar, {height: 300}]}
      dayComponent={({date, state}) => {
        return (
          <View>
            <Text style={{textAlign: 'center', color: state === 'disabled' ? 'gray' : 'black'}}>
              {date.day}
            </Text>
          </View>
        );
      }}
    />
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-03-23
      • 1970-01-01
      • 2023-01-04
      • 2019-11-21
      • 1970-01-01
      • 2022-01-02
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多