【问题标题】:What is the Typescript Typing for scrollXAnimated in React Native?React Native 中 scrollXAnimated 的 Typescript 类型是什么?
【发布时间】:2021-02-25 03:35:41
【问题描述】:

在 React Native 中 scrollXAnimated 的 Typescript 输入是什么?我浏览了文档,但没有看到任何相关内容。

TypeScript 类型:

// TypeScript Type: Props
interface Props {
  scrollXAnimated: any, // WHAT CAN I ADD INSTEAD OF ANY?
  data: any,
};

守则:

  const translateY = props.scrollXAnimated.interpolate({
    inputRange: [-1, 0, 1],
    outputRange: [HEADER_HEIGHT, 0, -HEADER_HEIGHT],
  });

【问题讨论】:

  • 它的 Animated.Value if Animated 来自 react native 如果它来自 reanimated 它将是 Animated.Value

标签: typescript react-native types typescript-typings


【解决方案1】:

界面

interface Props {
  scrollXAnimated: Animated.Value // if from . react native else Animated.Value<number> if from reanimated
  data: any,
};

【讨论】:

    猜你喜欢
    • 2019-05-10
    • 1970-01-01
    • 2023-03-24
    • 2020-07-08
    • 2020-10-08
    • 2020-12-23
    • 2018-03-09
    • 2020-03-09
    • 2021-07-06
    相关资源
    最近更新 更多