|
| 1 | +type event('a) = {. "nativeEvent": 'a}; |
| 2 | + |
| 3 | +type editingEvent = |
| 4 | + event({ |
| 5 | + . |
| 6 | + "text": string, |
| 7 | + "eventCount": int, |
| 8 | + "target": int, |
| 9 | + }); |
| 10 | + |
| 11 | +type contentSizeChangeEvent = |
| 12 | + event({ |
| 13 | + . |
| 14 | + "contentSize": { |
| 15 | + . |
| 16 | + "width": float, |
| 17 | + "height": float, |
| 18 | + }, |
| 19 | + }); |
| 20 | + |
| 21 | +type focusEvent = event({. "target": int}); |
| 22 | + |
| 23 | +type scrollEvent = |
| 24 | + event({ |
| 25 | + . |
| 26 | + "contentOffset": { |
| 27 | + . |
| 28 | + "x": float, |
| 29 | + "y": float, |
| 30 | + }, |
| 31 | + }); |
| 32 | + |
| 33 | +type selection = { |
| 34 | + . |
| 35 | + "start": int, |
| 36 | + "_end": int, |
| 37 | +}; |
| 38 | + |
| 39 | +type selectionEvent = event(selection); |
| 40 | + |
| 41 | +type keyPressEvent = event({. "key": string}); |
| 42 | + |
| 43 | +[@react.component] [@bs.module "react-native"] |
| 44 | +external make: |
| 45 | + ( |
| 46 | + ~allowFontScaling: bool=?, |
| 47 | + ~autoCapitalize: [@bs.string] [ |
| 48 | + | `characters |
| 49 | + | `words |
| 50 | + | `sentences |
| 51 | + | `none |
| 52 | + ] |
| 53 | + =?, |
| 54 | + ~autoComplete: [@bs.string] [ |
| 55 | + | `off |
| 56 | + | `username |
| 57 | + | `password |
| 58 | + | `email |
| 59 | + | `name |
| 60 | + | `tel |
| 61 | + | [@bs.as "street-address"] `streetAddress |
| 62 | + | [@bs.as "postal-code"] `postalCode |
| 63 | + | [@bs.as "cc-number"] `ccNumber |
| 64 | + | [@bs.as "cc-csc"] `ccCsc |
| 65 | + | [@bs.as "cc-exp"] `ccExp |
| 66 | + | [@bs.as "cc-exp-month"] `ccExpMonth |
| 67 | + | [@bs.as "cc-exp-year"] `ccExpYear |
| 68 | + ] |
| 69 | + =?, |
| 70 | + ~autoCorrect: bool=?, |
| 71 | + ~autoFocus: bool=?, |
| 72 | + ~blurOnSubmit: bool=?, |
| 73 | + ~caretHidden: bool=?, |
| 74 | + ~clearButtonMode: [@bs.string] [ |
| 75 | + | `never |
| 76 | + | `whileEditing |
| 77 | + | `unlessEditing |
| 78 | + | `always |
| 79 | + ] |
| 80 | + =?, |
| 81 | + ~clearTextOnFocus: bool=?, |
| 82 | + ~contextMenuHidden: bool=?, |
| 83 | + ~dataDetectorTypes: array( |
| 84 | + [ |
| 85 | + | `phoneNumber |
| 86 | + | `link |
| 87 | + | `address |
| 88 | + | `calendarEvent |
| 89 | + | `none |
| 90 | + | `all |
| 91 | + ], |
| 92 | + ) |
| 93 | + =?, |
| 94 | + ~defaultValue: string=?, |
| 95 | + ~disableFullscreenUI: bool=?, |
| 96 | + ~editable: bool=?, |
| 97 | + ~enablesReturnKeyAutomatically: bool=?, |
| 98 | + ~importantForAutofill: [@bs.string] [ |
| 99 | + | `auto |
| 100 | + | `no |
| 101 | + | `noExcludeDescendants |
| 102 | + | `yes |
| 103 | + | `yesExcludeDescendants |
| 104 | + ] |
| 105 | + =?, |
| 106 | + ~inlineImageLeft: string=?, |
| 107 | + ~inlineImagePadding: float=?, |
| 108 | + ~inputAccessoryViewID: string=?, |
| 109 | + ~keyboardAppearance: [@bs.string] [ | `default | `light | `dark]=?, |
| 110 | + ~keyboardType: [@bs.string] [ |
| 111 | + | `default |
| 112 | + | [@bs.as "number-pad"] `numberPad |
| 113 | + | [@bs.as "decimal-pad"] `decimalPad |
| 114 | + | `numeric |
| 115 | + | [@bs.as "email-address"] `emailAddress |
| 116 | + | [@bs.as "phone-pad"] `phonePad |
| 117 | + | [@bs.as "ascii-capable"] `asciiCapable |
| 118 | + | [@bs.as "numbers-and-punctuation"] |
| 119 | + `numbersAndPunctuation |
| 120 | + | `url |
| 121 | + | [@bs.as "name-phone-pad"] `namePhonePad |
| 122 | + | `twitter |
| 123 | + | [@bs.as "web-search"] `webSearch |
| 124 | + | [@bs.as "visible-password"] `visiblePassword |
| 125 | + ] |
| 126 | + =?, |
| 127 | + ~maxFontSizeMultiplier: float=?, |
| 128 | + ~maxLength: int=?, |
| 129 | + ~multiline: bool=?, |
| 130 | + ~numberOfLines: int=?, |
| 131 | + ~onBlur: unit => unit=?, |
| 132 | + ~onChange: editingEvent => unit=?, |
| 133 | + ~onChangeText: string => unit=?, |
| 134 | + ~onContentSizeChange: contentSizeChangeEvent => unit=?, |
| 135 | + ~onEndEditing: editingEvent => unit=?, |
| 136 | + ~onFocus: focusEvent => unit=?, |
| 137 | + ~onKeyPress: keyPressEvent => unit=?, |
| 138 | + ~onScroll: scrollEvent => unit=?, |
| 139 | + ~onSelectionChange: selectionEvent => unit=?, |
| 140 | + ~onSubmitEditing: editingEvent => unit=?, |
| 141 | + ~placeholder: string=?, |
| 142 | + ~placeholderTextColor: Style.color=?, |
| 143 | + ~returnKeyLabel: string=?, |
| 144 | + ~returnKeyType: [@bs.string] [ |
| 145 | + | [@bs.as "done"] `done_ |
| 146 | + | `go |
| 147 | + | `next |
| 148 | + | `search |
| 149 | + | `send |
| 150 | + | `none |
| 151 | + | `previous |
| 152 | + | `default |
| 153 | + | [@bs.as "emergency-call"] `emergencyCall |
| 154 | + | `google |
| 155 | + | `join |
| 156 | + | `route |
| 157 | + | `yahoo |
| 158 | + ] |
| 159 | + =?, |
| 160 | + ~rejectResponderTermination: bool=?, |
| 161 | + ~scrollEnabled: bool=?, |
| 162 | + ~secureTextEntry: bool=?, |
| 163 | + ~selection: selection=?, |
| 164 | + ~selectionColor: Style.color=?, |
| 165 | + ~selectionState: 'documentSelectionState=?, // TODO |
| 166 | + ~selectTextOnFocus: bool=?, |
| 167 | + ~spellCheck: bool=?, |
| 168 | + ~textBreakStrategy: [@bs.string] [ | `balanced | `highQuality | `simple]=?, |
| 169 | + ~textContentType: [@bs.string] [ |
| 170 | + | `none |
| 171 | + | `URL |
| 172 | + | `addressCity |
| 173 | + | `addressCityAndState |
| 174 | + | `addressState |
| 175 | + | `countryName |
| 176 | + | `creditCardNumber |
| 177 | + | `emailAddress |
| 178 | + | `familyName |
| 179 | + | `fullStreetAddress |
| 180 | + | `givenName |
| 181 | + | `jobTitle |
| 182 | + | `location |
| 183 | + | `middleName |
| 184 | + | `name |
| 185 | + | `namePrefix |
| 186 | + | `nameSuffix |
| 187 | + | `nickname |
| 188 | + | `organizationName |
| 189 | + | `postalCode |
| 190 | + | `streetAddressLine1 |
| 191 | + | `streetAddressLine2 |
| 192 | + | `sublocality |
| 193 | + | `telephoneNumber |
| 194 | + | `username |
| 195 | + | `password |
| 196 | + | `newPassword |
| 197 | + | `oneTimeCode |
| 198 | + ] |
| 199 | + =?, |
| 200 | + ~underlineColorAndroid: Style.color=?, |
| 201 | + ~value: string=?, |
| 202 | + // View props |
| 203 | + ~accessibilityComponentType: [@bs.string] [ |
| 204 | + | `none |
| 205 | + | `button |
| 206 | + | `radiobutton_checked |
| 207 | + | `radiobutton_unchecked |
| 208 | + ] |
| 209 | + =?, |
| 210 | + ~accessibilityElementsHidden: bool=?, |
| 211 | + ~accessibilityHint: string=?, |
| 212 | + ~accessibilityIgnoresInvertColors: bool=?, |
| 213 | + ~accessibilityLabel: string=?, |
| 214 | + ~accessibilityLiveRegion: [@bs.string] [ | `none | `polite | `assertive]=?, |
| 215 | + ~accessibilityRole: [@bs.string] [ |
| 216 | + | `none |
| 217 | + | `button |
| 218 | + | `link |
| 219 | + | `search |
| 220 | + | `image |
| 221 | + | `keyboardkey |
| 222 | + | `text |
| 223 | + | `adjustable |
| 224 | + | `header |
| 225 | + | `summary |
| 226 | + | `imagebutton |
| 227 | + ] |
| 228 | + =?, |
| 229 | + ~accessibilityStates: array(Types.AccessibilityState.t)=?, |
| 230 | + ~accessibilityTraits: array(Types.AccessibilityTrait.t)=?, |
| 231 | + ~accessibilityViewIsModal: bool=?, |
| 232 | + ~accessible: bool=?, |
| 233 | + ~collapsable: bool=?, |
| 234 | + ~hitSlop: Types.insets=?, |
| 235 | + ~importantForAccessibility: [@bs.string] [ |
| 236 | + | `auto |
| 237 | + | `yes |
| 238 | + | `no |
| 239 | + | [@bs.as "no-hide-descendants"] |
| 240 | + `noHideDescendants |
| 241 | + ] |
| 242 | + =?, |
| 243 | + ~nativeID: string=?, |
| 244 | + ~needsOffscreenAlphaCompositing: bool=?, |
| 245 | + ~onAccessibilityTap: unit => unit=?, |
| 246 | + ~onLayout: Event.NativeLayoutEvent.t => unit=?, |
| 247 | + ~onMagicTap: unit => unit=?, |
| 248 | + ~onMoveShouldSetResponder: Event.NativeEvent.t => bool=?, |
| 249 | + ~onMoveShouldSetResponderCapture: Event.NativeEvent.t => bool=?, |
| 250 | + ~onResponderGrant: Event.NativeEvent.t => unit=?, |
| 251 | + ~onResponderMove: Event.NativeEvent.t => unit=?, |
| 252 | + ~onResponderReject: Event.NativeEvent.t => unit=?, |
| 253 | + ~onResponderRelease: Event.NativeEvent.t => unit=?, |
| 254 | + ~onResponderTerminate: Event.NativeEvent.t => unit=?, |
| 255 | + ~onResponderTerminationRequest: Event.NativeEvent.t => unit=?, |
| 256 | + ~onStartShouldSetResponder: Event.NativeEvent.t => bool=?, |
| 257 | + ~onStartShouldSetResponderCapture: Event.NativeEvent.t => bool=?, |
| 258 | + ~pointerEvents: [@bs.string] [ |
| 259 | + | `auto |
| 260 | + | `none |
| 261 | + | [@bs.as "box-none"] `boxNone |
| 262 | + | [@bs.as "box-only"] `boxOnly |
| 263 | + ] |
| 264 | + =?, |
| 265 | + ~removeClippedSubviews: bool=?, |
| 266 | + ~renderToHardwareTextureAndroid: bool=?, |
| 267 | + ~shouldRasterizeIOS: bool=?, |
| 268 | + ~style: Style.t=?, |
| 269 | + ~testID: string=? |
| 270 | + ) => |
| 271 | + React.element = |
| 272 | + "TextInput"; |
| 273 | + |
| 274 | +[@bs.send] external isFocused: ReasonReact.reactRef => bool = ""; |
| 275 | + |
| 276 | +[@bs.send] external clear: ReasonReact.reactRef => unit = ""; |
| 277 | + |
| 278 | +[@bs.send] external focus: ReasonReact.reactRef => unit = ""; |
| 279 | + |
| 280 | +[@bs.send] external blur: ReasonReact.reactRef => unit = ""; |
0 commit comments