mirror of
https://github.com/zhigang1992/react-navigation.git
synced 2026-04-29 04:45:19 +08:00
fix: gesture vertical inverted (#281)
This commit is contained in:
@@ -412,8 +412,10 @@ export default class Card extends React.Component<Props> {
|
|||||||
cond(
|
cond(
|
||||||
eq(this.props.current, isVisible),
|
eq(this.props.current, isVisible),
|
||||||
call(
|
call(
|
||||||
[this.didMovementHappen, this.isVisible],
|
[this.didMovementHappen, isVisible],
|
||||||
([didMovementHappen]: ReadonlyArray<Binary>) => {
|
([didMovementHappen, isVisibleVal]: ReadonlyArray<
|
||||||
|
Binary | number
|
||||||
|
>) => {
|
||||||
if (didMovementHappen) {
|
if (didMovementHappen) {
|
||||||
// if we go back to the same position,
|
// if we go back to the same position,
|
||||||
// let's pretend that whole animation happen
|
// let's pretend that whole animation happen
|
||||||
@@ -421,9 +423,14 @@ export default class Card extends React.Component<Props> {
|
|||||||
// It's especially vital for having inputs properly focused.
|
// It's especially vital for having inputs properly focused.
|
||||||
this.handleStartInteraction();
|
this.handleStartInteraction();
|
||||||
const { onTransitionStart } = this.props;
|
const { onTransitionStart } = this.props;
|
||||||
onTransitionStart && onTransitionStart({ closing: false });
|
onTransitionStart &&
|
||||||
|
onTransitionStart({ closing: !isVisibleVal });
|
||||||
this.handleTransitionEnd();
|
this.handleTransitionEnd();
|
||||||
this.props.onOpen(true);
|
if (isVisibleVal) {
|
||||||
|
this.props.onOpen(true);
|
||||||
|
} else {
|
||||||
|
this.props.onClose(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
@@ -514,7 +521,6 @@ export default class Card extends React.Component<Props> {
|
|||||||
call([this.isVisible], ([value]: ReadonlyArray<Binary>) => {
|
call([this.isVisible], ([value]: ReadonlyArray<Binary>) => {
|
||||||
const isOpen = Boolean(value);
|
const isOpen = Boolean(value);
|
||||||
const { onOpen, onClose } = this.props;
|
const { onOpen, onClose } = this.props;
|
||||||
|
|
||||||
this.handleTransitionEnd();
|
this.handleTransitionEnd();
|
||||||
|
|
||||||
if (isOpen) {
|
if (isOpen) {
|
||||||
@@ -544,14 +550,18 @@ export default class Card extends React.Component<Props> {
|
|||||||
this.gestureUntraversed,
|
this.gestureUntraversed,
|
||||||
I18nManager.isRTL ? MINUS_ONE_NODE : TRUE_NODE
|
I18nManager.isRTL ? MINUS_ONE_NODE : TRUE_NODE
|
||||||
),
|
),
|
||||||
this.gestureUntraversed
|
multiply(this.gestureUntraversed, this.verticalGestureDirection)
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
set(
|
set(
|
||||||
this.velocity,
|
this.velocity,
|
||||||
multiply(
|
cond(
|
||||||
this.velocityUntraversed,
|
eq(this.direction, DIRECTION_HORIZONTAL),
|
||||||
I18nManager.isRTL ? MINUS_ONE_NODE : TRUE_NODE
|
multiply(
|
||||||
|
this.velocityUntraversed,
|
||||||
|
I18nManager.isRTL ? MINUS_ONE_NODE : TRUE_NODE
|
||||||
|
),
|
||||||
|
multiply(this.velocityUntraversed, this.verticalGestureDirection)
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
onChange(
|
onChange(
|
||||||
@@ -636,7 +646,10 @@ export default class Card extends React.Component<Props> {
|
|||||||
this.gestureUntraversed,
|
this.gestureUntraversed,
|
||||||
I18nManager.isRTL ? MINUS_ONE_NODE : TRUE_NODE
|
I18nManager.isRTL ? MINUS_ONE_NODE : TRUE_NODE
|
||||||
),
|
),
|
||||||
this.gestureUntraversed
|
multiply(
|
||||||
|
this.gestureUntraversed,
|
||||||
|
this.verticalGestureDirection
|
||||||
|
)
|
||||||
),
|
),
|
||||||
this.distance
|
this.distance
|
||||||
),
|
),
|
||||||
|
|||||||
Reference in New Issue
Block a user