Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add RTL Support to TimeSelector Component #131

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

neriyaco
Copy link

Add RTL Support to TimeSelector Component

Description

This PR introduces support for right-to-left (RTL) layouts in the TimeSelector component of the library. The flexDirection of the timePickerContainer style now dynamically adapts based on the current RTL setting, ensuring proper alignment for RTL users.

Changes

  • Imported I18nManager from react-native.
  • Updated the timePickerContainer style to set flexDirection dynamically:
    • row-reverse for RTL layouts.
    • row for LTR layouts.

Benefits

  • Improves accessibility and user experience for RTL language users by properly aligning the component's layout.

Testing

  • Verified the component's behavior in both RTL (I18nManager.forceRTL(true)) and LTR modes.
  • Confirmed that the alignment and layout are correct in each case.

Breaking Changes

  • None. This change is backward-compatible with existing LTR layouts.

@neriyaco neriyaco changed the title Update TimeSelector.tsx Add RTL Support to TimeSelector Component Nov 24, 2024
@@ -69,7 +69,7 @@ const styles = StyleSheet.create({
flex: 1,
},
timePickerContainer: {
flexDirection: 'row',
flexDirection: I18nManager.getConstants().isRTL ? 'row-reverse' : 'row',

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of row-reverse, it should apply the direction: "rtl" to the parent probably.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't change the direction of the component

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants