【发布时间】:2019-07-15 04:21:02
【问题描述】:
在我的 RN 应用程序中,我有以下界面。
interface IProps extends Props<IProps> {
label?: string;
editable?: boolean;
maxLength?: number;
autoCorrect?: boolean;
placeholder?: string;
// tslint:disable-next-line: max-line-length
autoCapitalize?: 'none' | 'sentences' | 'words' | 'characters' | undefined;
// tslint:disable-next-line: max-line-length
returnKeyType?: 'none' | 'done' | 'search' | 'default' | 'go' | 'next' | 'send' | 'previous' | 'google' | 'join' | 'route' | 'yahoo' | 'emergency-call';
// tslint:disable-next-line: max-line-length
keyboardType?: 'default' | 'email-address' | 'numeric' | 'phone-pad' | 'visible-password' | 'ascii-capable' | 'numbers-and-punctuation' | 'url' | 'number-pad' | 'name-phone-pad' | 'decimal-pad' | 'twitter' | 'web-search' | undefined;
secureTextEntry?: boolean;
inputStyle?: object;
containerStyle?: object;
inputContainerStyle?: object;
}
这里的autoCapitalize,returnKeyType的类型是一个枚举。在这里定义整个枚举似乎很难看。有更好的方法吗?
【问题讨论】:
标签: reactjs typescript react-native