React native 为什么外推夹具不';都不行';夹钳';?

React native 为什么外推夹具不';都不行';夹钳';?,react-native,react-native-reanimated,React Native,React Native Reanimated,EXTRAPOLATED.CLAMP在此代码中不起作用。我不明白为什么,有什么建议吗 我是react dev的新手。我想在我的应用程序中添加一些动画,但我被这一个卡住了 以下是我的作品: import Animated, { Extrapolate, interpolate, add, diffClamp, } from 'react-native-reanimated'; import { translate, usePanGestureHandler,withDecay,withOf

EXTRAPOLATED.CLAMP在此代码中不起作用。我不明白为什么,有什么建议吗

我是react dev的新手。我想在我的应用程序中添加一些动画,但我被这一个卡住了

以下是我的作品:

import Animated, { Extrapolate, interpolate, add, diffClamp, } from 'react-native-reanimated';
import {
  translate,
  usePanGestureHandler,withDecay,withOffset,clamp} from "react-native-redash/lib/module/v1";
返回前的声明:

const {
    gestureHandler,
    translation,
    velocity,
    state,
  } = usePanGestureHandler();
  const X = diffClamp(withDecay({ value: translation.x, velocity: velocity.X, state: state }), -BlHouses.length * screenWidth + screenWidth, 0)
我的组件:

<PanGestureHandler {...gestureHandler}>
        <Animated.View style={{ flexDirection: 'row', flex: 2 }}>

          {Array.isArray(BlHouses) && BlHouses.map((BlHouse, index) => {
            const translateX = interpolate(X, {
              inputRange: [-screenWidth * index, 0],
              outputRange: [-screenWidth * index, 0],
              extrapolate: Extrapolate.CLAMP,
            }
            )
            const positionX = add(X, index * screenWidth);
            const isDisappearing = screenWidth;
            const isOnLeft = 0;
            const isOnRight = (index - 1) * screenWidth;
            const isAppearing = (index + 1) * screenWidth;
            const scale = interpolate(positionX, {
              inputRange: [isOnRight, isOnLeft, isDisappearing, isAppearing,],
              outputRange: [0.5, 1, 0.5, -0.5],
              extrapolate: Extrapolate.CLAMP
            })
            const opacity = interpolate(positionX, {
              inputRange: [isOnRight, isOnLeft, isDisappearing, isAppearing,],
              outputRange: [0.5, 1, 0.5, -0.5],
              extrapolate: Extrapolate.CLAMP
            })

            return (

              <Animated.View key={index} style={[{ height: 270, width: screenWidth }, { opacity, transform: [{ translateX }, { scale: scale }] }]}>
                  <HouseHoldHeader
                    index={index}
                    maxIndex={BlHouses.length}
                    strName={BlHouses[index].str}
                    Nr={BlHouses[index].nr}
                    Bl={BlHouses[index].bl}
                    Sc={BlHouses[index].sc}
                    Ap={BlHouses[index].ap}
                  ></HouseHoldHeader>
              </Animated.View>

            );
          })}
        </Animated.View>
      </PanGestureHandler>

{Array.isArray(BlHouse)和&BlHouse.map((BlHouse,index)=>{
常量translateX=插值(X{
输入范围:[-屏幕宽度*索引,0],
outputRange:[-屏幕宽度*索引,0],
外推法:外推法,
}
)
const positionX=添加(X,索引*屏幕宽度);
常量isDisappearing=屏幕宽度;
常数isOnLeft=0;
常数等亮度=(指数-1)*屏幕宽度;
常量isAppearing=(索引+1)*屏幕宽度;
常量比例=插值(位置X{
输入范围:[isOnRight,isOnLeft,IsIsIsAppearing,isAppearing,],
输出范围:[0.5,1,0.5,-0.5],
外推:外推
})
常数不透明度=插值(位置X{
输入范围:[isOnRight,isOnLeft,IsIsIsAppearing,isAppearing,],
输出范围:[0.5,1,0.5,-0.5],
外推:外推
})
返回(
);
})}