-
-
Notifications
You must be signed in to change notification settings - Fork 409
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 with dynamic right & left properties #70
base: master
Are you sure you want to change the base?
Conversation
tooltip.right = tooltip.right === 0 ? tooltip.right + MARGIN : tooltip.right; | ||
tooltip.maxWidth = layout.width - tooltip.right - MARGIN; | ||
arrow.right = tooltip.right + MARGIN; | ||
tooltip[end] = Math.max(layout.width - (obj.left + obj.width), 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason you changed the syntax, instead of using tooltip.end
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The bracket notation is for computed keys. tooltip.end = 1;
results in { end: 1 }
whereas const end = 'left'; tooltip[end] = 1
gives { left: 1 }
, unless I misunderstood your question.
@@ -78,23 +83,23 @@ class ViewMask extends Component<Props, State> { | |||
style={[ | |||
styles.overlayRectangle, | |||
{ | |||
right: leftOverlayRight, | |||
[end]: leftOverlayRight, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this change of syntax, again? How do the brackets help?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@RichardLitt
This syntax reaches the variable instead of the stable key, so the 'end' variable may switch depending on the LTR or RTL orientations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this PR, @iamsoorena! Made a few small comments.
Hi @RichardLitt ,
So If I used We can refactor usage of |
@iamsoorena Thanks! I'm on a vacation right now. I'll test and review this next week. |
@iamsoorena Sorry for the delay on reviewing this. This looks really good! Thank you. I'm just curious if it is possible to programmatically switch the direction. For example, when changing the language within the app's settings (English -> Farsi -> English). I couldn't find any function for switching back to LTR on |
This looks good to me. I would just like to know if the programmatic change of direction is a possibility. In that case, we would have to move the RTL check (Line 48-50) into the |
@mohebifar I've not used or implemented this feature before. I don't know about this. 😀 |
@mohebifar As far as I know, using |
@mohebifar First I think you mean #71. |
@iamsoorena Thanks for letting us know, @iamsoorena. Sorry about the delay - we don't have unlimited time to work on this repository. :) |
@RichardLitt no problem. |
@iamsoorena Just wanted to follow up with you to see if you want still would like to:
|
@mohebifar once again I'm sorry for my slow responds. |
Can someone please merge this PR. It's look good to me as well. |
This PR resolves this issue.
I've checked result of this PR with both RTL and LTR apps.
It works as expected in both situations.
LTR
(default):RTL
: