root-two / react-native-drawer

React Native Drawer
MIT License
2.54k stars 391 forks source link

fix drawer side "right" margin progressively increase #352

Closed mtiziano closed 5 years ago

mtiziano commented 6 years ago

also reported here https://github.com/root-two/react-native-drawer/issues/349

mstf0ta-app commented 6 years ago

thank you very much . this solve my problem too

ItsNoHax commented 6 years ago

Not a good fix, still breaks on iPhone PLUS or iPhone X models.

mtiziano commented 6 years ago

Thanks @ItsNoHax, it was a problem handling onPanResponderMove. Now it should be fine

engorila commented 6 years ago

I don't understand your solution... and it not run on iPad.

To fix all you have to change updatePosition method. Add Math.round inside switch (in my case overlay):

drawerProps[this.props.side] = Math.round(-this.getDeviceLength() + this._offsetOpen + this._length)

ItsNoHax commented 6 years ago

@engorila Your fix doesn't work either, it still happens eventhough at a much smaller pace. I don't see how a Math.round can be a proper fix. I feel like you guys are programming by guessing.

gersonmontenegro commented 6 years ago

@engorila thanks, works fine for me, even in real devices like iPhone 5 and iPad mini, as in emulators.

SupriyaKalghatgi commented 6 years ago

@rt2zz When can we get this merged?

amitmaurya0 commented 6 years ago

can any one tell me how and where to implement this updatePosition ?

anjalsan commented 6 years ago

@SupriyaKalghatgi When this fix reflect on nativebase?

anjalsan commented 6 years ago

@amitmaurya0 inside node_modules/react-native-drawer/index.js line number 210 in the latest version. you can change that line with this drawerProps[this.props.side] = Math.round(-this.getDeviceLength() + this._offsetOpen + this._length)

sdg9 commented 6 years ago

For what it's worth I did a git bisect between the react-native 0.54.x and 0.55.x and found that this commit in React Native is what causes the problem, at least when testing on iPhone X simulator. I don't have a solution yet.

madyankin commented 6 years ago

@rt2zz pleeeeease!

roycclu commented 6 years ago

Have tried @numez and @anjalsan . Works on most models. Doesn't work on iPhoneX. It reduces the problem to a much slower pace, but still there.

Only appears on RN 0.55, so reverting back to RN.0.54. Can anyone confirm if this still an issue in RN 0.56?

madyankin commented 6 years ago

@roycclu you can try my fork https://github.com/outpunk/react-native-drawer.

roycclu commented 6 years ago

@outpunk sure will try. Can you make a PR so it's obvious to see the changes you made against main repository? Thanks.

madyankin commented 6 years ago

@roycclu Actually, I did ;) https://github.com/root-two/react-native-drawer/pulls/outpunk

roycclu commented 6 years ago

@outpunk dood, doesn't work. looks like the only change you made was line 30 in tweener.js

this._config.onFrame(Math.round(tweenVal));

Problem still present on iPhoneX, just to a smaller degree

madyankin commented 6 years ago

@roycclu Can the bug be reproduced in iOS simulator?

nguyenvanphuc2203 commented 6 years ago

any update ?

roycclu commented 6 years ago

The bug can be repro in simulator. Currently I reverted down to RN 53. (RN54 also works.)

To repro, make a horizontal listview in the main page, and as you open and close drawer, the cells in the listview shrink.

Currently busy with our app launch. Will try making a repro when I have time. But yea problem is fairly obvious.

madyankin commented 6 years ago

@roycclu It would be nice to have one. I'm a bit busy to tackle this now, but I have to support iPhone X, too. So I'll dig into this later if nobody solves the issue until then.

uc-asa commented 6 years ago

drawerProps[this.props.side] = Math.round(-this.getDeviceLength() + this._offsetOpen + this._length)

That's work for me.

Thanks @amitmaurya0

jdestep93 commented 5 years ago

Works well thanks @amitmaurya0

irqequirecoffee commented 5 years ago

Just stopping by to say thanks to @amitmaurya0, this fix worked for me as well.

rt2zz commented 5 years ago

thanks @amitmaurya0 !

predator-1 commented 5 years ago

You can make even openDrawerOffset. I had openDrawerOffset={0.33} and it has bug. But openDrawerOffset={0.34} all ok

adnan1naeem commented 5 years ago

@anjalsan solution is working fine please release new version with the prescribed solution

chiasheang commented 5 years ago

@amitmaurya0 inside node_modules/react-native-drawer/index.js line number 210 in the latest version. you can change that line with this drawerProps[this.props.side] = Math.round(-this.getDeviceLength() + this._offsetOpen + this._length)

Works on most models. Doesn't work on iPhoneX and iPhone Plus models when I set openDrawerOffset = {0.3} and open it for more than 7 times But working fine if I set openDrawerOffset = {0.28}

Hope someone can figure out what are the problems.