web-ridge / react-native-paper-dates

Smooth and fast cross platform Material Design date and time picker for React Native Paper
https://www.reactnativepaperdates.com
MIT License
658 stars 170 forks source link

RTL Support #36

Open xahmedtaha opened 3 years ago

xahmedtaha commented 3 years ago

Hello! Thanks for the awesome package. do you plan on adding proper rtl support soon? the selection indicator is flipped and and selection using mouse is reversed (if I click on 45 it chooses 15 and vice versa) Screenshot from 2021-01-13 13-22-47

RichardLindhout commented 3 years ago

Ah we should fix this. Could you maybe do a PR for this?

chakrihacker commented 3 years ago

Is there a spec on how it should look on RTL?

asherguedalia commented 2 years ago

Hi is there a suggestion yet how to fix this? I also ran into the same issue

0had0 commented 2 years ago

inputContainer: {
-    flexDirection: 'row',
+    flexDirection: I18nManager.isRTL ? 'row-reverse' : 'row',
     alignItems: 'center',
   },

inside /node_modules/react-native-paper-dates/src/Time/TimePicker.tsx

#######################################

getMinuteNumbers(size: number, count: number) {
   return Array(12)
     .fill(true)
     .map(() => {
-      let x = Math.round(size / 2 + radius * Math.cos(angle))
+      let x = Math.round(I18nManager.isRTL ? size / 2 - radius * Math.cos(angle) :  size / 2 + radius * Math.cos(angle))

inside /node_modules/react-native-paper-dates/src/Time/DisplayModeContext.tsx

#######################################

getHourNumbers(
   return Array(arrayLength)
     .fill(true)
     .map(() => {
-      let x = Math.round(size / 2 + radius * Math.cos(angle))
+      let x = Math.round(I18nManager.isRTL ?  size / 2 - radius * Math.cos(angle) :  size / 2 + radius * Math.cos(angle))

inside /node_modules/react-native-paper-dates/src/Time/AnalogClockMinutes.tsx
0had0 commented 2 years ago

don't forget to import I18nManager from react-native in each file

github-actions[bot] commented 3 weeks ago

Hey! Thanks for opening the issue. Can you provide more information about the issue? Please fill the issue template when opening the issue without deleting any section. We need all the information we can, to be able to help. Make sure to at least provide - Current behaviour, Expected behaviour, A way to reproduce the issue with minimal code (link to snack.expo.dev) or a repo on GitHub, and the information about your environment (such as the platform of the device, versions of all the packages etc.).