mirror of
https://github.com/zhigang1992/react-navigation.git
synced 2026-01-12 22:51:18 +08:00
fix: don't allow overriding gestureEnabled on first screen
This commit is contained in:
@@ -15,6 +15,7 @@ import useKeyboardManager from '../../utils/useKeyboardManager';
|
||||
import type { Layout, Scene } from '../../types';
|
||||
|
||||
type Props = {
|
||||
index: number;
|
||||
interpolationIndex: number;
|
||||
active: boolean;
|
||||
focused: boolean;
|
||||
@@ -53,6 +54,7 @@ type Props = {
|
||||
const EPSILON = 0.1;
|
||||
|
||||
function CardContainer({
|
||||
index,
|
||||
active,
|
||||
closing,
|
||||
gesture,
|
||||
@@ -231,7 +233,7 @@ function CardContainer({
|
||||
onGestureBegin={handleGestureBegin}
|
||||
onGestureCanceled={handleGestureCanceled}
|
||||
onGestureEnd={handleGestureEnd}
|
||||
gestureEnabled={gestureEnabled}
|
||||
gestureEnabled={index === 0 ? false : gestureEnabled}
|
||||
gestureResponseDistance={gestureResponseDistance}
|
||||
gestureVelocityImpact={gestureVelocityImpact}
|
||||
transitionSpec={transitionSpec}
|
||||
|
||||
@@ -231,9 +231,7 @@ export default class CardStack extends React.Component<Props, State> {
|
||||
animationEnabled = Platform.OS !== 'web' &&
|
||||
Platform.OS !== 'windows' &&
|
||||
Platform.OS !== 'macos',
|
||||
gestureEnabled = index !== 0 &&
|
||||
Platform.OS === 'ios' &&
|
||||
animationEnabled,
|
||||
gestureEnabled = Platform.OS === 'ios' && animationEnabled,
|
||||
gestureDirection = defaultTransitionPreset.gestureDirection,
|
||||
transitionSpec = defaultTransitionPreset.transitionSpec,
|
||||
cardStyleInterpolator = animationEnabled === false
|
||||
@@ -588,6 +586,7 @@ export default class CardStack extends React.Component<Props, State> {
|
||||
pointerEvents="box-none"
|
||||
>
|
||||
<CardContainer
|
||||
index={index}
|
||||
interpolationIndex={interpolationIndex}
|
||||
active={index === self.length - 1}
|
||||
focused={focused}
|
||||
|
||||
Reference in New Issue
Block a user