react-native-paper-dates icon indicating copy to clipboard operation
react-native-paper-dates copied to clipboard

RTL Support

Open xahmedtaha opened this issue 5 years ago • 6 comments

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

xahmedtaha avatar Jan 13 '21 11:01 xahmedtaha

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

RichardLindhout avatar Jan 18 '21 10:01 RichardLindhout

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

chakrihacker avatar Aug 13 '21 16:08 chakrihacker

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

asherguedalia avatar Oct 10 '21 14:10 asherguedalia

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 avatar Jun 10 '22 12:06 0had0

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

0had0 avatar Jun 10 '22 12:06 0had0