简体   繁体   English

react-native-calendars ExpandableCalendar 在本机反应中不能与 RTL 一起正常工作

[英]react-native-calendars ExpandableCalendar not worknig propely with RTL in react native

I'm trying to use ExpandableCalendar from https://github.com/wix/react-native-calendars我正在尝试使用https://github.com/wix/react-native-calendars中的 ExpandableCalendar

my App set to RTL ReactNative.I18nManager.allowRTL(true); ReactNative.I18nManager.forceRTL(true);我的应用程序设置为 RTL ReactNative.I18nManager.allowRTL(true); ReactNative.I18nManager.forceRTL(true); ReactNative.I18nManager.allowRTL(true); ReactNative.I18nManager.forceRTL(true);

when the calendar is expanded and I'm trying to change the month it doesn't show new dates of next month or prev month, it's just showing name of the month that different from the header month.当日历展开并且我试图更改月份时,它不会显示下个月或上个月的新日期,它只是显示与 header 月份不同的月份名称。

however setting RTL to false fixes the problem.但是将 RTL 设置为 false 可以解决问题。 is there some solution without setting RTL to false?有没有将 RTL 设置为 false 的解决方案?

image after changing month by swiping right/left or by clicking on arrows to change month:通过向右/向左滑动或单击箭头更改月份来更改月份后的图像:

在此处输入图像描述

This is a known issue with react-native-calendars .这是react-native-calendars的一个已知问题。 It is not able to render the child components (the dates) properly or is just ignoring it when ReactNative.I18nManager.allowRTL(true);它无法正确呈现子组件(日期),或者在ReactNative.I18nManager.allowRTL(true);时忽略它. .

For now, the temporary solution is to change the flex-direction to row-reverse and rendering the arrows in the opposite direction:目前,临时解决方案是将 flex-direction 更改为row-reverse并将箭头呈现在相反方向:

<Calendar theme={'stylesheet.calendar.main': {
                        week: {
                          marginTop: 7,
                          marginBottom: 7,
                          flexDirection: isRTL ? 'row-reverse' : 'row',
                          justifyContent: 'space-around'
                        }
                       },
                  'stylesheet.calendar.header': {
                        header: {
                           flexDirection: isRTL ? 'row-reverse' : 'row',
                          justifyContent: 'space-between',
                          paddingLeft: 10,
                          paddingRight: 10,
                          alignItems: 'center',
                          height: 45
                        },
                        week: {
                          marginTop: 7,
                           flexDirection: isRTL ? 'row-reverse' : 'row',
                          justifyContent: 'space-around'
                        }}
                      }}
            renderArrow={direction => <Icon type="ionicon"
                                            name={direction === 'left'
                                               ? (isRTL ? 'arrow-forward' : 'arrow-back')
                                               : (isRTL ? 'arrow-back' : 'arrow-forward')}
                                               />}
    />

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何向 react-native-calendars 中的 Agenda 组件添加功能 - How to add functionality to the Agenda component in react-native-calendars 需要帮助弄清楚我的数据操作/道具传递 React-Native/react-native-calendars - Need help figuring out my data manipulation/prop passing React-Native/react-native-calendars 如何动态更改 react-native-calendars 的 items 道具中日期键的日期 - How to dynamically change the date for the date key in the items prop for react-native-calendars react-native-calendars npm 模块的 CalendarList 组件中的日历天在正常模式下似乎被禁用/变灰,但在调试模式下工作正常 - Calendar days in CalendarList component of react-native-calendars npm module seems disabled/grayed out in normal mode but works fine in debug mode 反应原生的 RTL 支持 - RTL support on react native 在 React Native 日历中突出显示按下(选定)日期 - Highlight pressed(selected) date in React Native Calendars Firestore 没有从反应本机日历中获取字符串 - Firestore not getting string from react native calendars 如何在反应本机日历中设置多个选定的日期颜色? - How to set multiple selected date colors in react native calendars? 如何强制反应本机应用程序只是 RTL? 对于 Android 和 iOS - How to force react native app to be just RTL? for both Android and iOS React-Native日历:当按下一天时,将日期传递到自定义函数中 - React-Native Calendars: Pass date into custom function when a day is pressed
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM