mirror of
https://github.com/status-im/react-native.git
synced 2025-01-10 09:35:48 +00:00
c658cc545f
Summary: Hi folks ! 🔧 Fix the navigation card stack pan responder when the `vertical` direction is enabled. **Issue:** When using a `ScrollView` with the `vertical` direction enabled, the pan handler catch the gesture before the `ScrollView`. I don't know why there was no default value here for `RESPOND_POSITION_MAX_VERTICAL` 5162eb32546b42a017adac1e1bf9b4196affc7c5 ericvicenti could you tell me what you think about setting a default value for `RESPOND_POSITION_MAX_VERTICAL` ? 😃 Thanks !! **EDIT June 15, 2016** I'll update this PR this week end to provide a way to give custom values as there is no magic value for `RESPOND_POSITION_MAX_VERTICAL` **EDIT June 24, 2016** I've added a props `gestureResponseDistance` to control both the `RESPOND_POSITION_MAX_VERTICAL` and `RESPOND_POSITION_MAX_HORIZONTAL` Closes https://github.com/facebook/react-native/pull/8076 Differential Revision: D3605973 Pulled By: ericvicenti fbshipit-source-id: 158d88cf8ebbab742bf0b38c217ae502e9dd1963
120 lines
3.2 KiB
JavaScript
120 lines
3.2 KiB
JavaScript
/**
|
|
* Copyright (c) 2015-present, Facebook, Inc.
|
|
* All rights reserved.
|
|
*
|
|
* This source code is licensed under the BSD-style license found in the
|
|
* LICENSE file in the root directory of this source tree. An additional grant
|
|
* of patent rights can be found in the PATENTS file in the same directory.
|
|
*
|
|
* @providesModule NavigationTypeDefinition
|
|
* @flow
|
|
*/
|
|
'use strict';
|
|
|
|
const Animated = require('Animated');
|
|
|
|
// Object Instances
|
|
|
|
export type NavigationAnimatedValue = Animated.Value;
|
|
|
|
// Value & Structs.
|
|
|
|
export type NavigationGestureDirection = 'horizontal' | 'vertical';
|
|
|
|
export type NavigationRoute = {
|
|
key: string,
|
|
title?: string
|
|
};
|
|
|
|
export type NavigationState = {
|
|
index: number,
|
|
routes: Array<NavigationRoute>,
|
|
};
|
|
|
|
export type NavigationLayout = {
|
|
height: NavigationAnimatedValue,
|
|
initHeight: number,
|
|
initWidth: number,
|
|
isMeasured: boolean,
|
|
width: NavigationAnimatedValue,
|
|
};
|
|
|
|
export type NavigationScene = {
|
|
index: number,
|
|
isActive: boolean,
|
|
isStale: boolean,
|
|
key: string,
|
|
route: NavigationRoute,
|
|
};
|
|
|
|
export type NavigationTransitionProps = {
|
|
// The layout of the transitioner of the scenes.
|
|
layout: NavigationLayout,
|
|
|
|
// The navigation state of the transitioner.
|
|
navigationState: NavigationState,
|
|
|
|
// The progressive index of the transitioner's navigation state.
|
|
position: NavigationAnimatedValue,
|
|
|
|
// The value that represents the progress of the transition when navigation
|
|
// state changes from one to another. Its numberic value will range from 0
|
|
// to 1.
|
|
// progress.__getAnimatedValue() < 1 : transtion is happening.
|
|
// progress.__getAnimatedValue() == 1 : transtion completes.
|
|
progress: NavigationAnimatedValue,
|
|
|
|
// All the scenes of the transitioner.
|
|
scenes: Array<NavigationScene>,
|
|
|
|
// The active scene, corresponding to the route at
|
|
// `navigationState.routes[navigationState.index]`.
|
|
scene: NavigationScene,
|
|
|
|
// The gesture distance for `horizontal` and `vertical` transitions
|
|
gestureResponseDistance?: ?number,
|
|
};
|
|
|
|
// Similar to `NavigationTransitionProps`, except that the prop `scene`
|
|
// represents the scene for the renderer to render.
|
|
export type NavigationSceneRendererProps = NavigationTransitionProps;
|
|
|
|
export type NavigationPanPanHandlers = {
|
|
onMoveShouldSetResponder: Function,
|
|
onMoveShouldSetResponderCapture: Function,
|
|
onResponderEnd: Function,
|
|
onResponderGrant: Function,
|
|
onResponderMove: Function,
|
|
onResponderReject: Function,
|
|
onResponderRelease: Function,
|
|
onResponderStart: Function,
|
|
onResponderTerminate: Function,
|
|
onResponderTerminationRequest: Function,
|
|
onStartShouldSetResponder: Function,
|
|
onStartShouldSetResponderCapture: Function,
|
|
};
|
|
|
|
export type NavigationTransitionSpec = {
|
|
duration?: number,
|
|
// An easing function from `Easing`.
|
|
easing?: () => any,
|
|
// A timing function such as `Animated.timing`.
|
|
timing?: (value: NavigationAnimatedValue, config: any) => any,
|
|
};
|
|
|
|
// Functions.
|
|
|
|
export type NavigationAnimationSetter = (
|
|
position: NavigationAnimatedValue,
|
|
newState: NavigationState,
|
|
lastState: NavigationState,
|
|
) => void;
|
|
|
|
export type NavigationSceneRenderer = (
|
|
props: NavigationSceneRendererProps,
|
|
) => ?ReactElement<any>;
|
|
|
|
export type NavigationStyleInterpolator = (
|
|
props: NavigationSceneRendererProps,
|
|
) => Object;
|