iOS Slide open main sidebar from anywhere (#3859)

This commit is contained in:
Elias Nahum 2020-01-27 23:53:16 -03:00 committed by Miguel Alatzar
parent ff13f3e612
commit 2765d1b06b

View file

@ -417,7 +417,11 @@ export default class DrawerLayout extends Component {
return true;
}
} else {
if (moveX <= 35 && dx > 0) {
const filter = Platform.select({
ios: moveX > 0 && dx > 35,
android: moveX <= 35 && dx > 0
});
if (filter) {
this._isClosing = false;
return true;
}
@ -449,8 +453,9 @@ export default class DrawerLayout extends Component {
this._emitStateChanged(DRAGGING);
};
_panResponderMove = (e: EventType, { moveX }: PanResponderEventType) => {
let openValue = this._getOpenValueForX(moveX);
_panResponderMove = (e: EventType, { moveX, dx }: PanResponderEventType) => {
const useDx = Platform.OS === 'ios' && this.getDrawerPosition() === 'left';
let openValue = this._getOpenValueForX(useDx ? dx : moveX);
if (this._isClosing) {
openValue = 1 - (this._closingAnchorValue - openValue);