You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We'll eventually want to support MENA region, which means Arabic/Hebrew which are RTL (right-to-left) languages. We will be happy to contribute.
Beyond supporting bidirectional text wrapping (a challenge for another ticket), RTL users want the whole application layout to also follow the reversed direction. In HTML, it is specified using a dir attribute.
This is important to note that the direction change can't be entirely global: in some cases the direction should NOT be flipped, for instance for the video player transport controls.
Proposal
Reversing the layout direction can be done at the node level:
Introduce a dir or direction property (ltr (default) or rtl),
If not specified, dir should be inherited from the parent node (all children of a rtl node should be rtl),
When dir is rtl, flip the local transforms.
Extra considerations:
Left/Right key events should be locally reversed based on dir,
Left/Right textAlign should be locally reversed based on dir (to be accurate though, we might have to support the equivalent of HTML's auto direction).
Working POC
We could successfully POC the layout reversal with the following change, which should have very minimal impact on application performance:
// CoreNode.ts patchupdateLocalTransform(){assertTruthy(this.scaleRotateTransform);// layout directionletx=this.props.x;letmountX=this.props.mountX;if(this.parent&&this.props.dir==='rtl'){constparentWidth=this.parent.props.width;x=parentWidth-x;mountX=1-mountX;}// rest of localTransform calculations
The text was updated successfully, but these errors were encountered:
Feature description
We'll eventually want to support MENA region, which means Arabic/Hebrew which are RTL (right-to-left) languages. We will be happy to contribute.
Beyond supporting bidirectional text wrapping (a challenge for another ticket), RTL users want the whole application layout to also follow the reversed direction. In HTML, it is specified using a
dir
attribute.This is important to note that the direction change can't be entirely global: in some cases the direction should NOT be flipped, for instance for the video player transport controls.
Proposal
Reversing the layout direction can be done at the node level:
dir
ordirection
property (ltr
(default) orrtl
),dir
should be inherited from theparent
node (all children of artl
node should bertl
),dir
isrtl
, flip the local transforms.Extra considerations:
dir
,textAlign
should be locally reversed based ondir
(to be accurate though, we might have to support the equivalent of HTML'sauto
direction).Working POC
We could successfully POC the layout reversal with the following change, which should have very minimal impact on application performance:
The text was updated successfully, but these errors were encountered: