taro-ui icon indicating copy to clipboard operation
taro-ui copied to clipboard

AtCalendar修改props currentDate不渲染问题

Open superchangme opened this issue 3 years ago • 1 comments

问题描述

使用AtCalendar时有动态赋值currentDate的需求,发现修改之后不渲染 复现步骤

// 这里可以贴代码
 <AtCalendar 
            currentDate={this.state.selectDate}
            onSelectDate={this.onSelectDate.bind(this)}
            onDayClick={this.onDayClick.bind(this)}
            onMonthChange={this.onMonthChange.bind(this)}
            marks={this.state.hasDataDateList} 
          />


 onDayClick({value}) {
    let log = console
    log.log('onDayClick')
    const data = formatData(this.state.classList,value)
      this.setState({
        hasData: true,
        currentDayList: data,
        selectDate: +dayjs(value,'YYYY-MM-DD'),
        dayKey:dayjs(value,'YYYY-MM-DD').format('DD'),
        changeCanlendar:!this.state.changeCanlendar
      })
}

期望行为

期望能够日期改变后能成功高亮当前所选日期

报错信息

无报错不渲染 系统信息

👽 Taro v3.4.3

补充信息

我修改了node_modules/taro-ui/lib/components/calendar源码当中UNSAFE_componentWillReceiveProps改为componentWillReceiveProps后可以正常使用

superchangme avatar May 01 '22 07:05 superchangme

欢迎提交 Issue~

如果你提交的是 bug 报告,请务必遵循 Issue 模板的规范,尽量用简洁的语言描述你的问题,最好能提供一个稳定简单的复现。🙏🙏🙏

如果你的信息提供过于模糊或不足,或者已经其他 issue 已经存在相关内容,你的 issue 有可能会被关闭。

Good luck and happy coding~

taro-ui-bot[bot] avatar May 01 '22 07:05 taro-ui-bot[bot]