禁用全局的KendoReact日历快速导航栏

huangapple go评论112阅读模式
英文:

Disable the KendoReact Calendar Fast Navigation Bar globally

问题

KendoReact Calendar Fast Navigation Bar目前在支持React 18的所有KendoReact版本中存在问题,详见此GitHub问题

我们正在通过禁用Calendar Fast Navigation Bar来解决此问题。这对于简单的孤立组件(如DatePickers)是一个合适的解决方案,但不幸的是对于例如KendoReact Grid筛选菜单等问题无济于事。请参见此StackBlitz以查看问题的工作示例。

是否有一种全局禁用Calendar Fast Navigation Bar的方法,以便我们不必在每个地方应用这个并创建自定义Grid筛选器?

英文:

The KendoReact Calendar Fast Navigation Bar is currently broken in all versions of KendoReact that support React 18 as per this GitHub issue.

We are working around the issue by disabling the Calendar Fast Navigation Bar. This is a suitable workaround for simple isolated components such as DatePickers, but unfortunately does nothing to address the issue in for example KendoReact Grid filter menus. See this StackBlitz for a working example of the issue.

Is there a way to globally disable the Calendar Fast Navigation Bar so we don't have to apply this everywhere and create custom Grid filters?

答案1

得分: 0

这可以通过使用 CalendarPropsContext 来实现,具体描述请参考这里

例如:

const calendarProps = React.useCallback(
    (calendarProps: CalendarProps) => ({
      ...calendarProps,
      navigation: false,      
    }),
    []
  );

return (
    <CalendarPropsContext.Provider value={calendarProps}>
      ...
    </CalendarPropsContext.Provider>
  );
英文:

This can be done using the CalendarPropsContext as described here.

e.g.

const calendarProps = React.useCallback(
    (calendarProps: CalendarProps) =&gt; ({
      ...calendarProps,
      navigation: false,      
    }),
    []
  );

return (
    &lt;CalendarPropsContext.Provider value={calendarProps}&gt;
      ...
    &lt;/CalendarPropsContext.Provider&gt;
  );

huangapple
  • 本文由 发表于 2023年5月15日 13:44:47
  • 转载请务必保留本文链接:https://go.coder-hub.com/76251162.html
  • kendo-react-ui
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定