在我的本机应用程序中,我有一个TextInput
组件。在TextInput
读取某些类型从以下路径:
/Users/karl/Library/Caches/typescript/3.6/node_modules/@types/react-native/index.d.ts
这个文件有很多类型,包括:
export type KeyboardType = 'default' | 'email-address' | 'numeric' | 'phone-pad';
我可以通过cmd + clicking
我添加的道具访问这个文件,(使用 vscode)去它的定义。
我想知道的是如何引用此文件中的类型,以便我可以在我的 Flow 类型定义中使用它们?
我希望能够执行以下操作:
// pseudocode
import type { KeyboardType } from 'react-native'
我该怎么办?
你做的一切都是正确的,除了你不需要type
后面的词import
:
import { Image, StyleSheet, ReturnKeyType, KeyboardType } from "react-native";
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句