【发布时间】:2021-04-20 18:22:22
【问题描述】:
我有一个问题,已经解决了,但是让我对模块感到困惑。
我尝试在我的组件中导入 Animated。
import { Animated, Easing } from 'react-native';
然后,我试图找到它的类型(流),我找到了答案。 Flow types for react-native's Animated library(谢谢)。
import type AnimatedValue from 'react-native/Libraries/Animated/src/nodes/AnimatedValue';
问题是。
当我在import { Animated, Easing } from 'react-native';中打开Animated(右键单击,然后我用“Visual code”进入类型定义),为什么它没有进入它的模块,而是进入这个路径? (库/缓存)
我试图在“react-native”模块中找到这个文件(index.d.ts),但我找不到它。为什么?
然后我尝试阅读 index.d.ts,找出 Animated.Value 的类型。
export namespace Animated {
type AnimatedValue = Value;
type AnimatedValueXY = ValueXY;
export class Value extends AnimatedWithChildren {
Horraay,我得到了 Animated.Value 是一个类,它的类型是一个 AnimatedValue。然后像往常一样找到它的路径,我右键单击,然后我用“可视代码”去类型定义,但我什么也没找到。
那么,import type AnimatedValue from 'react-native/Libraries/Animated/src/nodes/AnimatedValue 与 index.d.ts 中的 type AnimatedValue = Value; 有什么关系?
"react-native": "0.63.2",
【问题讨论】:
标签: reactjs typescript react-native flowtype