如何在 TypeScript 中使用 Animatable.View
Error in ref property 无法匹配此调用。 重载 1 中的 2, '(props: AnimatableProperties<ViewStyle> & ViewProps, context?: any): ClassicComponent<AnimatableProperties<ViewStyle> & ViewProps, any>', 给出了以下错误。 类型 'RefObject<View>' 不能被赋值给类型 'string | ((instance: ClassicComponent<AnimatableProperties<ViewStyle> & ViewProps, any> | null) => void) | RefObject<...> | null | undefined'。 类型 'RefObject<View>' 不能被赋值给类型 'RefObject<ClassicComponent<AnimatableProperties<ViewStyle> & ViewProps, any>>'。 类型 'AnimatableComponent<ViewProps, ViewStyle>' 缺少来自类型 'ClassicComponent<AnimatableProperties<ViewStyle> & ViewProps, any>' 的以下属性: replaceState, isMounted, context, setState 和 4 个其他属性。 重载 2 中的 2, '(props: AnimatableProperties<ViewStyle> & ViewProps, context?: any): Component<AnimatableProperties<ViewStyle> & ViewProps, any, any>', 给出了以下错误。 类型 'RefObject<View>' 不能被赋值给类型 'string | ((instance: Component<AnimatableProperties<ViewStyle> & ViewProps, any, any> | null) => void) | RefObject<Component<AnimatableProperties<...> & ViewProps, any, any>> | null | undefined'。 类型 'RefObject<View>' 不能被赋值给类型 'RefObject<Component<AnimatableProperties<ViewStyle> & ViewProps, any, any>>'。 类型 'AnimatableComponent<ViewProps, ViewStyle>' 缺少来自类型 'Component<AnimatableProperties<ViewStyle> & ViewProps, any, any>' 的以下属性: context, setState, forceUpdate, render 和 2 个其他属性。ts(2769) index.d.ts(145, 9): 预期类型来自属性 'ref',它在类型 'IntrinsicAttributes & IntrinsicClassAttributes<ClassicComponent<AnimatableProperties<ViewStyle> & ViewProps, any>> & Readonly<...> & Readonly<...>' 上声明。 index.d.ts(145, 9): 预期类型来自属性 'ref',它在类型 'IntrinsicAttributes & IntrinsicClassAttributes<Component<AnimatableProperties<ViewStyle> & ViewProps, any, any>> & Readonly<...> & Readonly<...>' 上声明。
内容来源: oblador/react-native-animatable