Skip to content
This repository has been archived by the owner on Feb 25, 2020. It is now read-only.

Commit

Permalink
fix: gesture vertical inverted (#281)
Browse files Browse the repository at this point in the history
  • Loading branch information
osdnk authored Nov 5, 2019
1 parent c10bd88 commit 34f3c51
Showing 1 changed file with 23 additions and 10 deletions.
33 changes: 23 additions & 10 deletions src/views/Stack/Card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -412,18 +412,25 @@ export default class Card extends React.Component<Props> {
cond(
eq(this.props.current, isVisible),
call(
[this.didMovementHappen, this.isVisible],
([didMovementHappen]: ReadonlyArray<Binary>) => {
[this.didMovementHappen, isVisible],
([didMovementHappen, isVisibleVal]: ReadonlyArray<
Binary | number
>) => {
if (didMovementHappen) {
// if we go back to the same position,
// let's pretend that whole animation happen
// for making the logic consistent
// It's especially vital for having inputs properly focused.
this.handleStartInteraction();
const { onTransitionStart } = this.props;
onTransitionStart && onTransitionStart({ closing: false });
onTransitionStart &&
onTransitionStart({ closing: !isVisibleVal });
this.handleTransitionEnd();
this.props.onOpen(true);
if (isVisibleVal) {
this.props.onOpen(true);
} else {
this.props.onClose(true);
}
}
}
),
Expand Down Expand Up @@ -514,7 +521,6 @@ export default class Card extends React.Component<Props> {
call([this.isVisible], ([value]: ReadonlyArray<Binary>) => {
const isOpen = Boolean(value);
const { onOpen, onClose } = this.props;

this.handleTransitionEnd();

if (isOpen) {
Expand Down Expand Up @@ -544,14 +550,18 @@ export default class Card extends React.Component<Props> {
this.gestureUntraversed,
I18nManager.isRTL ? MINUS_ONE_NODE : TRUE_NODE
),
this.gestureUntraversed
multiply(this.gestureUntraversed, this.verticalGestureDirection)
)
),
set(
this.velocity,
multiply(
this.velocityUntraversed,
I18nManager.isRTL ? MINUS_ONE_NODE : TRUE_NODE
cond(
eq(this.direction, DIRECTION_HORIZONTAL),
multiply(
this.velocityUntraversed,
I18nManager.isRTL ? MINUS_ONE_NODE : TRUE_NODE
),
multiply(this.velocityUntraversed, this.verticalGestureDirection)
)
),
onChange(
Expand Down Expand Up @@ -636,7 +646,10 @@ export default class Card extends React.Component<Props> {
this.gestureUntraversed,
I18nManager.isRTL ? MINUS_ONE_NODE : TRUE_NODE
),
this.gestureUntraversed
multiply(
this.gestureUntraversed,
this.verticalGestureDirection
)
),
this.distance
),
Expand Down

0 comments on commit 34f3c51

Please sign in to comment.