react-native-drawer-layout
react-native-drawer-layout copied to clipboard
Does not work correctly in right to left (RTL) mode
When used with right to left language (RTL), such as Hebrew or Arabic, the drawer is displayed incorrectly.
To force RTL mode, add the following to your index.*.js import {I18nManager} from 'react-native';
I18nManager.forceRTL(true)
Can you specify "incorrectly" a bit? You can set the drawer open mode to the other side, but I guess that isn't what you want to do, right?
I fixed the problem, I would like to create a pull request and push the fix. However for some reason I have no permissions
Hi!
I added a pull request with my fix. When in RTL mode, the X coordinates are swapped (0 is on the right side). So most of the things just work (although it is a bad habit to call things right or left, since in RTL mode, these names are really confusing since right is on the left and left is on the right).
Yuval
On Tue, 4 Apr 2017 at 00:30 Daniel Schmidt [email protected] wrote:
Can you specify "incorrectly" a bit? You can set the drawer open mode to the other side, but I guess that isn't what you want to do, right?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/react-native-community/react-native-drawer-layout/issues/29#issuecomment-291280126, or mute the thread https://github.com/notifications/unsubscribe-auth/ACyQFCMjRsgYnWI0WAxi1U9JMcHtuDKvks5rsWT_gaJpZM4MyFCR .
Thank you for the PR, I will give it a try 👍
Using react-navigation which is using this package, The drawer is in the middle of the screen instead of in hiding on initial state. On DrawerOpen
it is in the correct state, but on close this is how it looks like. @DanielMSchmidt
@annelorraineuy, The react-navigation
uses the old version of react-native-drawer-layout
(v1.2.0
), your problem was fixed in this PR (v1.3.0
).
You can use my react-navigation
fork for a while until the RTL issue will be resolved:
npm install -S git+https://github.com/dastoori/react-navigation.git#3616d9e
@dastoori thanks! you're right. it is fixed now
In 1.3.2 it now works for me in iOS, but the behaviour on Android seems more broken than in earlier versions ...
On RTL Android with v1.1.0, the first time you opened the drawer it would open from the wrong side of the screen but would move all the way across the screen and end up in the correct open position, then when you closed it it would slide away correctly. After that initial funny, the drawer would work as expected regardless of system directionality.
However, on RTL Android with 1.3.2, the drawer is now partially visible on the screen when "closed" and ignores the drawerPosition
prop (drawer is always at the left side of the screen on RTL android).
@steveliles Might be that you would want to switch to react-native-drawer-layout-polyfill we use the native drawer there for android.
I would also love to accept a PR for that, but I currently don't have the time to put more love into this 😞
@DanielMSchmidt thanks for the tip - I wasn't aware of drawer-layout-polyfill
We appreciate the time you already put in :) ... will submit a PR if I can find some time.
[edit] - drawer-layout-polyfill has solved the problem for me, thx!