about summary refs log tree commit diff
path: root/src/view/com/composer/text-input/TextInput.types.ts
blob: fab2bc32f810d59b858ce3a0c1f596f0d0212ecb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import {type TextInput} from 'react-native'
import {type RichText} from '@atproto/api'

export type TextInputRef = {
  focus: () => void
  blur: () => void
  /**
   * @platform web
   */
  getCursorPosition: () =>
    | {left: number; right: number; top: number; bottom: number}
    | undefined
  /**
   * Closes the autocomplete popup if it is open.
   * Returns `true` if the popup was closed, `false` otherwise.
   *
   * @platform web
   */
  maybeClosePopup: () => boolean
}

export type TextInputProps = {
  ref: React.Ref<TextInputRef>
  richtext: RichText
  webForceMinHeight: boolean
  hasRightPadding: boolean
  isActive: boolean
  setRichText: (v: RichText) => void
  onPhotoPasted: (uri: string) => void
  onPressPublish: (richtext: RichText) => void
  onNewLink: (uri: string) => void
  onError: (err: string) => void
  onFocus: () => void
} & Pick<
  React.ComponentProps<typeof TextInput>,
  | 'placeholder'
  | 'autoFocus'
  | 'style'
  | 'accessible'
  | 'accessibilityLabel'
  | 'accessibilityHint'
>