|
1 | | -import type { ColorValue, TextStyle } from 'react-native'; |
| 1 | +import type { RefObject } from 'react'; |
| 2 | +import type { |
| 3 | + ColorValue, |
| 4 | + NativeMethods, |
| 5 | + NativeSyntheticEvent, |
| 6 | + TargetedEvent, |
| 7 | + TextStyle, |
| 8 | + ViewProps, |
| 9 | + ViewStyle, |
| 10 | +} from 'react-native'; |
2 | 11 |
|
3 | 12 | // Event data interfaces |
4 | 13 |
|
@@ -173,6 +182,62 @@ export interface HtmlStyle { |
173 | 182 | }; |
174 | 183 | } |
175 | 184 |
|
| 185 | +// Native component types |
| 186 | + |
| 187 | +export type FocusEvent = NativeSyntheticEvent<TargetedEvent>; |
| 188 | +export type BlurEvent = NativeSyntheticEvent<TargetedEvent>; |
| 189 | + |
| 190 | +export interface EnrichedTextInputInstance |
| 191 | + extends EnrichedTextInputBaseInstance, |
| 192 | + NativeMethods {} |
| 193 | + |
| 194 | +export interface EnrichedTextInputProps extends Omit<ViewProps, 'children'> { |
| 195 | + ref?: RefObject<EnrichedTextInputInstance | null>; |
| 196 | + autoFocus?: boolean; |
| 197 | + editable?: boolean; |
| 198 | + mentionIndicators?: string[]; |
| 199 | + defaultValue?: string; |
| 200 | + placeholder?: string; |
| 201 | + placeholderTextColor?: ColorValue; |
| 202 | + cursorColor?: ColorValue; |
| 203 | + selectionColor?: ColorValue; |
| 204 | + autoCapitalize?: 'none' | 'sentences' | 'words' | 'characters'; |
| 205 | + htmlStyle?: HtmlStyle; |
| 206 | + style?: ViewStyle | TextStyle; |
| 207 | + scrollEnabled?: boolean; |
| 208 | + linkRegex?: RegExp | null; |
| 209 | + onFocus?: (e: FocusEvent) => void; |
| 210 | + onBlur?: (e: BlurEvent) => void; |
| 211 | + onChangeText?: (e: NativeSyntheticEvent<OnChangeTextEvent>) => void; |
| 212 | + onChangeHtml?: (e: NativeSyntheticEvent<OnChangeHtmlEvent>) => void; |
| 213 | + onChangeState?: (e: NativeSyntheticEvent<OnChangeStateEvent>) => void; |
| 214 | + onLinkDetected?: (e: OnLinkDetected) => void; |
| 215 | + onMentionDetected?: (e: OnMentionDetected) => void; |
| 216 | + onStartMention?: (indicator: string) => void; |
| 217 | + onChangeMention?: (e: OnChangeMentionEvent) => void; |
| 218 | + onEndMention?: (indicator: string) => void; |
| 219 | + onChangeSelection?: (e: NativeSyntheticEvent<OnChangeSelectionEvent>) => void; |
| 220 | + onKeyPress?: (e: NativeSyntheticEvent<OnKeyPressEvent>) => void; |
| 221 | + onPasteImages?: (e: NativeSyntheticEvent<OnPasteImagesEvent>) => void; |
| 222 | + contextMenuItems?: ContextMenuItem[]; |
| 223 | + /** |
| 224 | + * If true, Android will use experimental synchronous events. |
| 225 | + * This will prevent from input flickering when updating component size. |
| 226 | + * However, this is an experimental feature, which has not been thoroughly tested. |
| 227 | + * We may decide to enable it by default in a future release. |
| 228 | + * Disabled by default. |
| 229 | + */ |
| 230 | + androidExperimentalSynchronousEvents?: boolean; |
| 231 | + /** |
| 232 | + * If true, external HTML (e.g. from Google Docs, Word, web pages) will be |
| 233 | + * normalized through the HTML normalizer before being applied. |
| 234 | + * This converts arbitrary HTML into the canonical tag subset that the enriched |
| 235 | + * parser understands. |
| 236 | + * Disabled by default. |
| 237 | + */ |
| 238 | + useHtmlNormalizer?: boolean; |
| 239 | +} |
| 240 | + |
176 | 241 | // Base instance interface shared between platforms |
177 | 242 |
|
178 | 243 | export interface EnrichedTextInputBaseInstance { |
|
0 commit comments