mirror of
https://github.com/zhigang1992/react-navigation.git
synced 2026-04-30 21:32:14 +08:00
fix: spring was not triggered sometimes on tap (#67)
Co-Authored-By: Satyajit Sahoo <satyajit.happy@gmail.com>
This commit is contained in:
committed by
satyajit.happy
parent
3f64539cee
commit
8bbddb21bc
@@ -243,6 +243,8 @@ export default class DrawerView extends React.PureComponent<Props> {
|
||||
|
||||
private isStatusBarHidden: boolean = false;
|
||||
|
||||
private isSpringManuallyTriggered = new Value<Binary>(FALSE);
|
||||
|
||||
private transitionTo = (isOpen: number | Animated.Node<number>) => {
|
||||
const toValue = new Value(0);
|
||||
const frameTime = new Value(0);
|
||||
@@ -347,6 +349,7 @@ export default class DrawerView extends React.PureComponent<Props> {
|
||||
cond(
|
||||
eq(this.gestureState, State.ACTIVE),
|
||||
[
|
||||
set(this.isSpringManuallyTriggered, FALSE),
|
||||
cond(this.isSwiping, NOOP, [
|
||||
// We weren't dragging before, set it to true
|
||||
set(this.isSwiping, TRUE),
|
||||
@@ -365,6 +368,9 @@ export default class DrawerView extends React.PureComponent<Props> {
|
||||
set(this.isSwiping, FALSE),
|
||||
set(this.touchX, 0),
|
||||
this.transitionTo(
|
||||
cond(
|
||||
this.isSpringManuallyTriggered,
|
||||
this.isOpen,
|
||||
cond(
|
||||
or(
|
||||
and(
|
||||
@@ -388,6 +394,7 @@ export default class DrawerView extends React.PureComponent<Props> {
|
||||
),
|
||||
this.isOpen
|
||||
)
|
||||
)
|
||||
),
|
||||
]
|
||||
),
|
||||
@@ -441,6 +448,7 @@ export default class DrawerView extends React.PureComponent<Props> {
|
||||
|
||||
private toggleDrawer = (open: boolean) => {
|
||||
this.nextIsOpen.setValue(open ? TRUE : FALSE);
|
||||
this.isSpringManuallyTriggered.setValue(TRUE);
|
||||
|
||||
// This value will also be set shortly after as changing this.nextIsOpen changes this.isOpen
|
||||
// However, there's a race condition on Android, so we need to set a bit earlier
|
||||
|
||||
Reference in New Issue
Block a user