microsoft/vscode-react-native
Publicmirrored from https://github.com/microsoft/vscode-react-nativeAvailable
ReactTypings/react-native/react-native.d.ts
8437lines · modeblame
1f817868Vladimir Kotikov9 years ago | 1 | // Type definitions for react-native 0.34 |
d24fea86Joshua Skelton10 years ago | 2 | // Project: https://github.com/facebook/react-native |
| 3 | // Definitions by: Bruno Grieder <https://github.com/bgrieder> | |
1f817868Vladimir Kotikov9 years ago | 4 | // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped |
d24fea86Joshua Skelton10 years ago | 5 | |
| 6 | /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |
| 7 | // | |
| 8 | // USING: these definitions are meant to be used with the TSC compiler target set to ES6 | |
| 9 | // | |
| 10 | // USAGE EXAMPLES: check the RNTSExplorer project at https://github.com/bgrieder/RNTSExplorer | |
| 11 | // | |
| 12 | // CREDITS: This work is based on an original work made by Bernd Paradies: https://github.com/bparadie | |
| 13 | // | |
| 14 | /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |
| 15 | | |
| 16 | /// <reference path="../react/react.d.ts" /> | |
| 17 | | |
| 18 | //so we know what is "original" React | |
| 19 | import React = __React; | |
| 20 | | |
| 21 | //react-native "extends" react | |
1f817868Vladimir Kotikov9 years ago | 22 | declare namespace __React { |
d24fea86Joshua Skelton10 years ago | 23 | /** |
| 24 | * Represents the completion of an asynchronous operation | |
| 25 | * @see lib.es6.d.ts | |
| 26 | */ | |
| 27 | export interface Promise<T> { | |
| 28 | /** | |
| 29 | * Attaches callbacks for the resolution and/or rejection of the Promise. | |
| 30 | * @param onfulfilled The callback to execute when the Promise is resolved. | |
| 31 | * @param onrejected The callback to execute when the Promise is rejected. | |
| 32 | * @returns A Promise for the completion of which ever callback is executed. | |
| 33 | */ | |
| 34 | then<TResult>( onfulfilled?: ( value: T ) => TResult | Promise<TResult>, onrejected?: ( reason: any ) => TResult | Promise<TResult> ): Promise<TResult>; | |
| 35 | | |
| 36 | /** | |
| 37 | * Attaches a callback for only the rejection of the Promise. | |
| 38 | * @param onrejected The callback to execute when the Promise is rejected. | |
| 39 | * @returns A Promise for the completion of the callback. | |
| 40 | */ | |
| 41 | catch( onrejected?: ( reason: any ) => T | Promise<T> ): Promise<T>; | |
| 42 | | |
| 43 | | |
| 44 | // not in lib.es6.d.ts but called by react-native | |
| 45 | done( callback?: ( value: T ) => void ): void; | |
| 46 | } | |
| 47 | | |
| 48 | export interface PromiseConstructor { | |
| 49 | /** | |
| 50 | * A reference to the prototype. | |
| 51 | */ | |
| 52 | prototype: Promise<any>; | |
| 53 | | |
| 54 | /** | |
| 55 | * Creates a new Promise. | |
| 56 | * @param init A callback used to initialize the promise. This callback is passed two arguments: | |
| 57 | * a resolve callback used resolve the promise with a value or the result of another promise, | |
| 58 | * and a reject callback used to reject the promise with a provided reason or error. | |
| 59 | */ | |
| 60 | new <T>( init: ( resolve: ( value?: T | Promise<T> ) => void, reject: ( reason?: any ) => void ) => void ): Promise<T>; | |
| 61 | | |
| 62 | <T>( init: ( resolve: ( value?: T | Promise<T> ) => void, reject: ( reason?: any ) => void ) => void ): Promise<T>; | |
| 63 | | |
| 64 | /** | |
| 65 | * Creates a Promise that is resolved with an array of results when all of the provided Promises | |
| 66 | * resolve, or rejected when any Promise is rejected. | |
| 67 | * @param values An array of Promises. | |
| 68 | * @returns A new Promise. | |
| 69 | */ | |
| 70 | all<T>( values: (T | Promise<T>)[] ): Promise<T[]>; | |
| 71 | | |
| 72 | /** | |
| 73 | * Creates a Promise that is resolved with an array of results when all of the provided Promises | |
| 74 | * resolve, or rejected when any Promise is rejected. | |
| 75 | * @param values An array of values. | |
| 76 | * @returns A new Promise. | |
| 77 | */ | |
| 78 | all( values: Promise<void>[] ): Promise<void>; | |
| 79 | | |
| 80 | /** | |
| 81 | * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved | |
| 82 | * or rejected. | |
| 83 | * @param values An array of Promises. | |
| 84 | * @returns A new Promise. | |
| 85 | */ | |
| 86 | race<T>( values: (T | Promise<T>)[] ): Promise<T>; | |
| 87 | | |
| 88 | /** | |
| 89 | * Creates a new rejected promise for the provided reason. | |
| 90 | * @param reason The reason the promise was rejected. | |
| 91 | * @returns A new rejected Promise. | |
| 92 | */ | |
| 93 | reject( reason: any ): Promise<void>; | |
| 94 | | |
| 95 | /** | |
| 96 | * Creates a new rejected promise for the provided reason. | |
| 97 | * @param reason The reason the promise was rejected. | |
| 98 | * @returns A new rejected Promise. | |
| 99 | */ | |
| 100 | reject<T>( reason: any ): Promise<T>; | |
| 101 | | |
| 102 | /** | |
| 103 | * Creates a new resolved promise for the provided value. | |
| 104 | * @param value A promise. | |
| 105 | * @returns A promise whose internal state matches the provided promise. | |
| 106 | */ | |
| 107 | resolve<T>( value: T | Promise<T> ): Promise<T>; | |
| 108 | | |
| 109 | /** | |
| 110 | * Creates a new resolved promise . | |
| 111 | * @returns A resolved promise. | |
| 112 | */ | |
| 113 | resolve(): Promise<void>; | |
| 114 | } | |
| 115 | | |
| 116 | // @see lib.es6.d.ts | |
| 117 | export var Promise: PromiseConstructor; | |
| 118 | | |
1f817868Vladimir Kotikov9 years ago | 119 | export type MeasureOnSuccessCallback = ( |
| 120 | x: number, | |
| 121 | y: number, | |
| 122 | width: number, | |
| 123 | height: number, | |
| 124 | pageX: number, | |
| 125 | pageY: number | |
| 126 | ) => void | |
| 127 | | |
| 128 | export type MeasureInWindowOnSuccessCallback = ( | |
| 129 | x: number, | |
| 130 | y: number, | |
| 131 | width: number, | |
| 132 | height: number | |
| 133 | ) => void | |
| 134 | | |
| 135 | export type MeasureLayoutOnSuccessCallback = ( | |
| 136 | left: number, | |
| 137 | top: number, | |
| 138 | width: number, | |
| 139 | height: number | |
| 140 | ) => void | |
| 141 | | |
| 142 | /** | |
| 143 | * EventSubscription represents a subscription to a particular event. It can | |
| 144 | * remove its own subscription. | |
| 145 | */ | |
| 146 | interface EventSubscription { | |
| 147 | | |
| 148 | eventType: string; | |
| 149 | key: number; | |
| 150 | subscriber: EventSubscriptionVendor; | |
| 151 | | |
| 152 | /** | |
| 153 | * @param {EventSubscriptionVendor} subscriber the subscriber that controls | |
| 154 | * this subscription. | |
| 155 | */ | |
| 156 | new(subscriber: EventSubscriptionVendor): EventSubscription | |
| 157 | | |
| 158 | /** | |
| 159 | * Removes this subscription from the subscriber that controls it. | |
| 160 | */ | |
| 161 | remove(): void | |
| 162 | } | |
| 163 | | |
| 164 | /** | |
| 165 | * EventSubscriptionVendor stores a set of EventSubscriptions that are | |
| 166 | * subscribed to a particular event type. | |
| 167 | */ | |
| 168 | interface EventSubscriptionVendor { | |
| 169 | | |
| 170 | constructor(): EventSubscriptionVendor | |
| 171 | | |
| 172 | /** | |
| 173 | * Adds a subscription keyed by an event type. | |
| 174 | * | |
| 175 | * @param {string} eventType | |
| 176 | * @param {EventSubscription} subscription | |
| 177 | */ | |
| 178 | addSubscription(eventType: string, subscription: EventSubscription): EventSubscription | |
| 179 | | |
| 180 | /** | |
| 181 | * Removes a bulk set of the subscriptions. | |
| 182 | * | |
| 183 | * @param {?string} eventType - Optional name of the event type whose | |
| 184 | * registered supscriptions to remove, if null remove all subscriptions. | |
| 185 | */ | |
| 186 | removeAllSubscriptions(eventType?: string): void | |
| 187 | | |
| 188 | /** | |
| 189 | * Removes a specific subscription. Instead of calling this function, call | |
| 190 | * `subscription.remove()` directly. | |
| 191 | * | |
| 192 | * @param {object} subscription | |
| 193 | */ | |
| 194 | removeSubscription(subscription: any): void | |
| 195 | | |
| 196 | /** | |
| 197 | * Returns the array of subscriptions that are currently registered for the | |
| 198 | * given event type. | |
| 199 | * | |
| 200 | * Note: This array can be potentially sparse as subscriptions are deleted | |
| 201 | * from it when they are removed. | |
| 202 | * | |
| 203 | * @param {string} eventType | |
| 204 | * @returns {?array} | |
| 205 | */ | |
2060f3fbVladimir Kotikov9 years ago | 206 | getSubscriptionsForType(eventType: string): EventSubscription[] |
1f817868Vladimir Kotikov9 years ago | 207 | } |
| 208 | | |
| 209 | /** | |
| 210 | * EmitterSubscription represents a subscription with listener and context data. | |
| 211 | */ | |
| 212 | interface EmitterSubscription extends EventSubscription { | |
| 213 | emitter: EventEmitter | |
| 214 | listener: () => any | |
| 215 | context: any | |
| 216 | | |
| 217 | /** | |
| 218 | * @param {EventEmitter} emitter - The event emitter that registered this | |
| 219 | * subscription | |
| 220 | * @param {EventSubscriptionVendor} subscriber - The subscriber that controls | |
| 221 | * this subscription | |
| 222 | * @param {function} listener - Function to invoke when the specified event is | |
| 223 | * emitted | |
| 224 | * @param {*} context - Optional context object to use when invoking the | |
| 225 | * listener | |
| 226 | */ | |
| 227 | new(emitter: EventEmitter, subscriber: EventSubscriptionVendor, listener: () => any, context: any): EmitterSubscription | |
| 228 | | |
| 229 | /** | |
| 230 | * Removes this subscription from the emitter that registered it. | |
| 231 | * Note: we're overriding the `remove()` method of EventSubscription here | |
| 232 | * but deliberately not calling `super.remove()` as the responsibility | |
| 233 | * for removing the subscription lies with the EventEmitter. | |
| 234 | */ | |
| 235 | remove(): void | |
| 236 | } | |
| 237 | | |
| 238 | interface EventEmitter { | |
| 239 | /** | |
| 240 | * @constructor | |
| 241 | * | |
| 242 | * @param {EventSubscriptionVendor} subscriber - Optional subscriber instance | |
| 243 | * to use. If omitted, a new subscriber will be created for the emitter. | |
| 244 | */ | |
| 245 | new(subscriber?: EventSubscriptionVendor): EventEmitter | |
| 246 | | |
| 247 | /** | |
| 248 | * Adds a listener to be invoked when events of the specified type are | |
| 249 | * emitted. An optional calling context may be provided. The data arguments | |
| 250 | * emitted will be passed to the listener function. | |
| 251 | * | |
| 252 | * @param {string} eventType - Name of the event to listen to | |
| 253 | * @param {function} listener - Function to invoke when the specified event is | |
| 254 | * emitted | |
| 255 | * @param {*} context - Optional context object to use when invoking the | |
| 256 | * listener | |
| 257 | */ | |
| 258 | addListener(eventType: string, listener: (...args: any[]) => any, context: any): EmitterSubscription | |
| 259 | | |
| 260 | /** | |
| 261 | * Similar to addListener, except that the listener is removed after it is | |
| 262 | * invoked once. | |
| 263 | * | |
| 264 | * @param {string} eventType - Name of the event to listen to | |
| 265 | * @param {function} listener - Function to invoke only once when the | |
| 266 | * specified event is emitted | |
| 267 | * @param {*} context - Optional context object to use when invoking the | |
| 268 | * listener | |
| 269 | */ | |
| 270 | once(eventType: string, listener: (...args: any[]) => any, context: any): EmitterSubscription | |
| 271 | | |
| 272 | /** | |
| 273 | * Removes all of the registered listeners, including those registered as | |
| 274 | * listener maps. | |
| 275 | * | |
| 276 | * @param {?string} eventType - Optional name of the event whose registered | |
| 277 | * listeners to remove | |
| 278 | */ | |
| 279 | removeAllListeners(eventType?: string): void | |
| 280 | | |
| 281 | /** | |
| 282 | * Provides an API that can be called during an eventing cycle to remove the | |
| 283 | * last listener that was invoked. This allows a developer to provide an event | |
| 284 | * object that can remove the listener (or listener map) during the | |
| 285 | * invocation. | |
| 286 | * | |
| 287 | * If it is called when not inside of an emitting cycle it will throw. | |
| 288 | * | |
| 289 | * @throws {Error} When called not during an eventing cycle | |
| 290 | * | |
| 291 | * @example | |
| 292 | * var subscription = emitter.addListenerMap({ | |
| 293 | * someEvent: function(data, event) { | |
| 294 | * console.log(data); | |
| 295 | * emitter.removeCurrentListener(); | |
| 296 | * } | |
| 297 | * }); | |
| 298 | * | |
| 299 | * emitter.emit('someEvent', 'abc'); // logs 'abc' | |
| 300 | * emitter.emit('someEvent', 'def'); // does not log anything | |
| 301 | */ | |
| 302 | removeCurrentListener(): void | |
| 303 | | |
| 304 | /** | |
| 305 | * Removes a specific subscription. Called by the `remove()` method of the | |
| 306 | * subscription itself to ensure any necessary cleanup is performed. | |
| 307 | */ | |
| 308 | removeSubscription(subscription: EmitterSubscription): void | |
| 309 | | |
| 310 | /** | |
| 311 | * Returns an array of listeners that are currently registered for the given | |
| 312 | * event. | |
| 313 | * | |
| 314 | * @param {string} eventType - Name of the event to query | |
| 315 | * @returns {array} | |
| 316 | */ | |
| 317 | listeners(eventType: string): EmitterSubscription[] | |
| 318 | | |
| 319 | /** | |
| 320 | * Emits an event of the given type with the given data. All handlers of that | |
| 321 | * particular type will be notified. | |
| 322 | * | |
| 323 | * @param {string} eventType - Name of the event to emit | |
| 324 | * @param {...*} Arbitrary arguments to be passed to each registered listener | |
| 325 | * | |
| 326 | * @example | |
| 327 | * emitter.addListener('someEvent', function(message) { | |
| 328 | * console.log(message); | |
| 329 | * }); | |
| 330 | * | |
| 331 | * emitter.emit('someEvent', 'abc'); // logs 'abc' | |
| 332 | */ | |
| 333 | emit(eventType: string): void | |
| 334 | | |
| 335 | /** | |
| 336 | * Removes the given listener for event of specific type. | |
| 337 | * | |
| 338 | * @param {string} eventType - Name of the event to emit | |
| 339 | * @param {function} listener - Function to invoke when the specified event is | |
| 340 | * emitted | |
| 341 | * | |
| 342 | * @example | |
| 343 | * emitter.removeListener('someEvent', function(message) { | |
| 344 | * console.log(message); | |
| 345 | * }); // removes the listener if already registered | |
| 346 | * | |
| 347 | */ | |
| 348 | removeListener(eventType: string, listener: (...args: any[]) => any): void | |
| 349 | } | |
| 350 | | |
| 351 | /** NativeMethodsMixin provides methods to access the underlying native component directly. | |
| 352 | * This can be useful in cases when you want to focus a view or measure its on-screen dimensions, | |
| 353 | * for example. | |
| 354 | * The methods described here are available on most of the default components provided by React Native. | |
| 355 | * Note, however, that they are not available on composite components that aren't directly backed by a | |
| 356 | * native view. This will generally include most components that you define in your own app. | |
| 357 | * For more information, see [Direct Manipulation](http://facebook.github.io/react-native/docs/direct-manipulation.html). | |
| 358 | * @see https://github.com/facebook/react-native/blob/master/Libraries/ReactIOS/NativeMethodsMixin.js | |
| 359 | */ | |
| 360 | export interface NativeMethodsMixinStatic { | |
| 361 | /** | |
| 362 | * Determines the location on screen, width, and height of the given view and | |
| 363 | * returns the values via an async callback. If successful, the callback will | |
| 364 | * be called with the following arguments: | |
| 365 | * | |
| 366 | * - x | |
| 367 | * - y | |
| 368 | * - width | |
| 369 | * - height | |
| 370 | * - pageX | |
| 371 | * - pageY | |
| 372 | * | |
| 373 | * Note that these measurements are not available until after the rendering | |
| 374 | * has been completed in native. If you need the measurements as soon as | |
| 375 | * possible, consider using the [`onLayout` | |
| 376 | * prop](docs/view.html#onlayout) instead. | |
| 377 | */ | |
| 378 | measure(callback: MeasureOnSuccessCallback): void; | |
| 379 | | |
| 380 | /** | |
| 381 | * Determines the location of the given view in the window and returns the | |
| 382 | * values via an async callback. If the React root view is embedded in | |
| 383 | * another native view, this will give you the absolute coordinates. If | |
| 384 | * successful, the callback will be called with the following | |
| 385 | * arguments: | |
| 386 | * | |
| 387 | * - x | |
| 388 | * - y | |
| 389 | * - width | |
| 390 | * - height | |
| 391 | * | |
| 392 | * Note that these measurements are not available until after the rendering | |
| 393 | * has been completed in native. | |
| 394 | */ | |
| 395 | measureInWindow(callback: MeasureInWindowOnSuccessCallback): void; | |
| 396 | | |
| 397 | /** | |
| 398 | * Like [`measure()`](#measure), but measures the view relative an ancestor, | |
| 399 | * specified as `relativeToNativeNode`. This means that the returned x, y | |
| 400 | * are relative to the origin x, y of the ancestor view. | |
| 401 | * | |
| 402 | * As always, to obtain a native node handle for a component, you can use | |
| 403 | * `React.findNodeHandle(component)`. | |
| 404 | */ | |
| 405 | measureLayout( | |
| 406 | relativeToNativeNode: number, | |
| 407 | onSuccess: MeasureLayoutOnSuccessCallback, | |
| 408 | onFail: () => void /* currently unused */ | |
| 409 | ): void; | |
| 410 | | |
| 411 | /** | |
| 412 | * This function sends props straight to native. They will not participate in | |
| 413 | * future diff process - this means that if you do not include them in the | |
| 414 | * next render, they will remain active (see [Direct | |
| 415 | * Manipulation](docs/direct-manipulation.html)). | |
| 416 | */ | |
| 417 | setNativeProps(nativeProps: Object): void; | |
| 418 | | |
| 419 | /** | |
| 420 | * Requests focus for the given input or view. The exact behavior triggered | |
| 421 | * will depend on the platform and type of view. | |
| 422 | */ | |
| 423 | focus(): void; | |
| 424 | | |
| 425 | /** | |
| 426 | * Removes focus from an input or view. This is the opposite of `focus()`. | |
| 427 | */ | |
| 428 | blur(): void; | |
| 429 | | |
| 430 | refs: { | |
| 431 | [key: string]: Component<any, any> | |
| 432 | }; | |
d24fea86Joshua Skelton10 years ago | 433 | } |
| 434 | | |
| 435 | // see react-jsx.d.ts | |
| 436 | export function createElement<P>( type: React.ReactType, | |
| 437 | props?: P, | |
| 438 | ...children: React.ReactNode[] ): React.ReactElement<P>; | |
| 439 | | |
| 440 | | |
| 441 | export type Runnable = ( appParameters: any ) => void; | |
| 442 | | |
| 443 | | |
| 444 | // Similar to React.SyntheticEvent except for nativeEvent | |
| 445 | interface NativeSyntheticEvent<T> { | |
| 446 | bubbles: boolean | |
| 447 | cancelable: boolean | |
| 448 | currentTarget: EventTarget | |
| 449 | defaultPrevented: boolean | |
| 450 | eventPhase: number | |
| 451 | isTrusted: boolean | |
| 452 | nativeEvent: T | |
| 453 | preventDefault(): void | |
| 454 | stopPropagation(): void | |
| 455 | target: EventTarget | |
| 456 | timeStamp: Date | |
| 457 | type: string | |
| 458 | } | |
| 459 | | |
| 460 | export interface NativeTouchEvent { | |
| 461 | /** | |
| 462 | * Array of all touch events that have changed since the last event | |
| 463 | */ | |
| 464 | changedTouches: NativeTouchEvent[] | |
| 465 | | |
| 466 | /** | |
| 467 | * The ID of the touch | |
| 468 | */ | |
| 469 | identifier: string | |
| 470 | | |
| 471 | /** | |
| 472 | * The X position of the touch, relative to the element | |
| 473 | */ | |
| 474 | locationX: number | |
| 475 | | |
| 476 | /** | |
| 477 | * The Y position of the touch, relative to the element | |
| 478 | */ | |
| 479 | locationY: number | |
| 480 | | |
| 481 | /** | |
| 482 | * The X position of the touch, relative to the screen | |
| 483 | */ | |
| 484 | pageX: number | |
| 485 | | |
| 486 | /** | |
| 487 | * The Y position of the touch, relative to the screen | |
| 488 | */ | |
| 489 | pageY: number | |
| 490 | | |
| 491 | /** | |
| 492 | * The node id of the element receiving the touch event | |
| 493 | */ | |
| 494 | target: string | |
| 495 | | |
| 496 | /** | |
| 497 | * A time identifier for the touch, useful for velocity calculation | |
| 498 | */ | |
| 499 | timestamp: number | |
| 500 | | |
| 501 | /** | |
| 502 | * Array of all current touches on the screen | |
| 503 | */ | |
| 504 | touches : NativeTouchEvent[] | |
| 505 | } | |
| 506 | | |
| 507 | export interface GestureResponderEvent extends NativeSyntheticEvent<NativeTouchEvent> { | |
| 508 | } | |
| 509 | | |
| 510 | | |
| 511 | export interface PointProperties { | |
| 512 | x: number | |
| 513 | y: number | |
| 514 | } | |
| 515 | | |
| 516 | export interface Insets { | |
| 517 | top?: number | |
| 518 | left?: number | |
| 519 | bottom?: number | |
| 520 | right?: number | |
| 521 | } | |
| 522 | | |
| 523 | /** | |
| 524 | * //FIXME: need to find documentation on which component is a TTouchable and can implement that interface | |
| 525 | * @see React.DOMAtributes | |
| 526 | */ | |
| 527 | export interface Touchable { | |
| 528 | onTouchStart?: ( event: GestureResponderEvent ) => void | |
| 529 | onTouchMove?: ( event: GestureResponderEvent ) => void | |
| 530 | onTouchEnd?: ( event: GestureResponderEvent ) => void | |
| 531 | onTouchCancel?: ( event: GestureResponderEvent ) => void | |
| 532 | onTouchEndCapture?: ( event: GestureResponderEvent ) => void | |
| 533 | } | |
| 534 | | |
1f817868Vladimir Kotikov9 years ago | 535 | export type ComponentProvider = () => React.ComponentClass<any> |
| 536 | | |
d24fea86Joshua Skelton10 years ago | 537 | export type AppConfig = { |
| 538 | appKey: string; | |
1f817868Vladimir Kotikov9 years ago | 539 | component?: ComponentProvider |
d24fea86Joshua Skelton10 years ago | 540 | run?: Runnable; |
| 541 | } | |
| 542 | | |
| 543 | // https://github.com/facebook/react-native/blob/master/Libraries/AppRegistry/AppRegistry.js | |
1f817868Vladimir Kotikov9 years ago | 544 | /** |
| 545 | * `AppRegistry` is the JS entry point to running all React Native apps. App | |
| 546 | * root components should register themselves with | |
| 547 | * `AppRegistry.registerComponent`, then the native system can load the bundle | |
| 548 | * for the app and then actually run the app when it's ready by invoking | |
| 549 | * `AppRegistry.runApplication`. | |
| 550 | * | |
| 551 | * To "stop" an application when a view should be destroyed, call | |
| 552 | * `AppRegistry.unmountApplicationComponentAtRootTag` with the tag that was | |
| 553 | * pass into `runApplication`. These should always be used as a pair. | |
| 554 | * | |
| 555 | * `AppRegistry` should be `require`d early in the `require` sequence to make | |
| 556 | * sure the JS execution environment is setup before other modules are | |
| 557 | * `require`d. | |
| 558 | */ | |
d24fea86Joshua Skelton10 years ago | 559 | export class AppRegistry { |
| 560 | static registerConfig( config: AppConfig[] ): void; | |
| 561 | | |
1f817868Vladimir Kotikov9 years ago | 562 | static registerComponent( appKey: string, getComponentFunc: ComponentProvider ): string; |
d24fea86Joshua Skelton10 years ago | 563 | |
| 564 | static registerRunnable( appKey: string, func: Runnable ): string; | |
| 565 | | |
1f817868Vladimir Kotikov9 years ago | 566 | static getAppKeys(): string[]; |
| 567 | | |
| 568 | static unmountApplicationComponentAtRootTag(rootTag: number): void; | |
| 569 | | |
d24fea86Joshua Skelton10 years ago | 570 | static runApplication( appKey: string, appParameters: any ): void; |
| 571 | } | |
| 572 | | |
| 573 | export interface LayoutAnimationTypes { | |
| 574 | spring: string | |
| 575 | linear: string | |
| 576 | easeInEaseOut: string | |
| 577 | easeIn: string | |
| 578 | easeOut: string | |
| 579 | } | |
| 580 | | |
| 581 | export interface LayoutAnimationProperties { | |
| 582 | opacity: string | |
| 583 | scaleXY: string | |
| 584 | } | |
| 585 | | |
| 586 | export interface LayoutAnimationAnim { | |
| 587 | duration?: number | |
| 588 | delay?: number | |
| 589 | springDamping?: number | |
| 590 | initialVelocity?: number | |
| 591 | type?: string //LayoutAnimationTypes | |
| 592 | property?: string //LayoutAnimationProperties | |
| 593 | } | |
| 594 | | |
| 595 | export interface LayoutAnimationConfig { | |
| 596 | duration: number | |
| 597 | create?: LayoutAnimationAnim | |
| 598 | update?: LayoutAnimationAnim | |
| 599 | delete?: LayoutAnimationAnim | |
| 600 | } | |
| 601 | | |
1f817868Vladimir Kotikov9 years ago | 602 | /** Automatically animates views to their new positions when the next layout happens. |
| 603 | * A common way to use this API is to call LayoutAnimation.configureNext before | |
| 604 | * calling setState. */ | |
d24fea86Joshua Skelton10 years ago | 605 | export interface LayoutAnimationStatic { |
1f817868Vladimir Kotikov9 years ago | 606 | /** Schedules an animation to happen on the next layout. |
| 607 | * @param config Specifies animation properties: | |
| 608 | * `duration` in milliseconds | |
| 609 | * `create`, config for animating in new views (see Anim type) | |
| 610 | * `update`, config for animating views that have been updated (see Anim type) | |
| 611 | * @param onAnimationDidEnd Called when the animation finished. Only supported on iOS. | |
| 612 | */ | |
| 613 | configureNext: (config: LayoutAnimationConfig, onAnimationDidEnd?: () => void) => void | |
| 614 | /** Helper for creating a config for configureNext. */ | |
| 615 | create: (duration: number, type?: string, creationProp?: string) => LayoutAnimationConfig | |
d24fea86Joshua Skelton10 years ago | 616 | Types: LayoutAnimationTypes |
| 617 | Properties: LayoutAnimationProperties | |
1f817868Vladimir Kotikov9 years ago | 618 | configChecker: (shapeTypes: {[key: string]: any}) => any |
d24fea86Joshua Skelton10 years ago | 619 | Presets : { |
| 620 | easeInEaseOut: LayoutAnimationConfig | |
| 621 | linear:LayoutAnimationConfig | |
| 622 | spring: LayoutAnimationConfig | |
| 623 | } | |
1f817868Vladimir Kotikov9 years ago | 624 | easeInEaseOut: (config: LayoutAnimationConfig, onAnimationDidEnd?: () => void) => void |
| 625 | linear: (config: LayoutAnimationConfig, onAnimationDidEnd?: () => void) => void | |
| 626 | spring: (config: LayoutAnimationConfig, onAnimationDidEnd?: () => void) => void | |
d24fea86Joshua Skelton10 years ago | 627 | } |
| 628 | | |
1f817868Vladimir Kotikov9 years ago | 629 | export type FlexAlignType = "flex-start" | "flex-end" | "center" | "stretch"; |
| 630 | export type FlexJustifyType = "flex-start" | "flex-end" | "center" | "space-between" | "space-around"; | |
| 631 | export type FlexDirection = "row" | "column" | "row-reverse" | "column-reverse"; | |
d24fea86Joshua Skelton10 years ago | 632 | |
| 633 | /** | |
| 634 | * Flex Prop Types | |
| 635 | * @see https://facebook.github.io/react-native/docs/flexbox.html#proptypes | |
| 636 | * @see LayoutPropTypes.js | |
| 637 | */ | |
| 638 | export interface FlexStyle { | |
| 639 | | |
1f817868Vladimir Kotikov9 years ago | 640 | alignItems?: FlexAlignType; |
| 641 | alignSelf?: "auto" | FlexAlignType; | |
d24fea86Joshua Skelton10 years ago | 642 | borderBottomWidth?: number |
| 643 | borderLeftWidth?: number | |
| 644 | borderRightWidth?: number | |
| 645 | borderTopWidth?: number | |
| 646 | borderWidth?: number | |
| 647 | bottom?: number | |
| 648 | flex?: number | |
1f817868Vladimir Kotikov9 years ago | 649 | flexGrow?: number |
| 650 | flexShrink?: number | |
| 651 | flexBasis?: number | |
2eacfc1edaserge9 years ago | 652 | flexDirection?: FlexDirection |
1f817868Vladimir Kotikov9 years ago | 653 | flexWrap?: "wrap" | "nowrap" |
d24fea86Joshua Skelton10 years ago | 654 | height?: number |
1f817868Vladimir Kotikov9 years ago | 655 | justifyContent?: FlexJustifyType |
d24fea86Joshua Skelton10 years ago | 656 | left?: number |
1f817868Vladimir Kotikov9 years ago | 657 | minWidth?: number |
| 658 | maxWidth?: number | |
| 659 | minHeight?: number | |
| 660 | maxHeight?: number | |
d24fea86Joshua Skelton10 years ago | 661 | margin?: number |
| 662 | marginBottom?: number | |
| 663 | marginHorizontal?: number | |
| 664 | marginLeft?: number | |
| 665 | marginRight?: number | |
| 666 | marginTop?: number | |
| 667 | marginVertical?: number | |
1f817868Vladimir Kotikov9 years ago | 668 | overflow?: "visible" | "hidden" | "scroll" |
d24fea86Joshua Skelton10 years ago | 669 | padding?: number |
| 670 | paddingBottom?: number | |
| 671 | paddingHorizontal?: number | |
| 672 | paddingLeft?: number | |
| 673 | paddingRight?: number | |
| 674 | paddingTop?: number | |
| 675 | paddingVertical?: number | |
1f817868Vladimir Kotikov9 years ago | 676 | position?: "absolute" | "relative" |
d24fea86Joshua Skelton10 years ago | 677 | right?: number |
| 678 | top?: number | |
| 679 | width?: number | |
1f817868Vladimir Kotikov9 years ago | 680 | |
| 681 | /** | |
| 682 | * @platform ios | |
| 683 | */ | |
| 684 | zIndex?: number | |
| 685 | } | |
| 686 | | |
| 687 | /** | |
| 688 | * @see ShadowPropTypesIOS.js | |
| 689 | */ | |
| 690 | export interface ShadowPropTypesIOSStatic { | |
| 691 | /** | |
| 692 | * Sets the drop shadow color | |
| 693 | * @platform ios | |
| 694 | */ | |
| 695 | shadowColor: string | |
| 696 | | |
| 697 | /** | |
| 698 | * Sets the drop shadow offset | |
| 699 | * @platform ios | |
| 700 | */ | |
| 701 | shadowOffset: {width: number, height: number} | |
| 702 | | |
| 703 | /** | |
| 704 | * Sets the drop shadow opacity (multiplied by the color's alpha component) | |
| 705 | * @platform ios | |
| 706 | */ | |
| 707 | shadowOpacity: number | |
| 708 | | |
| 709 | /** | |
| 710 | * Sets the drop shadow blur radius | |
| 711 | * @platform ios | |
| 712 | */ | |
| 713 | shadowRadius: number | |
| 714 | } | |
| 715 | | |
| 716 | type GetCurrentPositionOptions = { | |
| 717 | timeout: number | |
| 718 | maximumAge: number | |
| 719 | enableHighAccuracy: boolean | |
| 720 | distanceFilter: number | |
| 721 | } | |
| 722 | | |
| 723 | type WatchPositionOptions = { | |
| 724 | timeout: number | |
| 725 | maximumAge: number | |
| 726 | enableHighAccuracy: boolean | |
| 727 | distanceFilter: number | |
| 728 | } | |
| 729 | | |
| 730 | type GeolocationReturnType = { | |
| 731 | coords: { | |
| 732 | latitude: number | |
| 733 | longitude: number | |
| 734 | altitude?: number | |
| 735 | accuracy?: number | |
| 736 | altitudeAccuracy?: number | |
| 737 | heading?: number | |
| 738 | speed?: number | |
| 739 | } | |
| 740 | timestamp: number | |
d24fea86Joshua Skelton10 years ago | 741 | } |
| 742 | | |
| 743 | | |
| 744 | export interface TransformsStyle { | |
| 745 | | |
| 746 | transform?: [{perspective: number}, {rotate: string}, {rotateX: string}, {rotateY: string}, {rotateZ: string}, {scale: number}, {scaleX: number}, {scaleY: number}, {translateX: number}, {translateY: number}, {skewX: string}, {skewY: string}] | |
| 747 | transformMatrix?: Array<number> | |
| 748 | rotation?: number | |
| 749 | scaleX?: number | |
| 750 | scaleY?: number | |
| 751 | translateX?: number | |
| 752 | translateY?: number | |
| 753 | } | |
| 754 | | |
| 755 | | |
| 756 | export interface StyleSheetProperties { | |
1f817868Vladimir Kotikov9 years ago | 757 | hairlineWidth: number |
| 758 | flatten<T extends string>(style: T): T | |
d24fea86Joshua Skelton10 years ago | 759 | } |
| 760 | | |
| 761 | export interface LayoutRectangle { | |
| 762 | x: number; | |
| 763 | y: number; | |
| 764 | width: number; | |
| 765 | height: number; | |
| 766 | } | |
| 767 | | |
| 768 | // @see TextProperties.onLayout | |
| 769 | export interface LayoutChangeEvent { | |
| 770 | nativeEvent: { | |
| 771 | layout: LayoutRectangle | |
| 772 | } | |
| 773 | } | |
| 774 | | |
1f817868Vladimir Kotikov9 years ago | 775 | export interface TextStyleIOS extends ViewStyle { |
| 776 | letterSpacing?: number | |
| 777 | textDecorationColor?: string | |
| 778 | textDecorationStyle?: "solid" | "double" | "dotted" | "dashed" | |
| 779 | writingDirection?: "auto" | "ltr" | "rtl" | |
| 780 | } | |
| 781 | | |
| 782 | export interface TextStyleAndroid extends ViewStyle { | |
| 783 | textAlignVertical?: "auto" | "top" | "bottom" | "center" | |
| 784 | } | |
| 785 | | |
d24fea86Joshua Skelton10 years ago | 786 | // @see https://facebook.github.io/react-native/docs/text.html#style |
1f817868Vladimir Kotikov9 years ago | 787 | export interface TextStyle extends TextStyleIOS, TextStyleAndroid, ViewStyle { |
d24fea86Joshua Skelton10 years ago | 788 | color?: string |
| 789 | fontFamily?: string | |
| 790 | fontSize?: number | |
1f817868Vladimir Kotikov9 years ago | 791 | fontStyle?: "normal" | "italic" |
| 792 | /** | |
| 793 | * Specifies font weight. The values 'normal' and 'bold' are supported | |
| 794 | * for most fonts. Not all fonts have a variant for each of the numeric | |
| 795 | * values, in that case the closest one is chosen. | |
| 796 | */ | |
| 797 | fontWeight?: "normal" | "bold" | "100" | "200" | "300" | "400" | "500" | "600" | "700" | "800" | "900" | |
d24fea86Joshua Skelton10 years ago | 798 | letterSpacing?: number |
| 799 | lineHeight?: number | |
1f817868Vladimir Kotikov9 years ago | 800 | /** |
| 801 | * Specifies text alignment. | |
| 802 | * The value 'justify' is only supported on iOS. | |
| 803 | */ | |
| 804 | textAlign?: "auto" | "left" | "right" | "center" | |
| 805 | textDecorationLine?: "none" | "underline" | "line-through" | "underline line-through" | |
| 806 | textDecorationStyle?: "solid" | "double" | "dotted" | "dashed" | |
d24fea86Joshua Skelton10 years ago | 807 | textDecorationColor?: string |
1f817868Vladimir Kotikov9 years ago | 808 | textShadowColor?: string |
| 809 | textShadowOffset?: {width: number, height: number} | |
| 810 | textShadowRadius?: number | |
| 811 | testID?: string | |
d24fea86Joshua Skelton10 years ago | 812 | } |
| 813 | | |
74953675Vladimir Kotikov9 years ago | 814 | export interface TextPropertiesIOS { |
1f817868Vladimir Kotikov9 years ago | 815 | /** |
| 816 | * Specifies whether fonts should scale to respect Text Size accessibility setting on iOS. The | |
| 817 | * default is `true`. | |
| 818 | */ | |
| 819 | allowFontScaling?: boolean | |
| 820 | | |
| 821 | /** | |
| 822 | * Specifies whether font should be scaled down automatically to fit given style constraints. | |
| 823 | */ | |
| 824 | adjustsFontSizeToFit?: boolean | |
| 825 | | |
| 826 | /** | |
| 827 | * Specifies smallest possible scale a font can reach when adjustsFontSizeToFit is enabled. (values 0.01-1.0). | |
| 828 | */ | |
| 829 | minimumFontScale?: number | |
d24fea86Joshua Skelton10 years ago | 830 | |
| 831 | /** | |
1f817868Vladimir Kotikov9 years ago | 832 | * When `true`, no visual change is made when text is pressed down. By |
| 833 | * default, a gray oval highlights the text on press down. | |
d24fea86Joshua Skelton10 years ago | 834 | */ |
| 835 | suppressHighlighting?: boolean | |
| 836 | } | |
| 837 | | |
74953675Vladimir Kotikov9 years ago | 838 | export interface TextPropertiesAndroid { |
1f817868Vladimir Kotikov9 years ago | 839 | /** |
| 840 | * Lets the user select text, to use the native copy and paste functionality. | |
| 841 | */ | |
| 842 | selectable?: boolean | |
| 843 | } | |
| 844 | | |
d24fea86Joshua Skelton10 years ago | 845 | // https://facebook.github.io/react-native/docs/text.html#props |
74953675Vladimir Kotikov9 years ago | 846 | export interface TextProperties extends TextPropertiesIOS, TextPropertiesAndroid, React.Props<TextStatic> { |
d24fea86Joshua Skelton10 years ago | 847 | |
| 848 | /** | |
1f817868Vladimir Kotikov9 years ago | 849 | * When set to `true`, indicates that the view is an accessibility element. The default value |
| 850 | * for a `Text` element is `true`. | |
| 851 | * | |
| 852 | * See the | |
| 853 | * [Accessibility guide](/react-native/docs/accessibility.html#accessible-ios-android) | |
| 854 | * for more information. | |
d24fea86Joshua Skelton10 years ago | 855 | */ |
1f817868Vladimir Kotikov9 years ago | 856 | accessible?: boolean |
| 857 | | |
| 858 | /** | |
| 859 | * This can be one of the following values: | |
| 860 | * | |
| 861 | * - `head` - The line is displayed so that the end fits in the container and the missing text | |
| 862 | * at the beginning of the line is indicated by an ellipsis glyph. e.g., "...wxyz" | |
| 863 | * - `middle` - The line is displayed so that the beginning and end fit in the container and the | |
| 864 | * missing text in the middle is indicated by an ellipsis glyph. "ab...yz" | |
| 865 | * - `tail` - The line is displayed so that the beginning fits in the container and the | |
| 866 | * missing text at the end of the line is indicated by an ellipsis glyph. e.g., "abcd..." | |
| 867 | * - `clip` - Lines are not drawn past the edge of the text container. | |
| 868 | * | |
| 869 | * The default is `tail`. | |
| 870 | * | |
| 871 | * `numberOfLines` must be set in conjunction with this prop. | |
| 872 | * | |
| 873 | * > `clip` is working only for iOS | |
| 874 | */ | |
| 875 | ellipsizeMode?: 'head' | 'middle' | 'tail' | 'clip' | |
| 876 | | |
| 877 | /** | |
| 878 | * Line Break mode. Works only with numberOfLines. | |
| 879 | * clip is working only for iOS | |
| 880 | */ | |
| 881 | lineBreakMode?: 'head' | 'middle' | 'tail' | 'clip' | |
d24fea86Joshua Skelton10 years ago | 882 | |
| 883 | /** | |
1f817868Vladimir Kotikov9 years ago | 884 | * Used to truncate the text with an ellipsis after computing the text |
| 885 | * layout, including line wrapping, such that the total number of lines | |
| 886 | * does not exceed this number. | |
| 887 | * | |
| 888 | * This prop is commonly used with `ellipsizeMode`. | |
d24fea86Joshua Skelton10 years ago | 889 | */ |
| 890 | numberOfLines?: number | |
| 891 | | |
| 892 | /** | |
| 893 | * Invoked on mount and layout changes with | |
| 894 | * | |
| 895 | * {nativeEvent: { layout: {x, y, width, height}}}. | |
| 896 | */ | |
| 897 | onLayout?: ( event: LayoutChangeEvent ) => void | |
| 898 | | |
| 899 | /** | |
| 900 | * This function is called on press. | |
| 901 | * Text intrinsically supports press handling with a default highlight state (which can be disabled with suppressHighlighting). | |
| 902 | */ | |
| 903 | onPress?: () => void | |
| 904 | | |
1f817868Vladimir Kotikov9 years ago | 905 | /** |
| 906 | * This function is called on long press. | |
| 907 | * e.g., `onLongPress={this.increaseSize}>`` | |
| 908 | */ | |
| 909 | onLongPress?: () => void | |
| 910 | | |
d24fea86Joshua Skelton10 years ago | 911 | /** |
| 912 | * @see https://facebook.github.io/react-native/docs/text.html#style | |
| 913 | */ | |
| 914 | style?: TextStyle | |
| 915 | | |
| 916 | /** | |
| 917 | * Used to locate this view in end-to-end tests. | |
| 918 | */ | |
| 919 | testID?: string | |
| 920 | } | |
| 921 | | |
| 922 | /** | |
| 923 | * A React component for displaying text which supports nesting, styling, and touch handling. | |
| 924 | */ | |
1f817868Vladimir Kotikov9 years ago | 925 | export interface TextStatic extends NativeMethodsMixin, React.ClassicComponentClass<TextProperties> {} |
d24fea86Joshua Skelton10 years ago | 926 | |
1f817868Vladimir Kotikov9 years ago | 927 | type DataDetectorTypes = 'phoneNumber' | 'link' | 'address' | 'calendarEvent' | 'none' | 'all'; |
| 928 | | |
| 929 | /** | |
| 930 | * DocumentSelectionState is responsible for maintaining selection information | |
| 931 | * for a document. | |
| 932 | * | |
| 933 | * It is intended for use by AbstractTextEditor-based components for | |
| 934 | * identifying the appropriate start/end positions to modify the | |
| 935 | * DocumentContent, and for programatically setting browser selection when | |
| 936 | * components re-render. | |
| 937 | */ | |
| 938 | export interface DocumentSelectionState extends EventEmitter { | |
| 939 | new(anchor: number, focus: number): DocumentSelectionState | |
| 940 | | |
| 941 | /** | |
| 942 | * Apply an update to the state. If either offset value has changed, | |
| 943 | * set the values and emit the `change` event. Otherwise no-op. | |
| 944 | * | |
| 945 | * @param {number} anchor | |
| 946 | * @param {number} focus | |
| 947 | */ | |
| 948 | update(anchor: number, focus: number): void | |
| 949 | | |
| 950 | /** | |
| 951 | * Given a max text length, constrain our selection offsets to ensure | |
| 952 | * that the selection remains strictly within the text range. | |
| 953 | * | |
| 954 | * @param {number} maxLength | |
| 955 | */ | |
| 956 | constrainLength(maxLength: number): void | |
d24fea86Joshua Skelton10 years ago | 957 | |
1f817868Vladimir Kotikov9 years ago | 958 | focus(): void |
| 959 | blur(): void | |
| 960 | hasFocus(): boolean | |
| 961 | isCollapsed(): boolean | |
| 962 | isBackward(): boolean | |
| 963 | | |
2060f3fbVladimir Kotikov9 years ago | 964 | getAnchorOffset(): number |
| 965 | getFocusOffset(): number | |
| 966 | getStartOffset(): number | |
| 967 | getEndOffset(): number | |
1f817868Vladimir Kotikov9 years ago | 968 | overlaps(start: number, end: number): boolean |
| 969 | } | |
d24fea86Joshua Skelton10 years ago | 970 | |
| 971 | /** | |
| 972 | * IOS Specific properties for TextInput | |
| 973 | * @see https://facebook.github.io/react-native/docs/textinput.html#props | |
| 974 | */ | |
| 975 | export interface TextInputIOSProperties { | |
| 976 | | |
| 977 | /** | |
| 978 | * enum('never', 'while-editing', 'unless-editing', 'always') | |
| 979 | * When the clear button should appear on the right side of the text view | |
| 980 | */ | |
1f817868Vladimir Kotikov9 years ago | 981 | clearButtonMode?: 'never' | 'while-editing' | 'unless-editing' | 'always' |
d24fea86Joshua Skelton10 years ago | 982 | |
| 983 | /** | |
| 984 | * If true, clears the text field automatically when editing begins | |
| 985 | */ | |
| 986 | clearTextOnFocus?: boolean | |
| 987 | | |
| 988 | /** | |
1f817868Vladimir Kotikov9 years ago | 989 | * Determines the types of data converted to clickable URLs in the text input. |
| 990 | * Only valid if `multiline={true}` and `editable={false}`. | |
| 991 | * By default no data types are detected. | |
| 992 | * | |
| 993 | * You can provide one type or an array of many types. | |
| 994 | * | |
| 995 | * Possible values for `dataDetectorTypes` are: | |
| 996 | * | |
| 997 | * - `'phoneNumber'` | |
| 998 | * - `'link'` | |
| 999 | * - `'address'` | |
| 1000 | * - `'calendarEvent'` | |
| 1001 | * - `'none'` | |
| 1002 | * - `'all'` | |
d24fea86Joshua Skelton10 years ago | 1003 | */ |
1f817868Vladimir Kotikov9 years ago | 1004 | dataDetectorTypes?: DataDetectorTypes | DataDetectorTypes[] |
d24fea86Joshua Skelton10 years ago | 1005 | |
| 1006 | /** | |
1f817868Vladimir Kotikov9 years ago | 1007 | * If true, the keyboard disables the return key when there is no text and automatically enables it when there is text. |
| 1008 | * The default value is false. | |
d24fea86Joshua Skelton10 years ago | 1009 | */ |
1f817868Vladimir Kotikov9 years ago | 1010 | enablesReturnKeyAutomatically?: boolean |
d24fea86Joshua Skelton10 years ago | 1011 | |
| 1012 | /** | |
1f817868Vladimir Kotikov9 years ago | 1013 | * Determines the color of the keyboard. |
d24fea86Joshua Skelton10 years ago | 1014 | */ |
1f817868Vladimir Kotikov9 years ago | 1015 | keyboardAppearance?: 'default' | 'light' | 'dark' |
d24fea86Joshua Skelton10 years ago | 1016 | |
| 1017 | /** | |
1f817868Vladimir Kotikov9 years ago | 1018 | * Callback that is called when a key is pressed. |
| 1019 | * Pressed key value is passed as an argument to the callback handler. | |
| 1020 | * Fires before onChange callbacks. | |
d24fea86Joshua Skelton10 years ago | 1021 | */ |
1f817868Vladimir Kotikov9 years ago | 1022 | onKeyPress?: (key: string) => void |
d24fea86Joshua Skelton10 years ago | 1023 | |
| 1024 | /** | |
| 1025 | * See DocumentSelectionState.js, some state that is responsible for maintaining selection information for a document | |
| 1026 | */ | |
1f817868Vladimir Kotikov9 years ago | 1027 | selectionState?: DocumentSelectionState |
d24fea86Joshua Skelton10 years ago | 1028 | } |
| 1029 | | |
| 1030 | /** | |
| 1031 | * Android Specific properties for TextInput | |
| 1032 | * @see https://facebook.github.io/react-native/docs/textinput.html#props | |
| 1033 | */ | |
| 1034 | export interface TextInputAndroidProperties { | |
| 1035 | | |
| 1036 | /** | |
1f817868Vladimir Kotikov9 years ago | 1037 | * If defined, the provided image resource will be rendered on the left. |
d24fea86Joshua Skelton10 years ago | 1038 | */ |
1f817868Vladimir Kotikov9 years ago | 1039 | inlineImageLeft?: string |
| 1040 | | |
| 1041 | /** | |
| 1042 | * Padding between the inline image, if any, and the text input itself. | |
| 1043 | */ | |
| 1044 | inlineImagePadding?: number | |
d24fea86Joshua Skelton10 years ago | 1045 | |
| 1046 | /** | |
1f817868Vladimir Kotikov9 years ago | 1047 | * Sets the number of lines for a TextInput. |
| 1048 | * Use it with multiline set to true to be able to fill the lines. | |
d24fea86Joshua Skelton10 years ago | 1049 | */ |
1f817868Vladimir Kotikov9 years ago | 1050 | numberOfLines?: number |
d24fea86Joshua Skelton10 years ago | 1051 | |
| 1052 | /** | |
1f817868Vladimir Kotikov9 years ago | 1053 | * Sets the return key to the label. Use it instead of `returnKeyType`. |
| 1054 | * @platform android | |
d24fea86Joshua Skelton10 years ago | 1055 | */ |
1f817868Vladimir Kotikov9 years ago | 1056 | returnKeyLabel?: string |
d24fea86Joshua Skelton10 years ago | 1057 | |
| 1058 | /** | |
| 1059 | * The color of the textInput underline. | |
| 1060 | */ | |
| 1061 | underlineColorAndroid?: string | |
| 1062 | } | |
| 1063 | | |
1f817868Vladimir Kotikov9 years ago | 1064 | export type KeyboardType = "default" | "email-address" | "numeric" | "phone-pad" |
| 1065 | export type KeyboardTypeIOS = "ascii-capable" | "numbers-and-punctuation" | "url" | "number-pad" | "name-phone-pad" | "decimal-pad" | "twitter" | "web-search" | |
| 1066 | | |
| 1067 | export type ReturnKeyType = "done" | "go" | "next" | "search" | "send" | |
| 1068 | export type ReturnKeyTypeAndroid = "none" | "previous" | |
| 1069 | export type ReturnKeyTypeIOS = "default" | "google" | "join" | "route" | "yahoo" | "emergency-call" | |
d24fea86Joshua Skelton10 years ago | 1070 | |
| 1071 | /** | |
| 1072 | * @see https://facebook.github.io/react-native/docs/textinput.html#props | |
| 1073 | */ | |
1f817868Vladimir Kotikov9 years ago | 1074 | export interface TextInputProperties extends ViewProperties, TextInputIOSProperties, TextInputAndroidProperties, React.Props<TextInputStatic> { |
d24fea86Joshua Skelton10 years ago | 1075 | |
| 1076 | /** | |
| 1077 | * Can tell TextInput to automatically capitalize certain characters. | |
| 1078 | * characters: all characters, | |
| 1079 | * words: first letter of each word | |
| 1080 | * sentences: first letter of each sentence (default) | |
| 1081 | * none: don't auto capitalize anything | |
| 1082 | * | |
| 1083 | * https://facebook.github.io/react-native/docs/textinput.html#autocapitalize | |
| 1084 | */ | |
1f817868Vladimir Kotikov9 years ago | 1085 | autoCapitalize?: "none" | "sentences" | "words" | "characters" |
d24fea86Joshua Skelton10 years ago | 1086 | |
| 1087 | /** | |
| 1088 | * If false, disables auto-correct. | |
| 1089 | * The default value is true. | |
| 1090 | */ | |
| 1091 | autoCorrect?: boolean | |
| 1092 | | |
| 1093 | /** | |
| 1094 | * If true, focuses the input on componentDidMount. | |
| 1095 | * The default value is false. | |
| 1096 | */ | |
| 1097 | autoFocus?: boolean | |
| 1098 | | |
1f817868Vladimir Kotikov9 years ago | 1099 | /** |
| 1100 | * If true, the text field will blur when submitted. | |
| 1101 | * The default value is true. | |
| 1102 | */ | |
| 1103 | blurOnSubmit?: boolean | |
| 1104 | | |
d24fea86Joshua Skelton10 years ago | 1105 | /** |
| 1106 | * Provides an initial value that will change when the user starts typing. | |
| 1107 | * Useful for simple use-cases where you don't want to deal with listening to events | |
| 1108 | * and updating the value prop to keep the controlled state in sync. | |
| 1109 | */ | |
| 1110 | defaultValue?: string | |
| 1111 | | |
| 1112 | /** | |
| 1113 | * If false, text is not editable. The default value is true. | |
| 1114 | */ | |
| 1115 | editable?: boolean | |
| 1116 | | |
| 1117 | /** | |
| 1118 | * enum("default", 'numeric', 'email-address', "ascii-capable", 'numbers-and-punctuation', 'url', 'number-pad', 'phone-pad', 'name-phone-pad', 'decimal-pad', 'twitter', 'web-search') | |
| 1119 | * Determines which keyboard to open, e.g.numeric. | |
1f817868Vladimir Kotikov9 years ago | 1120 | * The following values work across platforms: - default - numeric - email-address - phone-pad |
d24fea86Joshua Skelton10 years ago | 1121 | */ |
1f817868Vladimir Kotikov9 years ago | 1122 | keyboardType?: KeyboardType | KeyboardTypeIOS |
d24fea86Joshua Skelton10 years ago | 1123 | |
| 1124 | /** | |
| 1125 | * Limits the maximum number of characters that can be entered. | |
| 1126 | * Use this instead of implementing the logic in JS to avoid flicker. | |
| 1127 | */ | |
| 1128 | maxLength?: number | |
| 1129 | | |
| 1130 | /** | |
| 1131 | * If true, the text input can be multiple lines. The default value is false. | |
| 1132 | */ | |
| 1133 | multiline?: boolean | |
| 1134 | | |
| 1135 | /** | |
| 1136 | * Callback that is called when the text input is blurred | |
| 1137 | */ | |
| 1138 | onBlur?: () => void | |
| 1139 | | |
| 1140 | /** | |
| 1141 | * Callback that is called when the text input's text changes. | |
| 1142 | */ | |
| 1143 | onChange?: ( event: {nativeEvent: {text: string}} ) => void | |
| 1144 | | |
| 1145 | /** | |
| 1146 | * Callback that is called when the text input's text changes. | |
| 1147 | * Changed text is passed as an argument to the callback handler. | |
| 1148 | */ | |
| 1149 | onChangeText?: ( text: string ) => void | |
| 1150 | | |
1f817868Vladimir Kotikov9 years ago | 1151 | /** |
| 1152 | * Callback that is called when the text input's content size changes. | |
| 1153 | * This will be called with | |
| 1154 | * `{ nativeEvent: { contentSize: { width, height } } }`. | |
| 1155 | * | |
| 1156 | * Only called for multiline text inputs. | |
| 1157 | */ | |
| 1158 | onContentSizeChange?: ( event: {nativeEvent: {contentSize: { width: number, height: number}}} ) => void | |
| 1159 | | |
d24fea86Joshua Skelton10 years ago | 1160 | /** |
| 1161 | * Callback that is called when text input ends. | |
| 1162 | */ | |
| 1163 | onEndEditing?: ( event: {nativeEvent: {text: string}} ) => void | |
| 1164 | | |
| 1165 | /** | |
| 1166 | * Callback that is called when the text input is focused | |
| 1167 | */ | |
| 1168 | onFocus?: () => void | |
| 1169 | | |
| 1170 | /** | |
1f817868Vladimir Kotikov9 years ago | 1171 | * Callback that is called when the text input selection is changed. |
d24fea86Joshua Skelton10 years ago | 1172 | */ |
1f817868Vladimir Kotikov9 years ago | 1173 | onSelectionChange?: () => void |
d24fea86Joshua Skelton10 years ago | 1174 | |
| 1175 | /** | |
| 1176 | * Callback that is called when the text input's submit button is pressed. | |
| 1177 | */ | |
| 1178 | onSubmitEditing?: ( event: {nativeEvent: {text: string}} ) => void | |
| 1179 | | |
| 1180 | /** | |
| 1181 | * The string that will be rendered before text input has been entered | |
| 1182 | */ | |
| 1183 | placeholder?: string | |
| 1184 | | |
| 1185 | /** | |
| 1186 | * The text color of the placeholder string | |
| 1187 | */ | |
| 1188 | placeholderTextColor?: string | |
| 1189 | | |
1f817868Vladimir Kotikov9 years ago | 1190 | /** |
| 1191 | * enum('default', 'go', 'google', 'join', 'next', 'route', 'search', 'send', 'yahoo', 'done', 'emergency-call') | |
| 1192 | * Determines how the return key should look. | |
| 1193 | */ | |
| 1194 | returnKeyType?: ReturnKeyType | ReturnKeyTypeAndroid | ReturnKeyTypeIOS | |
| 1195 | | |
d24fea86Joshua Skelton10 years ago | 1196 | /** |
| 1197 | * If true, the text input obscures the text entered so that sensitive text like passwords stay secure. | |
| 1198 | * The default value is false. | |
| 1199 | */ | |
| 1200 | secureTextEntry?: boolean | |
| 1201 | | |
1f817868Vladimir Kotikov9 years ago | 1202 | /** |
| 1203 | * If true, all text will automatically be selected on focus | |
| 1204 | */ | |
| 1205 | selectTextOnFocus?: boolean | |
| 1206 | | |
| 1207 | /** | |
| 1208 | * The start and end of the text input's selection. Set start and end to | |
| 1209 | * the same value to position the cursor. | |
| 1210 | */ | |
| 1211 | selection?: { start: number, end?: number } | |
| 1212 | | |
| 1213 | /** | |
| 1214 | * The highlight (and cursor on ios) color of the text input | |
| 1215 | */ | |
| 1216 | selectionColor?: string | |
| 1217 | | |
d24fea86Joshua Skelton10 years ago | 1218 | /** |
| 1219 | * Styles | |
| 1220 | */ | |
| 1221 | style?: TextStyle | |
| 1222 | | |
| 1223 | /** | |
| 1224 | * Used to locate this view in end-to-end tests | |
| 1225 | */ | |
| 1226 | testID?: string | |
| 1227 | | |
| 1228 | /** | |
| 1229 | * The value to show for the text input. TextInput is a controlled component, | |
| 1230 | * which means the native value will be forced to match this value prop if provided. | |
| 1231 | * For most uses this works great, but in some cases this may cause flickering - one common cause is preventing edits by keeping value the same. | |
| 1232 | * In addition to simply setting the same value, either set editable={false}, | |
| 1233 | * or set/update maxLength to prevent unwanted edits without flicker. | |
| 1234 | */ | |
| 1235 | value?: string | |
| 1236 | | |
1f817868Vladimir Kotikov9 years ago | 1237 | ref?: Ref<ViewStatic & TextInputStatic> |
d24fea86Joshua Skelton10 years ago | 1238 | } |
| 1239 | | |
1f817868Vladimir Kotikov9 years ago | 1240 | /** |
| 1241 | * This class is responsible for coordinating the "focused" | |
| 1242 | * state for TextInputs. All calls relating to the keyboard | |
| 1243 | * should be funneled through here | |
| 1244 | */ | |
| 1245 | interface TextInputState { | |
| 1246 | /** | |
| 1247 | * Returns the ID of the currently focused text field, if one exists | |
| 1248 | * If no text field is focused it returns null | |
| 1249 | */ | |
2060f3fbVladimir Kotikov9 years ago | 1250 | currentlyFocusedField(): number |
1f817868Vladimir Kotikov9 years ago | 1251 | |
| 1252 | /** | |
| 1253 | * @param {number} TextInputID id of the text field to focus | |
| 1254 | * Focuses the specified text field | |
| 1255 | * noop if the text field was already focused | |
| 1256 | */ | |
2060f3fbVladimir Kotikov9 years ago | 1257 | focusTextInput(textFieldID?: number): void |
1f817868Vladimir Kotikov9 years ago | 1258 | |
| 1259 | /** | |
| 1260 | * @param {number} textFieldID id of the text field to focus | |
| 1261 | * Unfocuses the specified text field | |
| 1262 | * noop if it wasn't focused | |
| 1263 | */ | |
2060f3fbVladimir Kotikov9 years ago | 1264 | blurTextInput(textFieldID?: number) : void |
1f817868Vladimir Kotikov9 years ago | 1265 | } |
| 1266 | | |
| 1267 | /** | |
| 1268 | * @see https://facebook.github.io/react-native/docs/textinput.html#methods | |
| 1269 | */ | |
| 1270 | export interface TextInputStatic extends NativeMethodsMixin, TimerMixin, React.ComponentClass<TextInputProperties> { | |
| 1271 | State: TextInputState | |
| 1272 | | |
| 1273 | /** | |
| 1274 | * Returns if the input is currently focused. | |
| 1275 | */ | |
| 1276 | isFocused: () => boolean | |
| 1277 | | |
| 1278 | /** | |
| 1279 | * Removes all text from the input. | |
| 1280 | */ | |
| 1281 | clear: () => void | |
| 1282 | } | |
| 1283 | | |
| 1284 | export type ToolbarAndroidAction = { | |
| 1285 | /** | |
| 1286 | * title: required, the title of this action | |
| 1287 | */ | |
| 1288 | title: string | |
| 1289 | | |
| 1290 | /** | |
| 1291 | * icon: the icon for this action, e.g. require('./some_icon.png') | |
| 1292 | */ | |
2060f3fbVladimir Kotikov9 years ago | 1293 | icon?: ImageURISource |
1f817868Vladimir Kotikov9 years ago | 1294 | |
| 1295 | /** | |
| 1296 | * show: when to show this action as an icon or hide it in the overflow menu: always, ifRoom or never | |
| 1297 | */ | |
| 1298 | show?: "always" | "ifRoom" | "never" | |
| 1299 | | |
| 1300 | /** | |
| 1301 | * showWithText: boolean, whether to show text alongside the icon or not | |
| 1302 | */ | |
| 1303 | showWithText?: boolean | |
| 1304 | } | |
| 1305 | | |
| 1306 | export interface ToolbarAndroidProperties extends ViewProperties, React.Props<ToolbarAndroidStatic> { | |
| 1307 | | |
| 1308 | /** | |
| 1309 | * Sets possible actions on the toolbar as part of the action menu. These are displayed as icons | |
| 1310 | * or text on the right side of the widget. If they don't fit they are placed in an 'overflow' | |
| 1311 | * menu. | |
| 1312 | * | |
| 1313 | * This property takes an array of objects, where each object has the following keys: | |
| 1314 | * | |
| 1315 | * * `title`: **required**, the title of this action | |
| 1316 | * * `icon`: the icon for this action, e.g. `require('./some_icon.png')` | |
| 1317 | * * `show`: when to show this action as an icon or hide it in the overflow menu: `always`, | |
| 1318 | * `ifRoom` or `never` | |
| 1319 | * * `showWithText`: boolean, whether to show text alongside the icon or not | |
| 1320 | */ | |
| 1321 | actions?: ToolbarAndroidAction[] | |
| 1322 | | |
| 1323 | /** | |
| 1324 | * Sets the content inset for the toolbar ending edge. | |
| 1325 | * The content inset affects the valid area for Toolbar content other | |
| 1326 | * than the navigation button and menu. Insets define the minimum | |
| 1327 | * margin for these components and can be used to effectively align | |
| 1328 | * Toolbar content along well-known gridlines. | |
| 1329 | */ | |
| 1330 | contentInsetEnd?: number | |
| 1331 | | |
| 1332 | /** | |
| 1333 | * Sets the content inset for the toolbar starting edge. | |
| 1334 | * The content inset affects the valid area for Toolbar content | |
| 1335 | * other than the navigation button and menu. Insets define the | |
| 1336 | * minimum margin for these components and can be used to effectively | |
| 1337 | * align Toolbar content along well-known gridlines. | |
| 1338 | */ | |
| 1339 | contentInsetStart?: number | |
| 1340 | | |
| 1341 | /** | |
| 1342 | * Sets the toolbar logo. | |
| 1343 | */ | |
2060f3fbVladimir Kotikov9 years ago | 1344 | logo?: ImageURISource |
1f817868Vladimir Kotikov9 years ago | 1345 | |
| 1346 | /** | |
| 1347 | * Sets the navigation icon. | |
| 1348 | */ | |
2060f3fbVladimir Kotikov9 years ago | 1349 | navIcon?: ImageURISource |
1f817868Vladimir Kotikov9 years ago | 1350 | |
| 1351 | /** | |
| 1352 | * Callback that is called when an action is selected. The only | |
| 1353 | * argument that is passed to the callback is the position of the | |
| 1354 | * action in the actions array. | |
| 1355 | */ | |
| 1356 | onActionSelected?: (position: number) => void | |
| 1357 | | |
| 1358 | /** | |
| 1359 | * Callback called when the icon is selected. | |
| 1360 | */ | |
| 1361 | onIconClicked?: () => void | |
| 1362 | | |
| 1363 | /** | |
| 1364 | * Sets the overflow icon. | |
| 1365 | */ | |
2060f3fbVladimir Kotikov9 years ago | 1366 | overflowIcon?: ImageURISource |
1f817868Vladimir Kotikov9 years ago | 1367 | |
| 1368 | /** | |
| 1369 | * Used to set the toolbar direction to RTL. | |
| 1370 | * In addition to this property you need to add | |
| 1371 | * android:supportsRtl="true" | |
| 1372 | * to your application AndroidManifest.xml and then call | |
| 1373 | * setLayoutDirection(LayoutDirection.RTL) in your MainActivity | |
| 1374 | * onCreate method. | |
| 1375 | */ | |
| 1376 | rtl?: boolean | |
| 1377 | | |
| 1378 | /** | |
| 1379 | * Sets the toolbar subtitle. | |
| 1380 | */ | |
| 1381 | subtitle?: string | |
| 1382 | | |
| 1383 | /** | |
| 1384 | * Sets the toolbar subtitle color. | |
| 1385 | */ | |
| 1386 | subtitleColor?: string | |
| 1387 | | |
| 1388 | /** | |
| 1389 | * Used to locate this view in end-to-end tests. | |
| 1390 | */ | |
| 1391 | testID?: string | |
| 1392 | | |
| 1393 | /** | |
| 1394 | * Sets the toolbar title. | |
| 1395 | */ | |
| 1396 | title?: string | |
| 1397 | | |
| 1398 | /** | |
| 1399 | * Sets the toolbar title color. | |
| 1400 | */ | |
| 1401 | titleColor?: string | |
| 1402 | | |
| 1403 | ref?: Ref<ToolbarAndroidStatic> | |
| 1404 | } | |
| 1405 | | |
| 1406 | /** | |
| 1407 | * React component that wraps the Android-only [`Toolbar` widget][0]. A Toolbar can display a logo, | |
| 1408 | * navigation icon (e.g. hamburger menu), a title & subtitle and a list of actions. The title and | |
| 1409 | * subtitle are expanded so the logo and navigation icons are displayed on the left, title and | |
| 1410 | * subtitle in the middle and the actions on the right. | |
| 1411 | * | |
| 1412 | * If the toolbar has an only child, it will be displayed between the title and actions. | |
| 1413 | * | |
| 1414 | * Although the Toolbar supports remote images for the logo, navigation and action icons, this | |
| 1415 | * should only be used in DEV mode where `require('./some_icon.png')` translates into a packager | |
| 1416 | * URL. In release mode you should always use a drawable resource for these icons. Using | |
| 1417 | * `require('./some_icon.png')` will do this automatically for you, so as long as you don't | |
| 1418 | * explicitly use e.g. `{uri: 'http://...'}`, you will be good. | |
| 1419 | * | |
| 1420 | * Example: | |
| 1421 | * | |
| 1422 | * ``` | |
| 1423 | * render: function() { | |
| 1424 | * return ( | |
| 1425 | * <ToolbarAndroid | |
| 1426 | * logo={require('./app_logo.png')} | |
| 1427 | * title="AwesomeApp" | |
| 1428 | * actions={[{title: 'Settings', icon: require('./icon_settings.png'), show: 'always'}]} | |
| 1429 | * onActionSelected={this.onActionSelected} /> | |
| 1430 | * ) | |
| 1431 | * }, | |
| 1432 | * onActionSelected: function(position) { | |
| 1433 | * if (position === 0) { // index of 'Settings' | |
| 1434 | * showSettings(); | |
| 1435 | * } | |
| 1436 | * } | |
| 1437 | * ``` | |
| 1438 | * | |
| 1439 | * [0]: https://developer.android.com/reference/android/support/v7/widget/Toolbar.html | |
| 1440 | */ | |
| 1441 | export interface ToolbarAndroidStatic extends NativeMethodsMixin, React.ComponentClass<ToolbarAndroidProperties> {} | |
| 1442 | | |
| 1443 | | |
d24fea86Joshua Skelton10 years ago | 1444 | /** |
| 1445 | * Gesture recognition on mobile devices is much more complicated than web. | |
| 1446 | * A touch can go through several phases as the app determines what the user's intention is. | |
| 1447 | * For example, the app needs to determine if the touch is scrolling, sliding on a widget, or tapping. | |
| 1448 | * This can even change during the duration of a touch. There can also be multiple simultaneous touches. | |
| 1449 | * | |
| 1450 | * The touch responder system is needed to allow components to negotiate these touch interactions | |
| 1451 | * without any additional knowledge about their parent or child components. | |
| 1452 | * This system is implemented in ResponderEventPlugin.js, which contains further details and documentation. | |
| 1453 | * | |
| 1454 | * Best Practices | |
| 1455 | * Users can feel huge differences in the usability of web apps vs. native, and this is one of the big causes. | |
| 1456 | * Every action should have the following attributes: | |
| 1457 | * Feedback/highlighting- show the user what is handling their touch, and what will happen when they release the gesture | |
| 1458 | * Cancel-ability- when making an action, the user should be able to abort it mid-touch by dragging their finger away | |
| 1459 | * | |
| 1460 | * These features make users more comfortable while using an app, | |
| 1461 | * because it allows people to experiment and interact without fear of making mistakes. | |
| 1462 | * | |
| 1463 | * TouchableHighlight and Touchable* | |
| 1464 | * The responder system can be complicated to use. | |
| 1465 | * So we have provided an abstract Touchable implementation for things that should be "tappable". | |
| 1466 | * This uses the responder system and allows you to easily configure tap interactions declaratively. | |
| 1467 | * Use TouchableHighlight anywhere where you would use a button or link on web. | |
| 1468 | */ | |
| 1469 | export interface GestureResponderHandlers { | |
| 1470 | | |
| 1471 | /** | |
| 1472 | * A view can become the touch responder by implementing the correct negotiation methods. | |
| 1473 | * There are two methods to ask the view if it wants to become responder: | |
| 1474 | */ | |
| 1475 | | |
| 1476 | /** | |
| 1477 | * Does this view want to become responder on the start of a touch? | |
| 1478 | */ | |
| 1479 | onStartShouldSetResponder?: ( event: GestureResponderEvent ) => boolean | |
| 1480 | | |
| 1481 | /** | |
| 1482 | * Called for every touch move on the View when it is not the responder: does this view want to "claim" touch responsiveness? | |
| 1483 | */ | |
| 1484 | onMoveShouldSetResponder?: ( event: GestureResponderEvent ) => boolean | |
| 1485 | | |
| 1486 | /** | |
| 1487 | * If the View returns true and attempts to become the responder, one of the following will happen: | |
| 1488 | */ | |
| 1489 | | |
1f817868Vladimir Kotikov9 years ago | 1490 | onResponderEnd?: ( event: GestureResponderEvent ) => void |
| 1491 | | |
d24fea86Joshua Skelton10 years ago | 1492 | /** |
| 1493 | * The View is now responding for touch events. | |
| 1494 | * This is the time to highlight and show the user what is happening | |
| 1495 | */ | |
| 1496 | onResponderGrant?: ( event: GestureResponderEvent ) => void | |
| 1497 | | |
| 1498 | /** | |
| 1499 | * Something else is the responder right now and will not release it | |
| 1500 | */ | |
| 1501 | onResponderReject?: ( event: GestureResponderEvent ) => void | |
| 1502 | | |
| 1503 | /** | |
| 1504 | * If the view is responding, the following handlers can be called: | |
| 1505 | */ | |
| 1506 | | |
| 1507 | /** | |
| 1508 | * The user is moving their finger | |
| 1509 | */ | |
| 1510 | onResponderMove?: ( event: GestureResponderEvent ) => void | |
| 1511 | | |
| 1512 | /** | |
| 1513 | * Fired at the end of the touch, ie "touchUp" | |
| 1514 | */ | |
| 1515 | onResponderRelease?: ( event: GestureResponderEvent ) => void | |
| 1516 | | |
1f817868Vladimir Kotikov9 years ago | 1517 | onResponderStart?: ( event: GestureResponderEvent ) => void |
| 1518 | | |
d24fea86Joshua Skelton10 years ago | 1519 | /** |
| 1520 | * Something else wants to become responder. | |
| 1521 | * Should this view release the responder? Returning true allows release | |
| 1522 | */ | |
| 1523 | onResponderTerminationRequest?: ( event: GestureResponderEvent ) => boolean | |
| 1524 | | |
| 1525 | /** | |
| 1526 | * The responder has been taken from the View. | |
| 1527 | * Might be taken by other views after a call to onResponderTerminationRequest, | |
| 1528 | * or might be taken by the OS without asking (happens with control center/ notification center on iOS) | |
| 1529 | */ | |
| 1530 | onResponderTerminate?: ( event: GestureResponderEvent ) => void | |
| 1531 | | |
| 1532 | /** | |
| 1533 | * onStartShouldSetResponder and onMoveShouldSetResponder are called with a bubbling pattern, | |
| 1534 | * where the deepest node is called first. | |
| 1535 | * That means that the deepest component will become responder when multiple Views return true for *ShouldSetResponder handlers. | |
| 1536 | * This is desirable in most cases, because it makes sure all controls and buttons are usable. | |
| 1537 | * | |
| 1538 | * However, sometimes a parent will want to make sure that it becomes responder. | |
| 1539 | * This can be handled by using the capture phase. | |
| 1540 | * Before the responder system bubbles up from the deepest component, | |
| 1541 | * it will do a capture phase, firing on*ShouldSetResponderCapture. | |
| 1542 | * So if a parent View wants to prevent the child from becoming responder on a touch start, | |
| 1543 | * it should have a onStartShouldSetResponderCapture handler which returns true. | |
| 1544 | */ | |
| 1545 | onStartShouldSetResponderCapture?: ( event: GestureResponderEvent ) => boolean | |
| 1546 | | |
| 1547 | /** | |
| 1548 | * onStartShouldSetResponder and onMoveShouldSetResponder are called with a bubbling pattern, | |
| 1549 | * where the deepest node is called first. | |
| 1550 | * That means that the deepest component will become responder when multiple Views return true for *ShouldSetResponder handlers. | |
| 1551 | * This is desirable in most cases, because it makes sure all controls and buttons are usable. | |
| 1552 | * | |
| 1553 | * However, sometimes a parent will want to make sure that it becomes responder. | |
| 1554 | * This can be handled by using the capture phase. | |
| 1555 | * Before the responder system bubbles up from the deepest component, | |
| 1556 | * it will do a capture phase, firing on*ShouldSetResponderCapture. | |
| 1557 | * So if a parent View wants to prevent the child from becoming responder on a touch start, | |
| 1558 | * it should have a onStartShouldSetResponderCapture handler which returns true. | |
| 1559 | */ | |
| 1560 | onMoveShouldSetResponderCapture?: () => void; | |
| 1561 | | |
| 1562 | } | |
| 1563 | | |
| 1564 | // @see https://facebook.github.io/react-native/docs/view.html#style | |
| 1565 | export interface ViewStyle extends FlexStyle, TransformsStyle { | |
1f817868Vladimir Kotikov9 years ago | 1566 | backfaceVisibility?: "visible" | "hidden" |
d24fea86Joshua Skelton10 years ago | 1567 | backgroundColor?: string; |
| 1568 | borderBottomColor?: string; | |
| 1569 | borderBottomLeftRadius?: number; | |
| 1570 | borderBottomRightRadius?: number; | |
1f817868Vladimir Kotikov9 years ago | 1571 | borderBottomWidth?: number; |
d24fea86Joshua Skelton10 years ago | 1572 | borderColor?: string; |
| 1573 | borderLeftColor?: string; | |
| 1574 | borderRadius?: number; | |
| 1575 | borderRightColor?: string; | |
1f817868Vladimir Kotikov9 years ago | 1576 | borderRightWidth?: number; |
| 1577 | borderStyle?: "solid" | "dotted" | "dashed" | |
d24fea86Joshua Skelton10 years ago | 1578 | borderTopColor?: string; |
| 1579 | borderTopLeftRadius?: number; | |
| 1580 | borderTopRightRadius?: number; | |
1f817868Vladimir Kotikov9 years ago | 1581 | borderTopWidth?: number |
d24fea86Joshua Skelton10 years ago | 1582 | opacity?: number; |
1f817868Vladimir Kotikov9 years ago | 1583 | overflow?: "visible" | "hidden" |
d24fea86Joshua Skelton10 years ago | 1584 | shadowColor?: string; |
| 1585 | shadowOffset?: {width: number, height: number}; | |
| 1586 | shadowOpacity?: number; | |
| 1587 | shadowRadius?: number; | |
1f817868Vladimir Kotikov9 years ago | 1588 | elevation?: number; |
| 1589 | testID?: string; | |
d24fea86Joshua Skelton10 years ago | 1590 | } |
| 1591 | | |
| 1592 | export interface ViewPropertiesIOS { | |
| 1593 | | |
| 1594 | /** | |
| 1595 | * Provides additional traits to screen reader. | |
| 1596 | * By default no traits are provided unless specified otherwise in element | |
| 1597 | * | |
| 1598 | * @enum('none', 'button', 'link', 'header', 'search', 'image', 'selected', 'plays', 'key', 'text','summary', 'disabled', 'frequentUpdates', 'startsMedia', 'adjustable', 'allowsDirectInteraction', 'pageTurn') | |
| 1599 | */ | |
1f817868Vladimir Kotikov9 years ago | 1600 | accessibilityTraits?: ViewAccessibilityTraits | ViewAccessibilityTraits[]; |
d24fea86Joshua Skelton10 years ago | 1601 | |
| 1602 | /** | |
| 1603 | * Whether this view should be rendered as a bitmap before compositing. | |
| 1604 | * | |
| 1605 | * On iOS, this is useful for animations and interactions that do not modify this component's dimensions nor its children; | |
| 1606 | * for example, when translating the position of a static view, rasterization allows the renderer to reuse a cached bitmap of a static view | |
| 1607 | * and quickly composite it during each frame. | |
| 1608 | * | |
| 1609 | * Rasterization incurs an off-screen drawing pass and the bitmap consumes memory. | |
| 1610 | * Test and measure when using this property. | |
| 1611 | */ | |
| 1612 | shouldRasterizeIOS?: boolean | |
| 1613 | } | |
| 1614 | | |
| 1615 | export interface ViewPropertiesAndroid { | |
| 1616 | | |
| 1617 | /** | |
| 1618 | * Indicates to accessibility services to treat UI component like a native one. | |
| 1619 | * Works for Android only. | |
| 1620 | * | |
| 1621 | * @enum('none', 'button', 'radiobutton_checked', 'radiobutton_unchecked' ) | |
| 1622 | */ | |
1f817868Vladimir Kotikov9 years ago | 1623 | accessibilityComponentType?: 'none' | 'button' | 'radiobutton_checked' | 'radiobutton_unchecked' |
d24fea86Joshua Skelton10 years ago | 1624 | |
| 1625 | | |
| 1626 | /** | |
| 1627 | * Indicates to accessibility services whether the user should be notified when this view changes. | |
| 1628 | * Works for Android API >= 19 only. | |
| 1629 | * See http://developer.android.com/reference/android/view/View.html#attr_android:accessibilityLiveRegion for references. | |
| 1630 | */ | |
1f817868Vladimir Kotikov9 years ago | 1631 | accessibilityLiveRegion?: 'none' | 'polite' | 'assertive' |
d24fea86Joshua Skelton10 years ago | 1632 | |
| 1633 | /** | |
| 1634 | * Views that are only used to layout their children or otherwise don't draw anything | |
| 1635 | * may be automatically removed from the native hierarchy as an optimization. | |
| 1636 | * Set this property to false to disable this optimization and ensure that this View exists in the native view hierarchy. | |
| 1637 | */ | |
| 1638 | collapsable?: boolean | |
| 1639 | | |
| 1640 | | |
| 1641 | /** | |
| 1642 | * Controls how view is important for accessibility which is if it fires accessibility events | |
| 1643 | * and if it is reported to accessibility services that query the screen. | |
| 1644 | * Works for Android only. See http://developer.android.com/reference/android/R.attr.html#importantForAccessibility for references. | |
| 1645 | * | |
| 1646 | * Possible values: | |
| 1647 | * 'auto' - The system determines whether the view is important for accessibility - default (recommended). | |
| 1648 | * 'yes' - The view is important for accessibility. | |
| 1649 | * 'no' - The view is not important for accessibility. | |
| 1650 | * 'no-hide-descendants' - The view is not important for accessibility, nor are any of its descendant views. | |
| 1651 | */ | |
1f817868Vladimir Kotikov9 years ago | 1652 | importantForAccessibility?: 'auto' | 'yes' | 'no' | 'no-hide-descendants' |
d24fea86Joshua Skelton10 years ago | 1653 | |
| 1654 | | |
| 1655 | /** | |
| 1656 | * Whether this view needs to rendered offscreen and composited with an alpha in order to preserve 100% correct colors and blending behavior. | |
| 1657 | * The default (false) falls back to drawing the component and its children | |
| 1658 | * with an alpha applied to the paint used to draw each element instead of rendering the full component offscreen and compositing it back with an alpha value. | |
| 1659 | * This default may be noticeable and undesired in the case where the View you are setting an opacity on | |
| 1660 | * has multiple overlapping elements (e.g. multiple overlapping Views, or text and a background). | |
| 1661 | * | |
| 1662 | * Rendering offscreen to preserve correct alpha behavior is extremely expensive | |
| 1663 | * and hard to debug for non-native developers, which is why it is not turned on by default. | |
| 1664 | * If you do need to enable this property for an animation, | |
| 1665 | * consider combining it with renderToHardwareTextureAndroid if the view contents are static (i.e. it doesn't need to be redrawn each frame). | |
| 1666 | * If that property is enabled, this View will be rendered off-screen once, | |
| 1667 | * saved in a hardware texture, and then composited onto the screen with an alpha each frame without having to switch rendering targets on the GPU. | |
| 1668 | */ | |
| 1669 | needsOffscreenAlphaCompositing?: boolean | |
| 1670 | | |
| 1671 | | |
| 1672 | /** | |
| 1673 | * Whether this view should render itself (and all of its children) into a single hardware texture on the GPU. | |
| 1674 | * | |
| 1675 | * On Android, this is useful for animations and interactions that only modify opacity, rotation, translation, and/or scale: | |
| 1676 | * in those cases, the view doesn't have to be redrawn and display lists don't need to be re-executed. The texture can just be | |
| 1677 | * re-used and re-composited with different parameters. The downside is that this can use up limited video memory, so this prop should be set back to false at the end of the interaction/animation. | |
| 1678 | */ | |
| 1679 | renderToHardwareTextureAndroid?: boolean; | |
| 1680 | | |
| 1681 | } | |
| 1682 | | |
| 1683 | /** | |
| 1684 | * @see https://facebook.github.io/react-native/docs/view.html#props | |
| 1685 | */ | |
| 1686 | export interface ViewProperties extends ViewPropertiesAndroid, ViewPropertiesIOS, GestureResponderHandlers, Touchable, React.Props<ViewStatic> { | |
| 1687 | | |
| 1688 | /** | |
| 1689 | * Overrides the text that's read by the screen reader when the user interacts with the element. By default, the label is constructed by traversing all the children and accumulating all the Text nodes separated by space. | |
| 1690 | */ | |
| 1691 | accessibilityLabel?: string; | |
| 1692 | | |
| 1693 | /** | |
| 1694 | * When true, indicates that the view is an accessibility element. | |
| 1695 | * By default, all the touchable elements are accessible. | |
| 1696 | */ | |
| 1697 | accessible?: boolean; | |
| 1698 | | |
1f817868Vladimir Kotikov9 years ago | 1699 | /** |
| 1700 | * This defines how far a touch event can start away from the view. | |
| 1701 | * Typical interface guidelines recommend touch targets that are at least | |
| 1702 | * 30 - 40 points/density-independent pixels. If a Touchable view has | |
| 1703 | * a height of 20 the touchable height can be extended to 40 with | |
| 1704 | * hitSlop={{top: 10, bottom: 10, left: 0, right: 0}} | |
| 1705 | * NOTE The touch area never extends past the parent view bounds and | |
| 1706 | * the Z-index of sibling views always takes precedence if a touch | |
| 1707 | * hits two overlapping views. | |
| 1708 | */ | |
| 1709 | | |
| 1710 | hitSlop?: Insets | |
| 1711 | | |
d24fea86Joshua Skelton10 years ago | 1712 | /** |
| 1713 | * When `accessible` is true, the system will try to invoke this function when the user performs accessibility tap gesture. | |
| 1714 | */ | |
| 1715 | onAcccessibilityTap?: () => void; | |
| 1716 | | |
| 1717 | /** | |
| 1718 | * Invoked on mount and layout changes with | |
| 1719 | * | |
| 1720 | * {nativeEvent: { layout: {x, y, width, height}}}. | |
| 1721 | */ | |
| 1722 | onLayout?: ( event: LayoutChangeEvent ) => void; | |
| 1723 | | |
| 1724 | /** | |
| 1725 | * When accessible is true, the system will invoke this function when the user performs the magic tap gesture. | |
| 1726 | */ | |
| 1727 | onMagicTap?: () => void; | |
| 1728 | | |
| 1729 | /** | |
| 1730 | * | |
| 1731 | * In the absence of auto property, none is much like CSS's none value. box-none is as if you had applied the CSS class: | |
| 1732 | * | |
| 1733 | * .box-none { | |
| 1734 | * pointer-events: none; | |
| 1735 | * } | |
| 1736 | * .box-none * { | |
| 1737 | * pointer-events: all; | |
| 1738 | * } | |
| 1739 | * | |
| 1740 | * box-only is the equivalent of | |
| 1741 | * | |
| 1742 | * .box-only { | |
| 1743 | * pointer-events: all; | |
| 1744 | * } | |
| 1745 | * .box-only * { | |
| 1746 | * pointer-events: none; | |
| 1747 | * } | |
| 1748 | * | |
| 1749 | * But since pointerEvents does not affect layout/appearance, and we are already deviating from the spec by adding additional modes, | |
| 1750 | * we opt to not include pointerEvents on style. On some platforms, we would need to implement it as a className anyways. Using style or not is an implementation detail of the platform. | |
| 1751 | */ | |
1f817868Vladimir Kotikov9 years ago | 1752 | pointerEvents?: "box-none" | "none" | "box-only" | "auto" |
d24fea86Joshua Skelton10 years ago | 1753 | |
| 1754 | /** | |
| 1755 | * | |
| 1756 | * This is a special performance property exposed by RCTView and is useful for scrolling content when there are many subviews, | |
| 1757 | * most of which are offscreen. For this property to be effective, it must be applied to a view that contains many subviews that extend outside its bound. | |
| 1758 | * The subviews must also have overflow: hidden, as should the containing view (or one of its superviews). | |
| 1759 | */ | |
| 1760 | removeClippedSubviews?: boolean | |
| 1761 | | |
| 1762 | style?: ViewStyle; | |
| 1763 | | |
| 1764 | /** | |
| 1765 | * Used to locate this view in end-to-end tests. | |
| 1766 | */ | |
| 1767 | testID?: string; | |
| 1768 | } | |
| 1769 | | |
| 1770 | /** | |
| 1771 | * The most fundamental component for building UI, View is a container that supports layout with flexbox, style, some touch handling, | |
| 1772 | * and accessibility controls, and is designed to be nested inside other views and to have 0 to many children of any type. | |
| 1773 | * View maps directly to the native view equivalent on whatever platform React is running on, | |
| 1774 | * whether that is a UIView, <div>, android.view, etc. | |
| 1775 | */ | |
1f817868Vladimir Kotikov9 years ago | 1776 | export interface ViewStatic extends NativeMethodsMixin, React.ClassicComponentClass<ViewProperties> { |
| 1777 | AccessibilityTraits: [ | |
| 1778 | 'none', | |
| 1779 | 'button', | |
| 1780 | 'link', | |
| 1781 | 'header', | |
| 1782 | 'search', | |
| 1783 | 'image', | |
| 1784 | 'selected', | |
| 1785 | 'plays', | |
| 1786 | 'key', | |
| 1787 | 'text', | |
| 1788 | 'summary', | |
| 1789 | 'disabled', | |
| 1790 | 'frequentUpdates', | |
| 1791 | 'startsMedia', | |
| 1792 | 'adjustable', | |
| 1793 | 'allowsDirectInteraction', | |
| 1794 | 'pageTurn' | |
| 1795 | ] | |
| 1796 | | |
| 1797 | AccessibilityComponentType: [ | |
| 1798 | 'none', | |
| 1799 | 'button', | |
| 1800 | 'radiobutton_checked', | |
| 1801 | 'radiobutton_unchecked' | |
| 1802 | ], | |
| 1803 | | |
| 1804 | /** | |
| 1805 | * Is 3D Touch / Force Touch available (i.e. will touch events include `force`) | |
| 1806 | * @platform ios | |
| 1807 | */ | |
| 1808 | forceTouchAvailable: boolean, | |
d24fea86Joshua Skelton10 years ago | 1809 | } |
| 1810 | | |
| 1811 | /** | |
1f817868Vladimir Kotikov9 years ago | 1812 | * @see https://facebook.github.io/react-native/docs/viewpagerandroid.html#props |
d24fea86Joshua Skelton10 years ago | 1813 | */ |
| 1814 | | |
| 1815 | | |
1f817868Vladimir Kotikov9 years ago | 1816 | export interface ViewPagerAndroidOnPageScrollEventData { |
| 1817 | position: number; | |
| 1818 | offset: number; | |
d24fea86Joshua Skelton10 years ago | 1819 | } |
| 1820 | | |
1f817868Vladimir Kotikov9 years ago | 1821 | export interface ViewPagerAndroidOnPageSelectedEventData { |
| 1822 | position: number; | |
| 1823 | } | |
d24fea86Joshua Skelton10 years ago | 1824 | |
1f817868Vladimir Kotikov9 years ago | 1825 | export interface ViewPagerAndroidProperties extends ViewProperties { |
d24fea86Joshua Skelton10 years ago | 1826 | /** |
1f817868Vladimir Kotikov9 years ago | 1827 | * Index of initial page that should be selected. Use `setPage` method to |
| 1828 | * update the page, and `onPageSelected` to monitor page changes | |
d24fea86Joshua Skelton10 years ago | 1829 | */ |
1f817868Vladimir Kotikov9 years ago | 1830 | initialPage?: number; |
d24fea86Joshua Skelton10 years ago | 1831 | |
| 1832 | /** | |
1f817868Vladimir Kotikov9 years ago | 1833 | * When false, the content does not scroll. |
| 1834 | * The default value is true. | |
d24fea86Joshua Skelton10 years ago | 1835 | */ |
1f817868Vladimir Kotikov9 years ago | 1836 | scrollEnabled?: boolean; |
d24fea86Joshua Skelton10 years ago | 1837 | |
1f817868Vladimir Kotikov9 years ago | 1838 | /** |
| 1839 | * Executed when transitioning between pages (ether because of animation for | |
| 1840 | * the requested page change or when user is swiping/dragging between pages) | |
| 1841 | * The `event.nativeEvent` object for this callback will carry following data: | |
| 1842 | * - position - index of first page from the left that is currently visible | |
| 1843 | * - offset - value from range [0,1) describing stage between page transitions. | |
| 1844 | * Value x means that (1 - x) fraction of the page at "position" index is | |
| 1845 | * visible, and x fraction of the next page is visible. | |
| 1846 | */ | |
| 1847 | onPageScroll?: ( event: NativeSyntheticEvent<ViewPagerAndroidOnPageScrollEventData> ) => void; | |
d24fea86Joshua Skelton10 years ago | 1848 | |
| 1849 | /** | |
1f817868Vladimir Kotikov9 years ago | 1850 | * This callback will be called once ViewPager finish navigating to selected page |
| 1851 | * (when user swipes between pages). The `event.nativeEvent` object passed to this | |
| 1852 | * callback will have following fields: | |
| 1853 | * - position - index of page that has been selected | |
d24fea86Joshua Skelton10 years ago | 1854 | */ |
1f817868Vladimir Kotikov9 years ago | 1855 | onPageSelected?: ( event: NativeSyntheticEvent<ViewPagerAndroidOnPageSelectedEventData> ) => void; |
d24fea86Joshua Skelton10 years ago | 1856 | |
1f817868Vladimir Kotikov9 years ago | 1857 | /** |
| 1858 | * Function called when the page scrolling state has changed. | |
| 1859 | * The page scrolling state can be in 3 states: | |
| 1860 | * - idle, meaning there is no interaction with the page scroller happening at the time | |
| 1861 | * - dragging, meaning there is currently an interaction with the page scroller | |
| 1862 | * - settling, meaning that there was an interaction with the page scroller, and the | |
| 1863 | * page scroller is now finishing it's closing or opening animation | |
| 1864 | */ | |
| 1865 | onPageScrollStateChanged?: (state: "Idle" | "Dragging" | "Settling") => void | |
d24fea86Joshua Skelton10 years ago | 1866 | |
| 1867 | /** | |
1f817868Vladimir Kotikov9 years ago | 1868 | * Determines whether the keyboard gets dismissed in response to a drag. |
| 1869 | * - 'none' (the default), drags do not dismiss the keyboard. | |
| 1870 | * - 'on-drag', the keyboard is dismissed when a drag begins. | |
d24fea86Joshua Skelton10 years ago | 1871 | */ |
1f817868Vladimir Kotikov9 years ago | 1872 | keyboardDismissMode?: "none" | "on-drag" |
d24fea86Joshua Skelton10 years ago | 1873 | |
| 1874 | /** | |
1f817868Vladimir Kotikov9 years ago | 1875 | * Blank space to show between pages. This is only visible while scrolling, pages are still |
| 1876 | * edge-to-edge. | |
d24fea86Joshua Skelton10 years ago | 1877 | */ |
1f817868Vladimir Kotikov9 years ago | 1878 | pageMargin?: number |
| 1879 | } | |
d24fea86Joshua Skelton10 years ago | 1880 | |
1f817868Vladimir Kotikov9 years ago | 1881 | export interface ViewPagerAndroidStatic extends NativeMethodsMixin, React.ComponentClass<ViewPagerAndroidProperties> { |
d24fea86Joshua Skelton10 years ago | 1882 | /** |
1f817868Vladimir Kotikov9 years ago | 1883 | * A helper function to scroll to a specific page in the ViewPager. |
| 1884 | * The transition between pages will be animated. | |
d24fea86Joshua Skelton10 years ago | 1885 | */ |
1f817868Vladimir Kotikov9 years ago | 1886 | setPage(selectedPage: number): void |
d24fea86Joshua Skelton10 years ago | 1887 | |
1f817868Vladimir Kotikov9 years ago | 1888 | /** |
| 1889 | * A helper function to scroll to a specific page in the ViewPager. | |
| 1890 | * The transition between pages will *not* be animated. | |
| 1891 | */ | |
| 1892 | setPageWithoutAnimation(selectedPage: number): void | |
| 1893 | } | |
d24fea86Joshua Skelton10 years ago | 1894 | |
1f817868Vladimir Kotikov9 years ago | 1895 | /** |
| 1896 | * It is a component to solve the common problem of views that need to move out of the way of the virtual keyboard. | |
| 1897 | * It can automatically adjust either its position or bottom padding based on the position of the keyboard. | |
| 1898 | */ | |
| 1899 | export interface KeyboardAvoidingViewStatic extends TimerMixin, React.ClassicComponentClass<KeyboardAvoidingViewProps> {} | |
d24fea86Joshua Skelton10 years ago | 1900 | |
1f817868Vladimir Kotikov9 years ago | 1901 | export interface KeyboardAvoidingViewProps extends ViewProperties, React.Props<KeyboardAvoidingViewStatic> { |
d24fea86Joshua Skelton10 years ago | 1902 | |
1f817868Vladimir Kotikov9 years ago | 1903 | behavior?: 'height' | 'position' | 'padding' |
d24fea86Joshua Skelton10 years ago | 1904 | |
1f817868Vladimir Kotikov9 years ago | 1905 | /** |
| 1906 | * The style of the content container(View) when behavior is 'position'. | |
| 1907 | */ | |
| 1908 | contentContainerStyle: ViewStyle | |
d24fea86Joshua Skelton10 years ago | 1909 | |
1f817868Vladimir Kotikov9 years ago | 1910 | /** |
| 1911 | * This is the distance between the top of the user screen and the react native view, | |
| 1912 | * may be non-zero in some use cases. | |
| 1913 | */ | |
| 1914 | keyboardVerticalOffset: number | |
d24fea86Joshua Skelton10 years ago | 1915 | |
1f817868Vladimir Kotikov9 years ago | 1916 | ref?: Ref<KeyboardAvoidingViewStatic & ViewStatic> |
d24fea86Joshua Skelton10 years ago | 1917 | } |
| 1918 | | |
| 1919 | /** | |
1f817868Vladimir Kotikov9 years ago | 1920 | * //FIXME: No documentation extracted from code comment on WebView.ios.js |
d24fea86Joshua Skelton10 years ago | 1921 | */ |
1f817868Vladimir Kotikov9 years ago | 1922 | export interface NavState { |
d24fea86Joshua Skelton10 years ago | 1923 | |
1f817868Vladimir Kotikov9 years ago | 1924 | url?: string |
| 1925 | title?: string | |
| 1926 | loading?: boolean | |
| 1927 | canGoBack?: boolean | |
| 1928 | canGoForward?: boolean; | |
d24fea86Joshua Skelton10 years ago | 1929 | |
1f817868Vladimir Kotikov9 years ago | 1930 | [key: string]: any |
| 1931 | } | |
| 1932 | | |
| 1933 | export interface WebViewPropertiesAndroid { | |
d24fea86Joshua Skelton10 years ago | 1934 | |
| 1935 | /** | |
1f817868Vladimir Kotikov9 years ago | 1936 | * Used for android only, JS is enabled by default for WebView on iOS |
d24fea86Joshua Skelton10 years ago | 1937 | */ |
1f817868Vladimir Kotikov9 years ago | 1938 | javaScriptEnabled?: boolean |
d24fea86Joshua Skelton10 years ago | 1939 | |
| 1940 | /** | |
1f817868Vladimir Kotikov9 years ago | 1941 | * Used on Android only, controls whether DOM Storage is enabled |
| 1942 | * or not android | |
d24fea86Joshua Skelton10 years ago | 1943 | */ |
1f817868Vladimir Kotikov9 years ago | 1944 | domStorageEnabled?: boolean |
| 1945 | } | |
| 1946 | | |
| 1947 | export interface WebViewIOSLoadRequestEvent { | |
| 1948 | target: number | |
| 1949 | canGoBack: boolean | |
| 1950 | lockIdentifier: number | |
| 1951 | loading: boolean | |
| 1952 | title: string | |
| 1953 | canGoForward: boolean | |
| 1954 | navigationType: 'other' | 'click' | |
| 1955 | url: string | |
| 1956 | } | |
| 1957 | | |
| 1958 | export interface WebViewPropertiesIOS { | |
d24fea86Joshua Skelton10 years ago | 1959 | |
| 1960 | /** | |
1f817868Vladimir Kotikov9 years ago | 1961 | * Determines whether HTML5 videos play inline or use the native |
| 1962 | * full-screen controller. default value false | |
| 1963 | * NOTE : "In order * for video to play inline, not only does | |
| 1964 | * this property need to be set to true, but the video element | |
| 1965 | * in the HTML document must also include the webkit-playsinline | |
| 1966 | * attribute." | |
d24fea86Joshua Skelton10 years ago | 1967 | */ |
1f817868Vladimir Kotikov9 years ago | 1968 | allowsInlineMediaPlayback?: boolean |
d24fea86Joshua Skelton10 years ago | 1969 | |
| 1970 | /** | |
1f817868Vladimir Kotikov9 years ago | 1971 | * Boolean value that determines whether the web view bounces |
| 1972 | * when it reaches the edge of the content. The default value is `true`. | |
| 1973 | * @platform ios | |
d24fea86Joshua Skelton10 years ago | 1974 | */ |
1f817868Vladimir Kotikov9 years ago | 1975 | bounces?: boolean |
d24fea86Joshua Skelton10 years ago | 1976 | |
| 1977 | /** | |
1f817868Vladimir Kotikov9 years ago | 1978 | * A floating-point number that determines how quickly the scroll |
| 1979 | * view decelerates after the user lifts their finger. You may also | |
| 1980 | * use string shortcuts "normal" and "fast" which match the | |
| 1981 | * underlying iOS settings for UIScrollViewDecelerationRateNormal | |
| 1982 | * and UIScrollViewDecelerationRateFast respectively. | |
| 1983 | * - normal: 0.998 - fast: 0.99 (the default for iOS WebView) | |
d24fea86Joshua Skelton10 years ago | 1984 | */ |
1f817868Vladimir Kotikov9 years ago | 1985 | decelerationRate?: "normal" | "fast" | number |
d24fea86Joshua Skelton10 years ago | 1986 | |
| 1987 | /** | |
1f817868Vladimir Kotikov9 years ago | 1988 | * Allows custom handling of any webview requests by a JS handler. |
| 1989 | * Return true or false from this method to continue loading the | |
| 1990 | * request. | |
d24fea86Joshua Skelton10 years ago | 1991 | */ |
1f817868Vladimir Kotikov9 years ago | 1992 | onShouldStartLoadWithRequest?: (event: WebViewIOSLoadRequestEvent) => boolean |
d24fea86Joshua Skelton10 years ago | 1993 | |
| 1994 | /** | |
1f817868Vladimir Kotikov9 years ago | 1995 | * Boolean value that determines whether scrolling is enabled in the |
| 1996 | * `WebView`. The default value is `true`. | |
d24fea86Joshua Skelton10 years ago | 1997 | */ |
1f817868Vladimir Kotikov9 years ago | 1998 | scrollEnabled?: boolean |
| 1999 | } | |
d24fea86Joshua Skelton10 years ago | 2000 | |
1f817868Vladimir Kotikov9 years ago | 2001 | export interface WebViewUriSource { |
| 2002 | | |
| 2003 | /* | |
| 2004 | * The URI to load in the WebView. Can be a local or remote file. | |
d24fea86Joshua Skelton10 years ago | 2005 | */ |
1f817868Vladimir Kotikov9 years ago | 2006 | uri?: string; |
| 2007 | | |
| 2008 | /* | |
| 2009 | * The HTTP Method to use. Defaults to GET if not specified. | |
| 2010 | * NOTE: On Android, only GET and POST are supported. | |
| 2011 | */ | |
| 2012 | method?: string; | |
| 2013 | | |
| 2014 | /* | |
| 2015 | * Additional HTTP headers to send with the request. | |
| 2016 | * NOTE: On Android, this can only be used with GET requests. | |
| 2017 | */ | |
| 2018 | headers?: any; | |
| 2019 | | |
| 2020 | /* | |
| 2021 | * The HTTP body to send with the request. This must be a valid | |
| 2022 | * UTF-8 string, and will be sent exactly as specified, with no | |
| 2023 | * additional encoding (e.g. URL-escaping or base64) applied. | |
| 2024 | * NOTE: On Android, this can only be used with POST requests. | |
| 2025 | */ | |
| 2026 | body?: string; | |
| 2027 | } | |
| 2028 | | |
| 2029 | export interface WebViewHtmlSource { | |
| 2030 | | |
| 2031 | /* | |
| 2032 | * A static HTML page to display in the WebView. | |
| 2033 | */ | |
| 2034 | html: string; | |
| 2035 | | |
| 2036 | /* | |
| 2037 | * The base URL to be used for any relative links in the HTML. | |
| 2038 | */ | |
| 2039 | baseUrl?: string; | |
d24fea86Joshua Skelton10 years ago | 2040 | } |
| 2041 | | |
| 2042 | /** | |
1f817868Vladimir Kotikov9 years ago | 2043 | * @see https://facebook.github.io/react-native/docs/webview.html#props |
d24fea86Joshua Skelton10 years ago | 2044 | */ |
1f817868Vladimir Kotikov9 years ago | 2045 | export interface WebViewProperties extends ViewProperties, WebViewPropertiesAndroid, WebViewPropertiesIOS, React.Props<WebViewStatic> { |
| 2046 | | |
d24fea86Joshua Skelton10 years ago | 2047 | /** |
1f817868Vladimir Kotikov9 years ago | 2048 | * Controls whether to adjust the content inset for web views that are |
| 2049 | * placed behind a navigation bar, tab bar, or toolbar. The default value | |
| 2050 | * is `true`. | |
d24fea86Joshua Skelton10 years ago | 2051 | */ |
1f817868Vladimir Kotikov9 years ago | 2052 | automaticallyAdjustContentInsets?: boolean |
d24fea86Joshua Skelton10 years ago | 2053 | |
| 2054 | /** | |
1f817868Vladimir Kotikov9 years ago | 2055 | * The amount by which the web view content is inset from the edges of |
| 2056 | * the scroll view. Defaults to {top: 0, left: 0, bottom: 0, right: 0}. | |
d24fea86Joshua Skelton10 years ago | 2057 | */ |
1f817868Vladimir Kotikov9 years ago | 2058 | contentInset?: Insets |
d24fea86Joshua Skelton10 years ago | 2059 | |
| 2060 | /** | |
1f817868Vladimir Kotikov9 years ago | 2061 | * @deprecated |
d24fea86Joshua Skelton10 years ago | 2062 | */ |
1f817868Vladimir Kotikov9 years ago | 2063 | html?: string |
d24fea86Joshua Skelton10 years ago | 2064 | |
| 2065 | /** | |
1f817868Vladimir Kotikov9 years ago | 2066 | * Set this to provide JavaScript that will be injected into the web page |
| 2067 | * when the view loads. | |
d24fea86Joshua Skelton10 years ago | 2068 | */ |
1f817868Vladimir Kotikov9 years ago | 2069 | injectedJavaScript?: string |
d24fea86Joshua Skelton10 years ago | 2070 | |
| 2071 | /** | |
1f817868Vladimir Kotikov9 years ago | 2072 | * Invoked when load fails |
d24fea86Joshua Skelton10 years ago | 2073 | */ |
1f817868Vladimir Kotikov9 years ago | 2074 | onError?: ( event: NavState ) => void |
d24fea86Joshua Skelton10 years ago | 2075 | |
| 2076 | /** | |
1f817868Vladimir Kotikov9 years ago | 2077 | * Invoked when load finish |
d24fea86Joshua Skelton10 years ago | 2078 | */ |
1f817868Vladimir Kotikov9 years ago | 2079 | onLoad?: ( event: NavState ) => void |
d24fea86Joshua Skelton10 years ago | 2080 | |
| 2081 | /** | |
1f817868Vladimir Kotikov9 years ago | 2082 | * Invoked when load either succeeds or fails |
d24fea86Joshua Skelton10 years ago | 2083 | */ |
1f817868Vladimir Kotikov9 years ago | 2084 | onLoadEnd?: ( event: NavState ) => void |
d24fea86Joshua Skelton10 years ago | 2085 | |
| 2086 | /** | |
1f817868Vladimir Kotikov9 years ago | 2087 | * Invoked on load start |
d24fea86Joshua Skelton10 years ago | 2088 | */ |
1f817868Vladimir Kotikov9 years ago | 2089 | onLoadStart?: ( event: NavState ) => void |
d24fea86Joshua Skelton10 years ago | 2090 | |
| 2091 | /** | |
1f817868Vladimir Kotikov9 years ago | 2092 | * Function that is invoked when the `WebView` loading starts or ends. |
d24fea86Joshua Skelton10 years ago | 2093 | */ |
1f817868Vladimir Kotikov9 years ago | 2094 | onNavigationStateChange?: ( event: NavState ) => void |
d24fea86Joshua Skelton10 years ago | 2095 | |
1f817868Vladimir Kotikov9 years ago | 2096 | /** |
| 2097 | * Function that returns a view to show if there's an error. | |
| 2098 | */ | |
| 2099 | renderError?: () => React.ReactElement<ViewProperties> | |
d24fea86Joshua Skelton10 years ago | 2100 | |
1f817868Vladimir Kotikov9 years ago | 2101 | /** |
| 2102 | * Function that returns a loading indicator. | |
| 2103 | */ | |
| 2104 | renderLoading?: () => React.ReactElement<ViewProperties> | |
d24fea86Joshua Skelton10 years ago | 2105 | |
1f817868Vladimir Kotikov9 years ago | 2106 | /** |
| 2107 | * Boolean value that forces the `WebView` to show the loading view | |
| 2108 | * on the first load. | |
| 2109 | */ | |
| 2110 | startInLoadingState?: boolean | |
| 2111 | | |
| 2112 | style?: ViewStyle | |
| 2113 | | |
| 2114 | // Deprecated: Use the `source` prop instead. | |
| 2115 | url?: string | |
| 2116 | | |
| 2117 | source?: WebViewUriSource | WebViewHtmlSource | number | |
d24fea86Joshua Skelton10 years ago | 2118 | |
| 2119 | /** | |
1f817868Vladimir Kotikov9 years ago | 2120 | * Determines whether HTML5 audio & videos require the user to tap |
| 2121 | * before they can start playing. The default value is false. | |
d24fea86Joshua Skelton10 years ago | 2122 | */ |
1f817868Vladimir Kotikov9 years ago | 2123 | mediaPlaybackRequiresUserAction?: boolean |
d24fea86Joshua Skelton10 years ago | 2124 | |
| 2125 | /** | |
1f817868Vladimir Kotikov9 years ago | 2126 | * sets whether the webpage scales to fit the view and the user can change the scale |
d24fea86Joshua Skelton10 years ago | 2127 | */ |
1f817868Vladimir Kotikov9 years ago | 2128 | scalesPageToFit?: boolean |
| 2129 | | |
| 2130 | ref?: Ref<WebViewStatic & ViewStatic> | |
| 2131 | } | |
| 2132 | | |
| 2133 | | |
| 2134 | export interface WebViewStatic extends React.ClassicComponentClass<WebViewProperties> { | |
d24fea86Joshua Skelton10 years ago | 2135 | |
| 2136 | /** | |
1f817868Vladimir Kotikov9 years ago | 2137 | * Go back one page in the webview's history. |
d24fea86Joshua Skelton10 years ago | 2138 | */ |
1f817868Vladimir Kotikov9 years ago | 2139 | goBack: () => void |
d24fea86Joshua Skelton10 years ago | 2140 | |
| 2141 | /** | |
1f817868Vladimir Kotikov9 years ago | 2142 | * Go forward one page in the webview's history. |
d24fea86Joshua Skelton10 years ago | 2143 | */ |
1f817868Vladimir Kotikov9 years ago | 2144 | goForward: () => void |
d24fea86Joshua Skelton10 years ago | 2145 | |
| 2146 | /** | |
1f817868Vladimir Kotikov9 years ago | 2147 | * Reloads the current page. |
d24fea86Joshua Skelton10 years ago | 2148 | */ |
1f817868Vladimir Kotikov9 years ago | 2149 | reload: () => void |
d24fea86Joshua Skelton10 years ago | 2150 | |
1f817868Vladimir Kotikov9 years ago | 2151 | /** |
| 2152 | * Stop loading the current page. | |
| 2153 | */ | |
| 2154 | stopLoading(): void | |
d24fea86Joshua Skelton10 years ago | 2155 | |
1f817868Vladimir Kotikov9 years ago | 2156 | /** |
| 2157 | * Returns the native webview node. | |
| 2158 | */ | |
| 2159 | getWebViewHandle: () => any | |
d24fea86Joshua Skelton10 years ago | 2160 | } |
| 2161 | | |
1f817868Vladimir Kotikov9 years ago | 2162 | /** |
| 2163 | * @see https://facebook.github.io/react-native/docs/segmentedcontrolios.html | |
| 2164 | * @see SegmentedControlIOS.ios.js | |
| 2165 | */ | |
| 2166 | export interface NativeSegmentedControlIOSChangeEvent { | |
| 2167 | value: string | |
| 2168 | selectedSegmentIndex: number | |
| 2169 | target: number | |
| 2170 | } | |
d24fea86Joshua Skelton10 years ago | 2171 | |
1f817868Vladimir Kotikov9 years ago | 2172 | export interface SegmentedControlIOSProperties extends ViewProperties, React.Props<SegmentedControlIOSStatic> { |
d24fea86Joshua Skelton10 years ago | 2173 | |
| 2174 | /** | |
1f817868Vladimir Kotikov9 years ago | 2175 | * If false the user won't be able to interact with the control. Default value is true. |
d24fea86Joshua Skelton10 years ago | 2176 | */ |
1f817868Vladimir Kotikov9 years ago | 2177 | enabled?: boolean |
d24fea86Joshua Skelton10 years ago | 2178 | |
| 2179 | /** | |
1f817868Vladimir Kotikov9 years ago | 2180 | * If true, then selecting a segment won't persist visually. |
| 2181 | * The onValueChange callback will still work as expected. | |
d24fea86Joshua Skelton10 years ago | 2182 | */ |
1f817868Vladimir Kotikov9 years ago | 2183 | momentary?: boolean |
d24fea86Joshua Skelton10 years ago | 2184 | |
| 2185 | /** | |
1f817868Vladimir Kotikov9 years ago | 2186 | * Callback that is called when the user taps a segment; |
| 2187 | * passes the event as an argument | |
| 2188 | * @param event | |
d24fea86Joshua Skelton10 years ago | 2189 | */ |
1f817868Vladimir Kotikov9 years ago | 2190 | onChange?: (event: NativeSyntheticEvent<NativeSegmentedControlIOSChangeEvent>) => void |
d24fea86Joshua Skelton10 years ago | 2191 | |
| 2192 | /** | |
1f817868Vladimir Kotikov9 years ago | 2193 | * Callback that is called when the user taps a segment; passes the segment's value as an argument |
| 2194 | * @param value | |
d24fea86Joshua Skelton10 years ago | 2195 | */ |
1f817868Vladimir Kotikov9 years ago | 2196 | onValueChange?: (value: string) => void |
d24fea86Joshua Skelton10 years ago | 2197 | |
| 2198 | /** | |
1f817868Vladimir Kotikov9 years ago | 2199 | * The index in props.values of the segment to be (pre)selected. |
d24fea86Joshua Skelton10 years ago | 2200 | */ |
1f817868Vladimir Kotikov9 years ago | 2201 | selectedIndex?: number |
d24fea86Joshua Skelton10 years ago | 2202 | |
| 2203 | /** | |
1f817868Vladimir Kotikov9 years ago | 2204 | * Accent color of the control. |
d24fea86Joshua Skelton10 years ago | 2205 | */ |
1f817868Vladimir Kotikov9 years ago | 2206 | tintColor?: string |
d24fea86Joshua Skelton10 years ago | 2207 | |
| 2208 | /** | |
1f817868Vladimir Kotikov9 years ago | 2209 | * The labels for the control's segment buttons, in order. |
d24fea86Joshua Skelton10 years ago | 2210 | */ |
1f817868Vladimir Kotikov9 years ago | 2211 | values?: string[] |
d24fea86Joshua Skelton10 years ago | 2212 | |
1f817868Vladimir Kotikov9 years ago | 2213 | ref?: Ref<SegmentedControlIOSStatic> |
d24fea86Joshua Skelton10 years ago | 2214 | } |
| 2215 | | |
| 2216 | /** | |
1f817868Vladimir Kotikov9 years ago | 2217 | * Use `SegmentedControlIOS` to render a UISegmentedControl iOS. |
| 2218 | * | |
| 2219 | * #### Programmatically changing selected index | |
| 2220 | * | |
| 2221 | * The selected index can be changed on the fly by assigning the | |
| 2222 | * selectIndex prop to a state variable, then changing that variable. | |
| 2223 | * Note that the state variable would need to be updated as the user | |
| 2224 | * selects a value and changes the index, as shown in the example below. | |
| 2225 | * | |
| 2226 | * ```` | |
| 2227 | * <SegmentedControlIOS | |
| 2228 | * values={['One', 'Two']} | |
| 2229 | * selectedIndex={this.state.selectedIndex} | |
| 2230 | * onChange={(event) => { | |
| 2231 | * this.setState({selectedIndex: event.nativeEvent.selectedSegmentIndex}); | |
| 2232 | * }} | |
| 2233 | * /> | |
| 2234 | * ```` | |
d24fea86Joshua Skelton10 years ago | 2235 | */ |
1f817868Vladimir Kotikov9 years ago | 2236 | export interface SegmentedControlIOSStatic extends NativeMethodsMixin, React.ClassicComponentClass<SegmentedControlIOSProperties> {} |
d24fea86Joshua Skelton10 years ago | 2237 | |
| 2238 | | |
1f817868Vladimir Kotikov9 years ago | 2239 | export interface NavigatorIOSProperties extends React.Props<NavigatorIOSStatic> { |
d24fea86Joshua Skelton10 years ago | 2240 | |
| 2241 | /** | |
1f817868Vladimir Kotikov9 years ago | 2242 | * NavigatorIOS uses "route" objects to identify child views, their props, and navigation bar configuration. |
| 2243 | * "push" and all the other navigation operations expect routes to be like this | |
d24fea86Joshua Skelton10 years ago | 2244 | */ |
1f817868Vladimir Kotikov9 years ago | 2245 | initialRoute: Route |
d24fea86Joshua Skelton10 years ago | 2246 | |
| 2247 | /** | |
1f817868Vladimir Kotikov9 years ago | 2248 | * The default wrapper style for components in the navigator. |
| 2249 | * A common use case is to set the backgroundColor for every page | |
d24fea86Joshua Skelton10 years ago | 2250 | */ |
1f817868Vladimir Kotikov9 years ago | 2251 | itemWrapperStyle?: ViewStyle |
d24fea86Joshua Skelton10 years ago | 2252 | |
| 2253 | /** | |
1f817868Vladimir Kotikov9 years ago | 2254 | * Boolean value that indicates whether the interactive pop gesture is |
| 2255 | * enabled. This is useful for enabling/disabling the back swipe navigation | |
| 2256 | * gesture. | |
| 2257 | * | |
| 2258 | * If this prop is not provided, the default behavior is for the back swipe | |
| 2259 | * gesture to be enabled when the navigation bar is shown and disabled when | |
| 2260 | * the navigation bar is hidden. Once you've provided the | |
| 2261 | * `interactivePopGestureEnabled` prop, you can never restore the default | |
| 2262 | * behavior. | |
d24fea86Joshua Skelton10 years ago | 2263 | */ |
1f817868Vladimir Kotikov9 years ago | 2264 | interactivePopGestureEnabled?: boolean |
d24fea86Joshua Skelton10 years ago | 2265 | |
| 2266 | /** | |
1f817868Vladimir Kotikov9 years ago | 2267 | * A Boolean value that indicates whether the navigation bar is hidden |
d24fea86Joshua Skelton10 years ago | 2268 | */ |
1f817868Vladimir Kotikov9 years ago | 2269 | navigationBarHidden?: boolean |
d24fea86Joshua Skelton10 years ago | 2270 | |
| 2271 | /** | |
1f817868Vladimir Kotikov9 years ago | 2272 | * A Boolean value that indicates whether to hide the 1px hairline shadow |
d24fea86Joshua Skelton10 years ago | 2273 | */ |
1f817868Vladimir Kotikov9 years ago | 2274 | shadowHidden?: boolean |
d24fea86Joshua Skelton10 years ago | 2275 | |
| 2276 | /** | |
1f817868Vladimir Kotikov9 years ago | 2277 | * The color used for buttons in the navigation bar |
d24fea86Joshua Skelton10 years ago | 2278 | */ |
1f817868Vladimir Kotikov9 years ago | 2279 | tintColor?: string |
d24fea86Joshua Skelton10 years ago | 2280 | |
| 2281 | /** | |
1f817868Vladimir Kotikov9 years ago | 2282 | * The default background color of the navigation bar. |
d24fea86Joshua Skelton10 years ago | 2283 | */ |
1f817868Vladimir Kotikov9 years ago | 2284 | barTintColor?: string |
d24fea86Joshua Skelton10 years ago | 2285 | |
| 2286 | /** | |
1f817868Vladimir Kotikov9 years ago | 2287 | * The text color of the navigation bar title |
d24fea86Joshua Skelton10 years ago | 2288 | */ |
1f817868Vladimir Kotikov9 years ago | 2289 | titleTextColor?: string |
d24fea86Joshua Skelton10 years ago | 2290 | |
| 2291 | /** | |
1f817868Vladimir Kotikov9 years ago | 2292 | * A Boolean value that indicates whether the navigation bar is translucent |
d24fea86Joshua Skelton10 years ago | 2293 | */ |
1f817868Vladimir Kotikov9 years ago | 2294 | translucent?: boolean |
d24fea86Joshua Skelton10 years ago | 2295 | |
| 2296 | /** | |
1f817868Vladimir Kotikov9 years ago | 2297 | * NOT IN THE DOC BUT IN THE EXAMPLES |
d24fea86Joshua Skelton10 years ago | 2298 | */ |
1f817868Vladimir Kotikov9 years ago | 2299 | style?: ViewStyle |
d24fea86Joshua Skelton10 years ago | 2300 | } |
| 2301 | | |
| 2302 | /** | |
1f817868Vladimir Kotikov9 years ago | 2303 | * A navigator is an object of navigation functions that a view can call. |
| 2304 | * It is passed as a prop to any component rendered by NavigatorIOS. | |
| 2305 | * | |
| 2306 | * Navigator functions are also available on the NavigatorIOS component: | |
| 2307 | * | |
| 2308 | * @see https://facebook.github.io/react-native/docs/navigatorios.html#navigator | |
d24fea86Joshua Skelton10 years ago | 2309 | */ |
1f817868Vladimir Kotikov9 years ago | 2310 | export interface NavigationIOS { |
| 2311 | /** | |
| 2312 | * Navigate forward to a new route | |
| 2313 | */ | |
| 2314 | push: ( route: Route ) => void | |
d24fea86Joshua Skelton10 years ago | 2315 | |
1f817868Vladimir Kotikov9 years ago | 2316 | /** |
| 2317 | * Go back one page | |
| 2318 | */ | |
| 2319 | pop: () => void | |
d24fea86Joshua Skelton10 years ago | 2320 | |
| 2321 | /** | |
1f817868Vladimir Kotikov9 years ago | 2322 | * Go back N pages at once. When N=1, behavior matches pop() |
d24fea86Joshua Skelton10 years ago | 2323 | */ |
1f817868Vladimir Kotikov9 years ago | 2324 | popN: ( n: number ) => void |
d24fea86Joshua Skelton10 years ago | 2325 | |
| 2326 | /** | |
1f817868Vladimir Kotikov9 years ago | 2327 | * Replace the route for the current page and immediately load the view for the new route |
d24fea86Joshua Skelton10 years ago | 2328 | */ |
1f817868Vladimir Kotikov9 years ago | 2329 | replace: ( route: Route ) => void |
d24fea86Joshua Skelton10 years ago | 2330 | |
| 2331 | /** | |
1f817868Vladimir Kotikov9 years ago | 2332 | * Replace the route/view for the previous page |
d24fea86Joshua Skelton10 years ago | 2333 | */ |
1f817868Vladimir Kotikov9 years ago | 2334 | replacePrevious: ( route: Route ) => void |
d24fea86Joshua Skelton10 years ago | 2335 | |
| 2336 | /** | |
1f817868Vladimir Kotikov9 years ago | 2337 | * Replaces the previous route/view and transitions back to it |
d24fea86Joshua Skelton10 years ago | 2338 | */ |
1f817868Vladimir Kotikov9 years ago | 2339 | replacePreviousAndPop: ( route: Route ) => void |
d24fea86Joshua Skelton10 years ago | 2340 | |
| 2341 | /** | |
1f817868Vladimir Kotikov9 years ago | 2342 | * Replaces the top item and popToTop |
d24fea86Joshua Skelton10 years ago | 2343 | */ |
1f817868Vladimir Kotikov9 years ago | 2344 | resetTo: ( route: Route ) => void |
d24fea86Joshua Skelton10 years ago | 2345 | |
| 2346 | /** | |
1f817868Vladimir Kotikov9 years ago | 2347 | * Go back to the item for a particular route object |
d24fea86Joshua Skelton10 years ago | 2348 | */ |
1f817868Vladimir Kotikov9 years ago | 2349 | popToRoute( route: Route ): void |
d24fea86Joshua Skelton10 years ago | 2350 | |
1f817868Vladimir Kotikov9 years ago | 2351 | /** |
| 2352 | * Go back to the top item | |
| 2353 | */ | |
| 2354 | popToTop(): void | |
d24fea86Joshua Skelton10 years ago | 2355 | } |
| 2356 | | |
1f817868Vladimir Kotikov9 years ago | 2357 | export interface NavigatorIOSStatic extends NavigationIOS, React.ComponentClass<NavigatorIOSProperties> { |
d24fea86Joshua Skelton10 years ago | 2358 | } |
| 2359 | | |
| 2360 | | |
| 2361 | /** | |
1f817868Vladimir Kotikov9 years ago | 2362 | * @see https://facebook.github.io/react-native/docs/activityindicator.html#props |
d24fea86Joshua Skelton10 years ago | 2363 | */ |
1f817868Vladimir Kotikov9 years ago | 2364 | export interface ActivityIndicatorProperties extends ViewProperties, React.Props<ActivityIndicatorStatic> { |
| 2365 | | |
d24fea86Joshua Skelton10 years ago | 2366 | /** |
1f817868Vladimir Kotikov9 years ago | 2367 | * Whether to show the indicator (true, the default) or hide it (false). |
| 2368 | */ | |
| 2369 | animating?: boolean | |
| 2370 | | |
| 2371 | /** | |
| 2372 | * The foreground color of the spinner (default is gray). Valid color formats are: | |
| 2373 | * - '#f0f' (#rgb) | |
| 2374 | * - '#f0fc' (#rgba) | |
| 2375 | * - '#ff00ff' (#rrggbb) | |
| 2376 | * - '#ff00ff00' (#rrggbbaa) | |
| 2377 | * - 'rgb(255, 255, 255)' | |
| 2378 | * - 'rgba(255, 255, 255, 1.0)' | |
| 2379 | * - 'hsl(360, 100%, 100%)' | |
| 2380 | * - 'hsla(360, 100%, 100%, 1.0)' | |
| 2381 | * - 'transparent' | |
| 2382 | * - 'red' | |
| 2383 | * - 0xff00ff00 (0xrrggbbaa) | |
| 2384 | * | |
| 2385 | * @see https://facebook.github.io/react-native/docs/colors.html | |
d24fea86Joshua Skelton10 years ago | 2386 | */ |
1f817868Vladimir Kotikov9 years ago | 2387 | color?: string | number |
| 2388 | | |
d24fea86Joshua Skelton10 years ago | 2389 | /** |
1f817868Vladimir Kotikov9 years ago | 2390 | * Whether the indicator should hide when not animating (true by default). |
d24fea86Joshua Skelton10 years ago | 2391 | */ |
1f817868Vladimir Kotikov9 years ago | 2392 | hidesWhenStopped?: boolean |
| 2393 | | |
d24fea86Joshua Skelton10 years ago | 2394 | /** |
1f817868Vladimir Kotikov9 years ago | 2395 | * Size of the indicator. |
| 2396 | * Small has a height of 20, large has a height of 36. | |
| 2397 | * | |
| 2398 | * enum('small', 'large') | |
d24fea86Joshua Skelton10 years ago | 2399 | */ |
1f817868Vladimir Kotikov9 years ago | 2400 | size?: number | 'small' | 'large' |
| 2401 | | |
| 2402 | style?: ViewStyle | |
| 2403 | | |
| 2404 | ref?: Ref<ActivityIndicatorStatic> | |
| 2405 | } | |
| 2406 | | |
| 2407 | export interface ActivityIndicatorStatic extends React.NativeMethodsMixin, React.ClassicComponentClass<ActivityIndicatorProperties> { | |
d24fea86Joshua Skelton10 years ago | 2408 | } |
| 2409 | | |
1f817868Vladimir Kotikov9 years ago | 2410 | |
d24fea86Joshua Skelton10 years ago | 2411 | /** |
1f817868Vladimir Kotikov9 years ago | 2412 | * @see https://facebook.github.io/react-native/docs/activityindicatorios.html#props |
d24fea86Joshua Skelton10 years ago | 2413 | */ |
1f817868Vladimir Kotikov9 years ago | 2414 | export interface ActivityIndicatorIOSProperties extends ViewProperties, React.Props<ActivityIndicatorIOSStatic> { |
d24fea86Joshua Skelton10 years ago | 2415 | |
| 2416 | /** | |
1f817868Vladimir Kotikov9 years ago | 2417 | * Whether to show the indicator (true, the default) or hide it (false). |
d24fea86Joshua Skelton10 years ago | 2418 | */ |
1f817868Vladimir Kotikov9 years ago | 2419 | animating?: boolean |
d24fea86Joshua Skelton10 years ago | 2420 | |
| 2421 | /** | |
1f817868Vladimir Kotikov9 years ago | 2422 | * The foreground color of the spinner (default is gray). |
d24fea86Joshua Skelton10 years ago | 2423 | */ |
1f817868Vladimir Kotikov9 years ago | 2424 | color?: string |
d24fea86Joshua Skelton10 years ago | 2425 | |
| 2426 | /** | |
1f817868Vladimir Kotikov9 years ago | 2427 | * Whether the indicator should hide when not animating (true by default). |
d24fea86Joshua Skelton10 years ago | 2428 | */ |
1f817868Vladimir Kotikov9 years ago | 2429 | hidesWhenStopped?: boolean |
d24fea86Joshua Skelton10 years ago | 2430 | |
| 2431 | /** | |
1f817868Vladimir Kotikov9 years ago | 2432 | * Invoked on mount and layout changes with |
d24fea86Joshua Skelton10 years ago | 2433 | */ |
1f817868Vladimir Kotikov9 years ago | 2434 | onLayout?: ( event: {nativeEvent: { layout: {x: number, y: number , width: number, height: number}}} ) => void |
d24fea86Joshua Skelton10 years ago | 2435 | |
| 2436 | /** | |
1f817868Vladimir Kotikov9 years ago | 2437 | * Size of the indicator. |
| 2438 | * Small has a height of 20, large has a height of 36. | |
| 2439 | * | |
| 2440 | * enum('small', 'large') | |
d24fea86Joshua Skelton10 years ago | 2441 | */ |
1f817868Vladimir Kotikov9 years ago | 2442 | size?: 'small' | 'large' |
d24fea86Joshua Skelton10 years ago | 2443 | |
1f817868Vladimir Kotikov9 years ago | 2444 | style?: ViewStyle |
d24fea86Joshua Skelton10 years ago | 2445 | |
1f817868Vladimir Kotikov9 years ago | 2446 | ref?: Ref<ActivityIndicatorIOSStatic> |
| 2447 | } | |
| 2448 | | |
| 2449 | /** | |
| 2450 | * @Deprecated since version 0.28.0 | |
| 2451 | */ | |
| 2452 | export interface ActivityIndicatorIOSStatic extends React.ComponentClass<ActivityIndicatorIOSProperties> { | |
| 2453 | } | |
| 2454 | | |
| 2455 | | |
| 2456 | export interface DatePickerIOSProperties extends ViewProperties, React.Props<DatePickerIOSStatic> { | |
d24fea86Joshua Skelton10 years ago | 2457 | |
| 2458 | /** | |
1f817868Vladimir Kotikov9 years ago | 2459 | * The currently selected date. |
d24fea86Joshua Skelton10 years ago | 2460 | */ |
1f817868Vladimir Kotikov9 years ago | 2461 | date: Date |
| 2462 | | |
d24fea86Joshua Skelton10 years ago | 2463 | |
| 2464 | /** | |
1f817868Vladimir Kotikov9 years ago | 2465 | * Maximum date. |
| 2466 | * Restricts the range of possible date/time values. | |
d24fea86Joshua Skelton10 years ago | 2467 | */ |
1f817868Vladimir Kotikov9 years ago | 2468 | maximumDate?: Date |
d24fea86Joshua Skelton10 years ago | 2469 | |
| 2470 | /** | |
1f817868Vladimir Kotikov9 years ago | 2471 | * Maximum date. |
| 2472 | * Restricts the range of possible date/time values. | |
d24fea86Joshua Skelton10 years ago | 2473 | */ |
1f817868Vladimir Kotikov9 years ago | 2474 | minimumDate?: Date |
d24fea86Joshua Skelton10 years ago | 2475 | |
| 2476 | /** | |
1f817868Vladimir Kotikov9 years ago | 2477 | * enum(1, 2, 3, 4, 5, 6, 10, 12, 15, 20, 30) |
| 2478 | * The interval at which minutes can be selected. | |
d24fea86Joshua Skelton10 years ago | 2479 | */ |
2060f3fbVladimir Kotikov9 years ago | 2480 | minuteInterval?: number |
d24fea86Joshua Skelton10 years ago | 2481 | |
| 2482 | /** | |
1f817868Vladimir Kotikov9 years ago | 2483 | * enum('date', 'time', 'datetime') |
| 2484 | * The date picker mode. | |
d24fea86Joshua Skelton10 years ago | 2485 | */ |
1f817868Vladimir Kotikov9 years ago | 2486 | mode?: "date" | "time" | "datetime" |
d24fea86Joshua Skelton10 years ago | 2487 | |
| 2488 | /** | |
1f817868Vladimir Kotikov9 years ago | 2489 | * Date change handler. |
| 2490 | * This is called when the user changes the date or time in the UI. | |
| 2491 | * The first and only argument is a Date object representing the new date and time. | |
d24fea86Joshua Skelton10 years ago | 2492 | */ |
1f817868Vladimir Kotikov9 years ago | 2493 | onDateChange: ( newDate: Date ) => void |
d24fea86Joshua Skelton10 years ago | 2494 | |
| 2495 | /** | |
1f817868Vladimir Kotikov9 years ago | 2496 | * Timezone offset in minutes. |
| 2497 | * By default, the date picker will use the device's timezone. With this parameter, it is possible to force a certain timezone offset. | |
| 2498 | * For instance, to show times in Pacific Standard Time, pass -7 * 60. | |
d24fea86Joshua Skelton10 years ago | 2499 | */ |
1f817868Vladimir Kotikov9 years ago | 2500 | timeZoneOffsetInMinutes?: number |
d24fea86Joshua Skelton10 years ago | 2501 | |
1f817868Vladimir Kotikov9 years ago | 2502 | ref?: Ref<DatePickerIOSStatic & ViewStatic> |
d24fea86Joshua Skelton10 years ago | 2503 | } |
| 2504 | | |
1f817868Vladimir Kotikov9 years ago | 2505 | export interface DatePickerIOSStatic extends React.NativeMethodsMixin, React.ComponentClass<DatePickerIOSProperties> { |
d24fea86Joshua Skelton10 years ago | 2506 | } |
| 2507 | | |
1f817868Vladimir Kotikov9 years ago | 2508 | export interface DrawerSlideEvent extends NativeSyntheticEvent<NativeTouchEvent> { |
| 2509 | } | |
d24fea86Joshua Skelton10 years ago | 2510 | |
| 2511 | /** | |
1f817868Vladimir Kotikov9 years ago | 2512 | * @see DrawerLayoutAndroid.android.js |
d24fea86Joshua Skelton10 years ago | 2513 | */ |
1f817868Vladimir Kotikov9 years ago | 2514 | export interface DrawerLayoutAndroidProperties extends ViewProperties, React.Props<DrawerLayoutAndroidStatic> { |
d24fea86Joshua Skelton10 years ago | 2515 | |
| 2516 | /** | |
1f817868Vladimir Kotikov9 years ago | 2517 | * Specifies the background color of the drawer. The default value |
| 2518 | * is white. If you want to set the opacity of the drawer, use rgba. | |
| 2519 | * Example: | |
| 2520 | * return ( | |
| 2521 | * <DrawerLayoutAndroid drawerBackgroundColor="rgba(0,0,0,0.5)"> | |
| 2522 | * </DrawerLayoutAndroid> | |
| 2523 | *); | |
d24fea86Joshua Skelton10 years ago | 2524 | */ |
1f817868Vladimir Kotikov9 years ago | 2525 | drawerBackgroundColor?: string; |
d24fea86Joshua Skelton10 years ago | 2526 | |
| 2527 | /** | |
1f817868Vladimir Kotikov9 years ago | 2528 | * Specifies the lock mode of the drawer. The drawer can be locked |
| 2529 | * in 3 states: | |
d24fea86Joshua Skelton10 years ago | 2530 | * |
1f817868Vladimir Kotikov9 years ago | 2531 | * - unlocked (default), meaning that the drawer will respond |
| 2532 | * (open/close) to touch gestures. | |
| 2533 | * | |
| 2534 | * - locked-closed, meaning that the drawer will stay closed and not | |
| 2535 | * respond to gestures. | |
| 2536 | * | |
| 2537 | * - locked-open, meaning that the drawer will stay opened and | |
| 2538 | * not respond to gestures. The drawer may still be opened and | |
| 2539 | * closed programmatically (openDrawer/closeDrawer). | |
d24fea86Joshua Skelton10 years ago | 2540 | */ |
1f817868Vladimir Kotikov9 years ago | 2541 | drawerLockMode?: "unlocked" | "locked-closed" | "locked-open"; |
d24fea86Joshua Skelton10 years ago | 2542 | |
| 2543 | /** | |
1f817868Vladimir Kotikov9 years ago | 2544 | * Specifies the side of the screen from which the drawer will slide in. |
| 2545 | * enum(DrawerConsts.DrawerPosition.Left, DrawerConsts.DrawerPosition.Right) | |
d24fea86Joshua Skelton10 years ago | 2546 | */ |
1f817868Vladimir Kotikov9 years ago | 2547 | drawerPosition?: any; |
d24fea86Joshua Skelton10 years ago | 2548 | |
| 2549 | /** | |
1f817868Vladimir Kotikov9 years ago | 2550 | * Specifies the width of the drawer, more precisely the width of the |
| 2551 | * view that be pulled in from the edge of the window. | |
d24fea86Joshua Skelton10 years ago | 2552 | */ |
1f817868Vladimir Kotikov9 years ago | 2553 | drawerWidth?: number; |
d24fea86Joshua Skelton10 years ago | 2554 | |
| 2555 | /** | |
1f817868Vladimir Kotikov9 years ago | 2556 | * Determines whether the keyboard gets dismissed in response to a drag. |
| 2557 | * - 'none' (the default), drags do not dismiss the keyboard. | |
| 2558 | * - 'on-drag', the keyboard is dismissed when a drag begins. | |
d24fea86Joshua Skelton10 years ago | 2559 | */ |
1f817868Vladimir Kotikov9 years ago | 2560 | keyboardDismissMode?: "none" | "on-drag" |
d24fea86Joshua Skelton10 years ago | 2561 | |
| 2562 | /** | |
1f817868Vladimir Kotikov9 years ago | 2563 | * Function called whenever the navigation view has been closed. |
d24fea86Joshua Skelton10 years ago | 2564 | */ |
1f817868Vladimir Kotikov9 years ago | 2565 | onDrawerClose?: () => void |
d24fea86Joshua Skelton10 years ago | 2566 | |
| 2567 | /** | |
1f817868Vladimir Kotikov9 years ago | 2568 | * Function called whenever the navigation view has been opened. |
d24fea86Joshua Skelton10 years ago | 2569 | */ |
1f817868Vladimir Kotikov9 years ago | 2570 | onDrawerOpen?: () => void |
d24fea86Joshua Skelton10 years ago | 2571 | |
| 2572 | /** | |
1f817868Vladimir Kotikov9 years ago | 2573 | * Function called whenever there is an interaction with the navigation view. |
| 2574 | * @param event | |
d24fea86Joshua Skelton10 years ago | 2575 | */ |
1f817868Vladimir Kotikov9 years ago | 2576 | onDrawerSlide?: (event: DrawerSlideEvent) => void |
d24fea86Joshua Skelton10 years ago | 2577 | |
| 2578 | /** | |
1f817868Vladimir Kotikov9 years ago | 2579 | * Function called when the drawer state has changed. |
| 2580 | * The drawer can be in 3 states: | |
| 2581 | * - idle, meaning there is no interaction with the navigation | |
| 2582 | * view happening at the time | |
| 2583 | * - dragging, meaning there is currently an interaction with the | |
| 2584 | * navigation view | |
| 2585 | * - settling, meaning that there was an interaction with the | |
| 2586 | * navigation view, and the navigation view is now finishing | |
| 2587 | * it's closing or opening animation | |
| 2588 | * @param event | |
d24fea86Joshua Skelton10 years ago | 2589 | */ |
1f817868Vladimir Kotikov9 years ago | 2590 | onDrawerStateChanged?: (event: "Idle" | "Dragging" | "Settling") => void |
d24fea86Joshua Skelton10 years ago | 2591 | |
| 2592 | /** | |
1f817868Vladimir Kotikov9 years ago | 2593 | * The navigation view that will be rendered to the side of the |
| 2594 | * screen and can be pulled in. | |
d24fea86Joshua Skelton10 years ago | 2595 | */ |
1f817868Vladimir Kotikov9 years ago | 2596 | renderNavigationView: () => JSX.Element |
d24fea86Joshua Skelton10 years ago | 2597 | |
| 2598 | /** | |
1f817868Vladimir Kotikov9 years ago | 2599 | * Make the drawer take the entire screen and draw the background of |
| 2600 | * the status bar to allow it to open over the status bar. It will | |
| 2601 | * only have an effect on API 21+. | |
d24fea86Joshua Skelton10 years ago | 2602 | */ |
1f817868Vladimir Kotikov9 years ago | 2603 | statusBarBackgroundColor?: string |
| 2604 | | |
| 2605 | ref?: Ref<DrawerLayoutAndroidStatic & ViewStatic> | |
| 2606 | } | |
d24fea86Joshua Skelton10 years ago | 2607 | |
1f817868Vladimir Kotikov9 years ago | 2608 | export interface DrawerLayoutAndroidStatic extends NativeMethodsMixin, React.ClassicComponentClass<DrawerLayoutAndroidProperties> { |
d24fea86Joshua Skelton10 years ago | 2609 | |
| 2610 | /** | |
1f817868Vladimir Kotikov9 years ago | 2611 | * Opens the drawer. |
d24fea86Joshua Skelton10 years ago | 2612 | */ |
1f817868Vladimir Kotikov9 years ago | 2613 | openDrawer(): void |
d24fea86Joshua Skelton10 years ago | 2614 | |
| 2615 | /** | |
1f817868Vladimir Kotikov9 years ago | 2616 | * Closes the drawer. |
d24fea86Joshua Skelton10 years ago | 2617 | */ |
1f817868Vladimir Kotikov9 years ago | 2618 | closeDrawer(): void |
d24fea86Joshua Skelton10 years ago | 2619 | } |
| 2620 | | |
1f817868Vladimir Kotikov9 years ago | 2621 | |
| 2622 | /** | |
| 2623 | * @see PickerIOS.ios.js | |
| 2624 | */ | |
| 2625 | export interface PickerIOSItemProperties extends React.Props<PickerIOSItemStatic> { | |
| 2626 | value?: string | number | |
| 2627 | label?: string | |
d24fea86Joshua Skelton10 years ago | 2628 | } |
| 2629 | | |
1f817868Vladimir Kotikov9 years ago | 2630 | /** |
| 2631 | * @see PickerIOS.ios.js | |
| 2632 | */ | |
| 2633 | export interface PickerIOSItemStatic extends React.ComponentClass<PickerIOSItemProperties> {} | |
d24fea86Joshua Skelton10 years ago | 2634 | |
1f817868Vladimir Kotikov9 years ago | 2635 | /** |
| 2636 | * @see Picker.js | |
| 2637 | */ | |
| 2638 | export interface PickerItemProperties extends React.Props<PickerItemStatic> { | |
| 2639 | label: string | |
| 2640 | value?: any | |
d24fea86Joshua Skelton10 years ago | 2641 | } |
| 2642 | | |
1f817868Vladimir Kotikov9 years ago | 2643 | export interface PickerItemStatic extends React.ComponentClass<PickerItemProperties> { |
d24fea86Joshua Skelton10 years ago | 2644 | } |
| 2645 | | |
1f817868Vladimir Kotikov9 years ago | 2646 | export interface PickerPropertiesIOS extends ViewProperties, React.Props<PickerStatic> { |
d24fea86Joshua Skelton10 years ago | 2647 | |
| 2648 | /** | |
1f817868Vladimir Kotikov9 years ago | 2649 | * Style to apply to each of the item labels. |
| 2650 | * @platform ios | |
d24fea86Joshua Skelton10 years ago | 2651 | */ |
1f817868Vladimir Kotikov9 years ago | 2652 | itemStyle?: ViewStyle, |
d24fea86Joshua Skelton10 years ago | 2653 | |
1f817868Vladimir Kotikov9 years ago | 2654 | ref?: Ref<PickerStatic & ViewStatic> |
| 2655 | } | |
d24fea86Joshua Skelton10 years ago | 2656 | |
1f817868Vladimir Kotikov9 years ago | 2657 | export interface PickerPropertiesAndroid extends ViewProperties, React.Props<PickerStatic> { |
d24fea86Joshua Skelton10 years ago | 2658 | |
| 2659 | /** | |
1f817868Vladimir Kotikov9 years ago | 2660 | * If set to false, the picker will be disabled, i.e. the user will not be able to make a |
| 2661 | * selection. | |
| 2662 | * @platform android | |
d24fea86Joshua Skelton10 years ago | 2663 | */ |
1f817868Vladimir Kotikov9 years ago | 2664 | enabled?: boolean |
d24fea86Joshua Skelton10 years ago | 2665 | |
| 2666 | /** | |
1f817868Vladimir Kotikov9 years ago | 2667 | * On Android, specifies how to display the selection items when the user taps on the picker: |
d24fea86Joshua Skelton10 years ago | 2668 | * |
1f817868Vladimir Kotikov9 years ago | 2669 | * - 'dialog': Show a modal dialog. This is the default. |
| 2670 | * - 'dropdown': Shows a dropdown anchored to the picker view | |
| 2671 | * | |
| 2672 | * @platform android | |
d24fea86Joshua Skelton10 years ago | 2673 | */ |
1f817868Vladimir Kotikov9 years ago | 2674 | mode?: "dialog" | "dropdown" |
d24fea86Joshua Skelton10 years ago | 2675 | |
| 2676 | /** | |
1f817868Vladimir Kotikov9 years ago | 2677 | * Prompt string for this picker, used on Android in dialog mode as the title of the dialog. |
| 2678 | * @platform android | |
d24fea86Joshua Skelton10 years ago | 2679 | */ |
1f817868Vladimir Kotikov9 years ago | 2680 | prompt?: string |
d24fea86Joshua Skelton10 years ago | 2681 | |
1f817868Vladimir Kotikov9 years ago | 2682 | ref?: Ref<PickerStatic & ViewStatic> |
| 2683 | } | |
d24fea86Joshua Skelton10 years ago | 2684 | |
1f817868Vladimir Kotikov9 years ago | 2685 | /** |
| 2686 | * @see https://facebook.github.io/react-native/docs/picker.html | |
| 2687 | * @see Picker.js | |
| 2688 | */ | |
| 2689 | export interface PickerProperties extends PickerPropertiesIOS, PickerPropertiesAndroid, React.Props<PickerStatic> { | |
d24fea86Joshua Skelton10 years ago | 2690 | |
| 2691 | /** | |
1f817868Vladimir Kotikov9 years ago | 2692 | * Callback for when an item is selected. This is called with the |
| 2693 | * following parameters: | |
| 2694 | * - itemValue: the value prop of the item that was selected | |
| 2695 | * - itemPosition: the index of the selected item in this picker | |
| 2696 | * @param itemValue | |
| 2697 | * @param itemPosition | |
d24fea86Joshua Skelton10 years ago | 2698 | */ |
1f817868Vladimir Kotikov9 years ago | 2699 | onValueChange?: ( itemValue: any, itemPosition: number ) => void |
d24fea86Joshua Skelton10 years ago | 2700 | |
| 2701 | /** | |
1f817868Vladimir Kotikov9 years ago | 2702 | * Value matching value of one of the items. |
| 2703 | * Can be a string or an integer. | |
d24fea86Joshua Skelton10 years ago | 2704 | */ |
1f817868Vladimir Kotikov9 years ago | 2705 | selectedValue?: any |
| 2706 | | |
| 2707 | style?: ViewStyle | |
d24fea86Joshua Skelton10 years ago | 2708 | |
| 2709 | /** | |
1f817868Vladimir Kotikov9 years ago | 2710 | * Used to locate this view in end-to-end tests. |
d24fea86Joshua Skelton10 years ago | 2711 | */ |
1f817868Vladimir Kotikov9 years ago | 2712 | testId?: string |
| 2713 | | |
| 2714 | ref?: Ref<PickerStatic> | |
| 2715 | } | |
| 2716 | | |
| 2717 | /** | |
| 2718 | * @see https://facebook.github.io/react-native/docs/picker.html | |
| 2719 | * @see Picker.js | |
| 2720 | */ | |
| 2721 | export interface PickerStatic extends React.ComponentClass<PickerProperties> { | |
d24fea86Joshua Skelton10 years ago | 2722 | |
1f817868Vladimir Kotikov9 years ago | 2723 | /** |
| 2724 | * On Android, display the options in a dialog. | |
| 2725 | */ | |
| 2726 | MODE_DIALOG: string | |
d24fea86Joshua Skelton10 years ago | 2727 | /** |
1f817868Vladimir Kotikov9 years ago | 2728 | * On Android, display the options in a dropdown (this is the default). |
d24fea86Joshua Skelton10 years ago | 2729 | */ |
1f817868Vladimir Kotikov9 years ago | 2730 | MODE_DROPDOWN: string |
| 2731 | | |
| 2732 | Item?: PickerItemStatic | |
| 2733 | } | |
| 2734 | | |
| 2735 | /** | |
| 2736 | * @see https://facebook.github.io/react-native/docs/pickerios.html | |
| 2737 | * @see PickerIOS.ios.js | |
| 2738 | */ | |
| 2739 | export interface PickerIOSProperties extends ViewProperties, React.Props<PickerIOSStatic> { | |
| 2740 | | |
| 2741 | itemStyle?: TextStyle | |
| 2742 | onValueChange?: ( value: string | number ) => void | |
| 2743 | selectedValue?: string | number | |
| 2744 | | |
| 2745 | ref?: Ref<PickerIOSStatic & ViewStatic> | |
| 2746 | } | |
| 2747 | | |
| 2748 | /** | |
| 2749 | * @see https://facebook.github.io/react-native/docs/pickerios.html | |
| 2750 | * @see PickerIOS.ios.js | |
| 2751 | */ | |
| 2752 | export interface PickerIOSStatic extends NativeMethodsMixin, React.ClassicComponentClass<PickerIOSProperties> { | |
| 2753 | Item: PickerIOSItemStatic | |
| 2754 | } | |
| 2755 | | |
| 2756 | /** | |
| 2757 | * @see https://facebook.github.io/react-native/docs/progressbarandroid.html | |
| 2758 | * @see ProgressBarAndroid.android.js | |
| 2759 | */ | |
| 2760 | export interface ProgressBarAndroidProperties extends ViewProperties, React.Props<ProgressBarAndroidStatic> { | |
d24fea86Joshua Skelton10 years ago | 2761 | |
| 2762 | /** | |
1f817868Vladimir Kotikov9 years ago | 2763 | * Style of the ProgressBar. One of: |
| 2764 | Horizontal | |
| 2765 | Normal (default) | |
| 2766 | Small | |
| 2767 | Large | |
| 2768 | Inverse | |
| 2769 | SmallInverse | |
| 2770 | LargeInverse | |
d24fea86Joshua Skelton10 years ago | 2771 | */ |
1f817868Vladimir Kotikov9 years ago | 2772 | styleAttr?: "Horizontal" | "Normal" | "Small" | "Large" | "Inverse" | "SmallInverse" | "LargeInverse" |
d24fea86Joshua Skelton10 years ago | 2773 | |
| 2774 | /** | |
1f817868Vladimir Kotikov9 years ago | 2775 | * If the progress bar will show indeterminate progress. |
| 2776 | * Note that this can only be false if styleAttr is Horizontal. | |
d24fea86Joshua Skelton10 years ago | 2777 | */ |
1f817868Vladimir Kotikov9 years ago | 2778 | indeterminate?: boolean |
d24fea86Joshua Skelton10 years ago | 2779 | |
| 2780 | /** | |
1f817868Vladimir Kotikov9 years ago | 2781 | * The progress value (between 0 and 1). |
d24fea86Joshua Skelton10 years ago | 2782 | */ |
1f817868Vladimir Kotikov9 years ago | 2783 | progress?: number |
d24fea86Joshua Skelton10 years ago | 2784 | |
| 2785 | /** | |
1f817868Vladimir Kotikov9 years ago | 2786 | * Color of the progress bar. |
d24fea86Joshua Skelton10 years ago | 2787 | */ |
1f817868Vladimir Kotikov9 years ago | 2788 | color?: string |
d24fea86Joshua Skelton10 years ago | 2789 | |
| 2790 | /** | |
1f817868Vladimir Kotikov9 years ago | 2791 | * Used to locate this view in end-to-end tests. |
d24fea86Joshua Skelton10 years ago | 2792 | */ |
1f817868Vladimir Kotikov9 years ago | 2793 | testID?: string |
d24fea86Joshua Skelton10 years ago | 2794 | |
1f817868Vladimir Kotikov9 years ago | 2795 | ref?: Ref<ProgressBarAndroidStatic & ViewProperties> |
d24fea86Joshua Skelton10 years ago | 2796 | } |
| 2797 | | |
1f817868Vladimir Kotikov9 years ago | 2798 | /** |
| 2799 | * React component that wraps the Android-only `ProgressBar`. This component is used to indicate | |
| 2800 | * that the app is loading or there is some activity in the app. | |
| 2801 | */ | |
| 2802 | export interface ProgressBarAndroidStatic extends NativeMethodsMixin, React.ClassicComponentClass<ProgressBarAndroidProperties> {} | |
d24fea86Joshua Skelton10 years ago | 2803 | |
| 2804 | /** | |
1f817868Vladimir Kotikov9 years ago | 2805 | * @see https://facebook.github.io/react-native/docs/progressviewios.html |
| 2806 | * @see ProgressViewIOS.ios.js | |
d24fea86Joshua Skelton10 years ago | 2807 | */ |
1f817868Vladimir Kotikov9 years ago | 2808 | export interface ProgressViewIOSProperties extends ViewProperties, React.Props<ProgressViewIOSStatic> { |
d24fea86Joshua Skelton10 years ago | 2809 | |
| 2810 | /** | |
1f817868Vladimir Kotikov9 years ago | 2811 | * The progress bar style. |
d24fea86Joshua Skelton10 years ago | 2812 | */ |
1f817868Vladimir Kotikov9 years ago | 2813 | progressViewStyle?: "default" | "bar" |
d24fea86Joshua Skelton10 years ago | 2814 | |
| 2815 | /** | |
1f817868Vladimir Kotikov9 years ago | 2816 | * The progress value (between 0 and 1). |
d24fea86Joshua Skelton10 years ago | 2817 | */ |
1f817868Vladimir Kotikov9 years ago | 2818 | progress?: number |
d24fea86Joshua Skelton10 years ago | 2819 | |
| 2820 | /** | |
1f817868Vladimir Kotikov9 years ago | 2821 | * The tint color of the progress bar itself. |
d24fea86Joshua Skelton10 years ago | 2822 | */ |
1f817868Vladimir Kotikov9 years ago | 2823 | progressTintColor?: string |
d24fea86Joshua Skelton10 years ago | 2824 | |
| 2825 | /** | |
1f817868Vladimir Kotikov9 years ago | 2826 | * The tint color of the progress bar track. |
d24fea86Joshua Skelton10 years ago | 2827 | */ |
1f817868Vladimir Kotikov9 years ago | 2828 | trackTintColor?: string |
d24fea86Joshua Skelton10 years ago | 2829 | |
| 2830 | /** | |
1f817868Vladimir Kotikov9 years ago | 2831 | * A stretchable image to display as the progress bar. |
d24fea86Joshua Skelton10 years ago | 2832 | */ |
1f817868Vladimir Kotikov9 years ago | 2833 | progressImage?: ImageURISource | ImageURISource[] |
d24fea86Joshua Skelton10 years ago | 2834 | |
| 2835 | /** | |
1f817868Vladimir Kotikov9 years ago | 2836 | * A stretchable image to display behind the progress bar. |
d24fea86Joshua Skelton10 years ago | 2837 | */ |
1f817868Vladimir Kotikov9 years ago | 2838 | trackImage?: ImageURISource | ImageURISource[] |
d24fea86Joshua Skelton10 years ago | 2839 | |
1f817868Vladimir Kotikov9 years ago | 2840 | ref?: Ref<ProgressViewIOSStatic & ViewStatic> |
| 2841 | } | |
d24fea86Joshua Skelton10 years ago | 2842 | |
1f817868Vladimir Kotikov9 years ago | 2843 | export interface ProgressViewIOSStatic extends NativeMethodsMixin, React.ClassicComponentClass<ProgressViewIOSProperties> {} |
| 2844 | | |
| 2845 | export interface RefreshControlPropertiesIOS extends ViewProperties, React.Props<RefreshControlStatic> { | |
d24fea86Joshua Skelton10 years ago | 2846 | |
| 2847 | /** | |
1f817868Vladimir Kotikov9 years ago | 2848 | * The color of the refresh indicator. |
d24fea86Joshua Skelton10 years ago | 2849 | */ |
1f817868Vladimir Kotikov9 years ago | 2850 | tintColor?: string |
d24fea86Joshua Skelton10 years ago | 2851 | |
1f817868Vladimir Kotikov9 years ago | 2852 | /** |
| 2853 | * The title displayed under the refresh indicator. | |
| 2854 | */ | |
| 2855 | title?: string | |
d24fea86Joshua Skelton10 years ago | 2856 | |
1f817868Vladimir Kotikov9 years ago | 2857 | /** |
| 2858 | * Title color. | |
| 2859 | */ | |
| 2860 | titleColor?: string | |
d24fea86Joshua Skelton10 years ago | 2861 | |
1f817868Vladimir Kotikov9 years ago | 2862 | ref?: Ref<RefreshControlStatic & ViewStatic> |
d24fea86Joshua Skelton10 years ago | 2863 | } |
| 2864 | | |
1f817868Vladimir Kotikov9 years ago | 2865 | export interface RefreshControlPropertiesAndroid extends ViewProperties, React.Props<RefreshControlStatic> { |
d24fea86Joshua Skelton10 years ago | 2866 | |
| 2867 | /** | |
1f817868Vladimir Kotikov9 years ago | 2868 | * The colors (at least one) that will be used to draw the refresh indicator. |
d24fea86Joshua Skelton10 years ago | 2869 | */ |
1f817868Vladimir Kotikov9 years ago | 2870 | colors?: string[] |
d24fea86Joshua Skelton10 years ago | 2871 | |
| 2872 | /** | |
1f817868Vladimir Kotikov9 years ago | 2873 | * Whether the pull to refresh functionality is enabled. |
d24fea86Joshua Skelton10 years ago | 2874 | */ |
1f817868Vladimir Kotikov9 years ago | 2875 | enabled?: boolean |
d24fea86Joshua Skelton10 years ago | 2876 | |
| 2877 | /** | |
1f817868Vladimir Kotikov9 years ago | 2878 | * The background color of the refresh indicator. |
d24fea86Joshua Skelton10 years ago | 2879 | */ |
1f817868Vladimir Kotikov9 years ago | 2880 | progressBackgroundColor?: string |
d24fea86Joshua Skelton10 years ago | 2881 | |
| 2882 | /** | |
1f817868Vladimir Kotikov9 years ago | 2883 | * Size of the refresh indicator, see RefreshControl.SIZE. |
d24fea86Joshua Skelton10 years ago | 2884 | */ |
1f817868Vladimir Kotikov9 years ago | 2885 | size?: number |
d24fea86Joshua Skelton10 years ago | 2886 | |
| 2887 | /** | |
1f817868Vladimir Kotikov9 years ago | 2888 | * Progress view top offset |
| 2889 | * @platform android | |
d24fea86Joshua Skelton10 years ago | 2890 | */ |
1f817868Vladimir Kotikov9 years ago | 2891 | progressViewOffset?: number |
d24fea86Joshua Skelton10 years ago | 2892 | |
1f817868Vladimir Kotikov9 years ago | 2893 | ref?: Ref<RefreshControlStatic & ViewStatic> |
d24fea86Joshua Skelton10 years ago | 2894 | } |
| 2895 | | |
1f817868Vladimir Kotikov9 years ago | 2896 | export interface RefreshControlProperties extends RefreshControlPropertiesIOS, RefreshControlPropertiesAndroid, React.Props<RefreshControl> { |
d24fea86Joshua Skelton10 years ago | 2897 | |
| 2898 | /** | |
1f817868Vladimir Kotikov9 years ago | 2899 | * Called when the view starts refreshing. |
d24fea86Joshua Skelton10 years ago | 2900 | */ |
1f817868Vladimir Kotikov9 years ago | 2901 | onRefresh?: () => void |
| 2902 | | |
| 2903 | /** | |
| 2904 | * Whether the view should be indicating an active refresh. | |
| 2905 | */ | |
| 2906 | refreshing: boolean | |
| 2907 | | |
| 2908 | ref?: Ref<RefreshControlStatic> | |
d24fea86Joshua Skelton10 years ago | 2909 | } |
| 2910 | | |
| 2911 | /** | |
1f817868Vladimir Kotikov9 years ago | 2912 | * This component is used inside a ScrollView or ListView to add pull to refresh |
| 2913 | * functionality. When the ScrollView is at `scrollY: 0`, swiping down | |
| 2914 | * triggers an `onRefresh` event. | |
d24fea86Joshua Skelton10 years ago | 2915 | * |
1f817868Vladimir Kotikov9 years ago | 2916 | * ### Usage example |
| 2917 | * | |
| 2918 | * ``` js | |
| 2919 | * class RefreshableList extends Component { | |
| 2920 | * constructor(props) { | |
| 2921 | * super(props); | |
| 2922 | * this.state = { | |
| 2923 | * refreshing: false, | |
| 2924 | * }; | |
| 2925 | * } | |
| 2926 | * | |
| 2927 | * _onRefresh() { | |
| 2928 | * this.setState({refreshing: true}); | |
| 2929 | * fetchData().then(() => { | |
| 2930 | * this.setState({refreshing: false}); | |
| 2931 | * }); | |
| 2932 | * } | |
| 2933 | * | |
| 2934 | * render() { | |
| 2935 | * return ( | |
| 2936 | * <ListView | |
| 2937 | * refreshControl={ | |
| 2938 | * <RefreshControl | |
| 2939 | * refreshing={this.state.refreshing} | |
| 2940 | * onRefresh={this._onRefresh.bind(this)} | |
| 2941 | * /> | |
| 2942 | * } | |
| 2943 | * ... | |
| 2944 | * > | |
| 2945 | * ... | |
| 2946 | * </ListView> | |
| 2947 | * ); | |
| 2948 | * } | |
| 2949 | * ... | |
| 2950 | * } | |
| 2951 | * ``` | |
| 2952 | * | |
| 2953 | * __Note:__ `refreshing` is a controlled prop, this is why it needs to be set to true | |
| 2954 | * in the `onRefresh` function otherwise the refresh indicator will stop immediately. | |
d24fea86Joshua Skelton10 years ago | 2955 | */ |
1f817868Vladimir Kotikov9 years ago | 2956 | export interface RefreshControlStatic extends NativeMethodsMixin, React.ClassicComponentClass<RefreshControlProperties> { |
| 2957 | SIZE: Object // Undocumented | |
d24fea86Joshua Skelton10 years ago | 2958 | } |
| 2959 | | |
1f817868Vladimir Kotikov9 years ago | 2960 | export interface RecyclerViewBackedScrollViewProperties extends ScrollViewProperties, React.Props<RecyclerViewBackedScrollViewStatic> { |
| 2961 | ref?: Ref<RecyclerViewBackedScrollViewProperties & ScrollViewProperties> | |
d24fea86Joshua Skelton10 years ago | 2962 | } |
| 2963 | | |
| 2964 | /** | |
1f817868Vladimir Kotikov9 years ago | 2965 | * Wrapper around android native recycler view. |
d24fea86Joshua Skelton10 years ago | 2966 | * |
1f817868Vladimir Kotikov9 years ago | 2967 | * It simply renders rows passed as children in a separate recycler view cells |
| 2968 | * similarly to how `ScrollView` is doing it. Thanks to the fact that it uses | |
| 2969 | * native `RecyclerView` though, rows that are out of sight are going to be | |
| 2970 | * automatically detached (similarly on how this would work with | |
| 2971 | * `removeClippedSubviews = true` on a `ScrollView.js`). | |
d24fea86Joshua Skelton10 years ago | 2972 | * |
1f817868Vladimir Kotikov9 years ago | 2973 | * CAUTION: This is an experimental component and should only be used together |
| 2974 | * with javascript implementation of list view (see ListView.js). In order to | |
| 2975 | * use it pass this component as `renderScrollComponent` to the list view. For | |
| 2976 | * now only horizontal scrolling is supported. | |
d24fea86Joshua Skelton10 years ago | 2977 | */ |
1f817868Vladimir Kotikov9 years ago | 2978 | export interface RecyclerViewBackedScrollViewStatic extends ScrollResponderMixin, React.ClassicComponentClass<RecyclerViewBackedScrollViewProperties> { |
d24fea86Joshua Skelton10 years ago | 2979 | |
1f817868Vladimir Kotikov9 years ago | 2980 | /** |
| 2981 | * A helper function to scroll to a specific point in the scrollview. | |
| 2982 | * This is currently used to help focus on child textviews, but can also | |
| 2983 | * be used to quickly scroll to any element we want to focus. Syntax: | |
| 2984 | * | |
| 2985 | * scrollResponderScrollTo(options: {x: number = 0; y: number = 0; animated: boolean = true}) | |
| 2986 | * | |
| 2987 | * Note: The weird argument signature is due to the fact that, for historical reasons, | |
| 2988 | * the function also accepts separate arguments as as alternative to the options object. | |
| 2989 | * This is deprecated due to ambiguity (y before x), and SHOULD NOT BE USED. | |
| 2990 | */ | |
| 2991 | scrollTo( | |
| 2992 | y?: number | { x?: number, y?: number, animated?: boolean }, | |
| 2993 | x?: number, | |
| 2994 | animated?: boolean | |
| 2995 | ): void; | |
d24fea86Joshua Skelton10 years ago | 2996 | |
1f817868Vladimir Kotikov9 years ago | 2997 | /** |
| 2998 | * Returns a reference to the underlying scroll responder, which supports | |
| 2999 | * operations like `scrollTo`. All ScrollView-like components should | |
| 3000 | * implement this method so that they can be composed while providing access | |
| 3001 | * to the underlying scroll responder's methods. | |
| 3002 | */ | |
| 3003 | getScrollResponder(): JSX.Element; | |
d24fea86Joshua Skelton10 years ago | 3004 | } |
| 3005 | | |
1f817868Vladimir Kotikov9 years ago | 3006 | export interface SliderPropertiesIOS extends ViewProperties, React.Props<SliderStatic> { |
d24fea86Joshua Skelton10 years ago | 3007 | |
1f817868Vladimir Kotikov9 years ago | 3008 | /** |
| 3009 | * Assigns a maximum track image. Only static images are supported. | |
| 3010 | * The leftmost pixel of the image will be stretched to fill the track. | |
| 3011 | */ | |
| 3012 | maximumTrackImage?: ImageURISource | |
d24fea86Joshua Skelton10 years ago | 3013 | |
1f817868Vladimir Kotikov9 years ago | 3014 | /** |
| 3015 | * The color used for the track to the right of the button. | |
| 3016 | * Overrides the default blue gradient image. | |
| 3017 | */ | |
| 3018 | maximumTrackTintColor?: string | |
d24fea86Joshua Skelton10 years ago | 3019 | |
1f817868Vladimir Kotikov9 years ago | 3020 | /** |
| 3021 | * Assigns a minimum track image. Only static images are supported. | |
| 3022 | * The rightmost pixel of the image will be stretched to fill the track. | |
| 3023 | */ | |
| 3024 | minimumTrackImage?: ImageURISource | |
d24fea86Joshua Skelton10 years ago | 3025 | |
1f817868Vladimir Kotikov9 years ago | 3026 | /** |
| 3027 | * The color used for the track to the left of the button. | |
| 3028 | * Overrides the default blue gradient image. | |
| 3029 | */ | |
| 3030 | minimumTrackTintColor?: string | |
d24fea86Joshua Skelton10 years ago | 3031 | |
1f817868Vladimir Kotikov9 years ago | 3032 | /** |
| 3033 | * Sets an image for the thumb. Only static images are supported. | |
| 3034 | */ | |
| 3035 | thumbImage?: ImageURISource | |
d24fea86Joshua Skelton10 years ago | 3036 | |
1f817868Vladimir Kotikov9 years ago | 3037 | /** |
| 3038 | * Assigns a single image for the track. Only static images | |
| 3039 | * are supported. The center pixel of the image will be stretched | |
| 3040 | * to fill the track. | |
| 3041 | */ | |
| 3042 | trackImage?: ImageURISource | |
d24fea86Joshua Skelton10 years ago | 3043 | |
1f817868Vladimir Kotikov9 years ago | 3044 | ref?: Ref<SliderStatic> |
d24fea86Joshua Skelton10 years ago | 3045 | } |
| 3046 | | |
1f817868Vladimir Kotikov9 years ago | 3047 | export interface SliderProperties extends SliderPropertiesIOS, React.Props<SliderStatic> { |
d24fea86Joshua Skelton10 years ago | 3048 | |
| 3049 | /** | |
1f817868Vladimir Kotikov9 years ago | 3050 | * If true the user won't be able to move the slider. |
| 3051 | * Default value is false. | |
d24fea86Joshua Skelton10 years ago | 3052 | */ |
1f817868Vladimir Kotikov9 years ago | 3053 | disabled?: boolean |
| 3054 | | |
d24fea86Joshua Skelton10 years ago | 3055 | /** |
1f817868Vladimir Kotikov9 years ago | 3056 | * Initial maximum value of the slider. Default value is 1. |
d24fea86Joshua Skelton10 years ago | 3057 | */ |
1f817868Vladimir Kotikov9 years ago | 3058 | maximumValue?: number |
d24fea86Joshua Skelton10 years ago | 3059 | |
| 3060 | /** | |
1f817868Vladimir Kotikov9 years ago | 3061 | * Initial minimum value of the slider. Default value is 0. |
d24fea86Joshua Skelton10 years ago | 3062 | */ |
1f817868Vladimir Kotikov9 years ago | 3063 | minimumValue?: number |
d24fea86Joshua Skelton10 years ago | 3064 | |
| 3065 | /** | |
1f817868Vladimir Kotikov9 years ago | 3066 | * Callback called when the user finishes changing the value (e.g. when the slider is released). |
| 3067 | * @param value | |
d24fea86Joshua Skelton10 years ago | 3068 | */ |
1f817868Vladimir Kotikov9 years ago | 3069 | onSlidingComplete?: (value: number) => void |
d24fea86Joshua Skelton10 years ago | 3070 | |
| 3071 | /** | |
1f817868Vladimir Kotikov9 years ago | 3072 | * Callback continuously called while the user is dragging the slider. |
| 3073 | * @param value | |
d24fea86Joshua Skelton10 years ago | 3074 | */ |
1f817868Vladimir Kotikov9 years ago | 3075 | onValueChange?: (value: number) => void |
d24fea86Joshua Skelton10 years ago | 3076 | |
| 3077 | /** | |
1f817868Vladimir Kotikov9 years ago | 3078 | * Step value of the slider. The value should be between 0 and (maximumValue - minimumValue). Default value is 0. |
d24fea86Joshua Skelton10 years ago | 3079 | */ |
1f817868Vladimir Kotikov9 years ago | 3080 | step?: number |
d24fea86Joshua Skelton10 years ago | 3081 | |
| 3082 | /** | |
1f817868Vladimir Kotikov9 years ago | 3083 | * Used to style and layout the Slider. See StyleSheet.js and ViewStylePropTypes.js for more info. |
d24fea86Joshua Skelton10 years ago | 3084 | */ |
1f817868Vladimir Kotikov9 years ago | 3085 | style?: ViewStyle |
d24fea86Joshua Skelton10 years ago | 3086 | |
| 3087 | /** | |
1f817868Vladimir Kotikov9 years ago | 3088 | * Used to locate this view in UI automation tests. |
d24fea86Joshua Skelton10 years ago | 3089 | */ |
1f817868Vladimir Kotikov9 years ago | 3090 | testID?: string |
d24fea86Joshua Skelton10 years ago | 3091 | |
| 3092 | /** | |
1f817868Vladimir Kotikov9 years ago | 3093 | * Initial value of the slider. The value should be between minimumValue |
| 3094 | * and maximumValue, which default to 0 and 1 respectively. | |
| 3095 | * Default value is 0. | |
| 3096 | * This is not a controlled component, you don't need to update | |
| 3097 | * the value during dragging. | |
d24fea86Joshua Skelton10 years ago | 3098 | */ |
1f817868Vladimir Kotikov9 years ago | 3099 | value?: number |
d24fea86Joshua Skelton10 years ago | 3100 | } |
| 3101 | | |
| 3102 | /** | |
1f817868Vladimir Kotikov9 years ago | 3103 | * A component used to select a single value from a range of values. |
d24fea86Joshua Skelton10 years ago | 3104 | */ |
1f817868Vladimir Kotikov9 years ago | 3105 | export interface SliderStatic extends NativeMethodsMixin, React.ClassicComponentClass<SliderProperties> {} |
d24fea86Joshua Skelton10 years ago | 3106 | |
1f817868Vladimir Kotikov9 years ago | 3107 | /** |
| 3108 | * https://facebook.github.io/react-native/docs/switchios.html#props | |
| 3109 | */ | |
| 3110 | export interface SwitchIOSProperties extends ViewProperties, React.Props<SwitchIOSStatic> { | |
d24fea86Joshua Skelton10 years ago | 3111 | |
| 3112 | /** | |
1f817868Vladimir Kotikov9 years ago | 3113 | * If true the user won't be able to toggle the switch. Default value is false. |
d24fea86Joshua Skelton10 years ago | 3114 | */ |
1f817868Vladimir Kotikov9 years ago | 3115 | disabled?: boolean |
d24fea86Joshua Skelton10 years ago | 3116 | |
| 3117 | /** | |
1f817868Vladimir Kotikov9 years ago | 3118 | * Background color when the switch is turned on. |
d24fea86Joshua Skelton10 years ago | 3119 | */ |
1f817868Vladimir Kotikov9 years ago | 3120 | onTintColor?: string |
d24fea86Joshua Skelton10 years ago | 3121 | |
| 3122 | /** | |
1f817868Vladimir Kotikov9 years ago | 3123 | * Callback that is called when the user toggles the switch. |
d24fea86Joshua Skelton10 years ago | 3124 | */ |
1f817868Vladimir Kotikov9 years ago | 3125 | onValueChange?: ( value: boolean ) => void |
d24fea86Joshua Skelton10 years ago | 3126 | |
| 3127 | /** | |
1f817868Vladimir Kotikov9 years ago | 3128 | * Background color for the switch round button. |
d24fea86Joshua Skelton10 years ago | 3129 | */ |
1f817868Vladimir Kotikov9 years ago | 3130 | thumbTintColor?: string |
d24fea86Joshua Skelton10 years ago | 3131 | |
| 3132 | /** | |
1f817868Vladimir Kotikov9 years ago | 3133 | * Background color when the switch is turned off. |
d24fea86Joshua Skelton10 years ago | 3134 | */ |
1f817868Vladimir Kotikov9 years ago | 3135 | tintColor?: string |
d24fea86Joshua Skelton10 years ago | 3136 | |
| 3137 | /** | |
1f817868Vladimir Kotikov9 years ago | 3138 | * The value of the switch, if true the switch will be turned on. Default value is false. |
d24fea86Joshua Skelton10 years ago | 3139 | */ |
1f817868Vladimir Kotikov9 years ago | 3140 | value?: boolean |
d24fea86Joshua Skelton10 years ago | 3141 | |
1f817868Vladimir Kotikov9 years ago | 3142 | ref?: Ref<SwitchIOSStatic> |
| 3143 | } | |
d24fea86Joshua Skelton10 years ago | 3144 | |
1f817868Vladimir Kotikov9 years ago | 3145 | /** |
| 3146 | * | |
| 3147 | * Use SwitchIOS to render a boolean input on iOS. | |
| 3148 | * | |
| 3149 | * This is a controlled component, so you must hook in to the onValueChange callback and update the value prop in order for the component to update, | |
| 3150 | * otherwise the user's change will be reverted immediately to reflect props.value as the source of truth. | |
| 3151 | * | |
| 3152 | * @see https://facebook.github.io/react-native/docs/switchios.html | |
| 3153 | */ | |
| 3154 | export interface SwitchIOSStatic extends React.ComponentClass<SwitchIOSProperties> { | |
d24fea86Joshua Skelton10 years ago | 3155 | |
1f817868Vladimir Kotikov9 years ago | 3156 | } |
d24fea86Joshua Skelton10 years ago | 3157 | |
1f817868Vladimir Kotikov9 years ago | 3158 | export type ImageResizeMode = "contain" | "cover" | "stretch" | "center" | "repeat" |
| 3159 | | |
| 3160 | /** | |
| 3161 | * @see ImageResizeMode.js | |
| 3162 | */ | |
| 3163 | export interface ImageResizeModeStatic { | |
d24fea86Joshua Skelton10 years ago | 3164 | /** |
1f817868Vladimir Kotikov9 years ago | 3165 | * contain - The image will be resized such that it will be completely |
| 3166 | * visible, contained within the frame of the View. | |
d24fea86Joshua Skelton10 years ago | 3167 | */ |
1f817868Vladimir Kotikov9 years ago | 3168 | contain: ImageResizeMode |
d24fea86Joshua Skelton10 years ago | 3169 | /** |
1f817868Vladimir Kotikov9 years ago | 3170 | * cover - The image will be resized such that the entire area of the view |
| 3171 | * is covered by the image, potentially clipping parts of the image. | |
d24fea86Joshua Skelton10 years ago | 3172 | */ |
1f817868Vladimir Kotikov9 years ago | 3173 | cover: ImageResizeMode |
d24fea86Joshua Skelton10 years ago | 3174 | /** |
1f817868Vladimir Kotikov9 years ago | 3175 | * stretch - The image will be stretched to fill the entire frame of the |
| 3176 | * view without clipping. This may change the aspect ratio of the image, | |
| 3177 | * distoring it. Only supported on iOS. | |
d24fea86Joshua Skelton10 years ago | 3178 | */ |
1f817868Vladimir Kotikov9 years ago | 3179 | stretch: ImageResizeMode |
d24fea86Joshua Skelton10 years ago | 3180 | /** |
1f817868Vladimir Kotikov9 years ago | 3181 | * center - The image will be scaled down such that it is completely visible, |
| 3182 | * if bigger than the area of the view. | |
| 3183 | * The image will not be scaled up. | |
d24fea86Joshua Skelton10 years ago | 3184 | */ |
1f817868Vladimir Kotikov9 years ago | 3185 | center: ImageResizeMode, |
d24fea86Joshua Skelton10 years ago | 3186 | |
| 3187 | /** | |
1f817868Vladimir Kotikov9 years ago | 3188 | * repeat - The image will be repeated to cover the frame of the View. The |
| 3189 | * image will keep it's size and aspect ratio. | |
d24fea86Joshua Skelton10 years ago | 3190 | */ |
1f817868Vladimir Kotikov9 years ago | 3191 | repeat: ImageResizeMode, |
d24fea86Joshua Skelton10 years ago | 3192 | } |
| 3193 | | |
1f817868Vladimir Kotikov9 years ago | 3194 | export interface ShadowStyleIOS { |
| 3195 | shadowColor?: string | |
| 3196 | shadowOffset?: {width: number, height: number} | |
| 3197 | shadowOpacity?: number | |
| 3198 | shadowRadius?: number | |
d24fea86Joshua Skelton10 years ago | 3199 | } |
| 3200 | | |
| 3201 | /** | |
1f817868Vladimir Kotikov9 years ago | 3202 | * Image style |
| 3203 | * @see https://facebook.github.io/react-native/docs/image.html#style | |
d24fea86Joshua Skelton10 years ago | 3204 | */ |
1f817868Vladimir Kotikov9 years ago | 3205 | export interface ImageStyle extends FlexStyle, TransformsStyle, ShadowStyleIOS { |
| 3206 | resizeMode?: React.ImageResizeMode | |
| 3207 | backfaceVisibility?: "visible" | "hidden" | |
| 3208 | borderBottomLeftRadius?: number | |
| 3209 | borderBottomRightRadius?: number | |
| 3210 | backgroundColor?: string | |
| 3211 | borderColor?: string | |
| 3212 | borderWidth?: number | |
| 3213 | borderRadius?: number | |
| 3214 | borderTopLeftRadius?: number | |
| 3215 | borderTopRightRadius?: number | |
| 3216 | overflow?: "visible" | "hidden" | |
| 3217 | overlayColor?: string | |
| 3218 | tintColor?: string | |
| 3219 | opacity?: number | |
d24fea86Joshua Skelton10 years ago | 3220 | } |
| 3221 | | |
1f817868Vladimir Kotikov9 years ago | 3222 | export interface ImagePropertiesIOS { |
d24fea86Joshua Skelton10 years ago | 3223 | /** |
1f817868Vladimir Kotikov9 years ago | 3224 | * The text that's read by the screen reader when the user interacts with the image. |
d24fea86Joshua Skelton10 years ago | 3225 | */ |
1f817868Vladimir Kotikov9 years ago | 3226 | accessibilityLabel?: string; |
d24fea86Joshua Skelton10 years ago | 3227 | |
| 3228 | /** | |
1f817868Vladimir Kotikov9 years ago | 3229 | * When true, indicates the image is an accessibility element. |
d24fea86Joshua Skelton10 years ago | 3230 | */ |
1f817868Vladimir Kotikov9 years ago | 3231 | accessible?: boolean; |
d24fea86Joshua Skelton10 years ago | 3232 | |
| 3233 | /** | |
1f817868Vladimir Kotikov9 years ago | 3234 | * blurRadius: the blur radius of the blur filter added to the image |
| 3235 | * @platform ios | |
| 3236 | */ | |
| 3237 | blurRadius?: number, | |
d24fea86Joshua Skelton10 years ago | 3238 | |
| 3239 | /** | |
1f817868Vladimir Kotikov9 years ago | 3240 | * When the image is resized, the corners of the size specified by capInsets will stay a fixed size, |
| 3241 | * but the center content and borders of the image will be stretched. | |
| 3242 | * This is useful for creating resizable rounded buttons, shadows, and other resizable assets. | |
| 3243 | * More info on Apple documentation | |
d24fea86Joshua Skelton10 years ago | 3244 | */ |
1f817868Vladimir Kotikov9 years ago | 3245 | capInsets?: Insets |
d24fea86Joshua Skelton10 years ago | 3246 | |
| 3247 | /** | |
1f817868Vladimir Kotikov9 years ago | 3248 | * A static image to display while downloading the final image off the network. |
d24fea86Joshua Skelton10 years ago | 3249 | */ |
1f817868Vladimir Kotikov9 years ago | 3250 | defaultSource?: ImageURISource | number |
d24fea86Joshua Skelton10 years ago | 3251 | |
| 3252 | /** | |
1f817868Vladimir Kotikov9 years ago | 3253 | * Invoked on load error with {nativeEvent: {error}} |
d24fea86Joshua Skelton10 years ago | 3254 | */ |
1f817868Vladimir Kotikov9 years ago | 3255 | onError?: ( error: {nativeEvent: any} ) => void |
d24fea86Joshua Skelton10 years ago | 3256 | |
| 3257 | /** | |
1f817868Vladimir Kotikov9 years ago | 3258 | * Invoked on download progress with {nativeEvent: {loaded, total}} |
d24fea86Joshua Skelton10 years ago | 3259 | */ |
1f817868Vladimir Kotikov9 years ago | 3260 | onProgress?: ()=> void |
d24fea86Joshua Skelton10 years ago | 3261 | |
| 3262 | /** | |
1f817868Vladimir Kotikov9 years ago | 3263 | * Invoked when a partial load of the image is complete. The definition of |
| 3264 | * what constitutes a "partial load" is loader specific though this is meant | |
| 3265 | * for progressive JPEG loads. | |
| 3266 | * @platform ios | |
d24fea86Joshua Skelton10 years ago | 3267 | */ |
1f817868Vladimir Kotikov9 years ago | 3268 | onPartialLoad?: () => void, |
d24fea86Joshua Skelton10 years ago | 3269 | } |
| 3270 | | |
1f817868Vladimir Kotikov9 years ago | 3271 | /* |
| 3272 | * @see https://github.com/facebook/react-native/blob/master/Libraries/Image/ImageSourcePropType.js | |
d24fea86Joshua Skelton10 years ago | 3273 | */ |
1f817868Vladimir Kotikov9 years ago | 3274 | interface ImageURISource { |
d24fea86Joshua Skelton10 years ago | 3275 | /** |
1f817868Vladimir Kotikov9 years ago | 3276 | * `uri` is a string representing the resource identifier for the image, which |
| 3277 | * could be an http address, a local file path, or the name of a static image | |
| 3278 | * resource (which should be wrapped in the `require('./path/to/image.png')` | |
| 3279 | * function). | |
d24fea86Joshua Skelton10 years ago | 3280 | */ |
1f817868Vladimir Kotikov9 years ago | 3281 | uri?: string, |
d24fea86Joshua Skelton10 years ago | 3282 | /** |
1f817868Vladimir Kotikov9 years ago | 3283 | * `bundle` is the iOS asset bundle which the image is included in. This |
| 3284 | * will default to [NSBundle mainBundle] if not set. | |
| 3285 | * @platform ios | |
d24fea86Joshua Skelton10 years ago | 3286 | */ |
1f817868Vladimir Kotikov9 years ago | 3287 | bundle?: string, |
d24fea86Joshua Skelton10 years ago | 3288 | /** |
1f817868Vladimir Kotikov9 years ago | 3289 | * `method` is the HTTP Method to use. Defaults to GET if not specified. |
d24fea86Joshua Skelton10 years ago | 3290 | */ |
1f817868Vladimir Kotikov9 years ago | 3291 | method?: string, |
d24fea86Joshua Skelton10 years ago | 3292 | /** |
1f817868Vladimir Kotikov9 years ago | 3293 | * `headers` is an object representing the HTTP headers to send along with the |
| 3294 | * request for a remote image. | |
d24fea86Joshua Skelton10 years ago | 3295 | */ |
1f817868Vladimir Kotikov9 years ago | 3296 | headers?: {[key: string]: string}, |
d24fea86Joshua Skelton10 years ago | 3297 | /** |
1f817868Vladimir Kotikov9 years ago | 3298 | * `body` is the HTTP body to send with the request. This must be a valid |
| 3299 | * UTF-8 string, and will be sent exactly as specified, with no | |
| 3300 | * additional encoding (e.g. URL-escaping or base64) applied. | |
d24fea86Joshua Skelton10 years ago | 3301 | */ |
1f817868Vladimir Kotikov9 years ago | 3302 | body?: string, |
d24fea86Joshua Skelton10 years ago | 3303 | /** |
1f817868Vladimir Kotikov9 years ago | 3304 | * `width` and `height` can be specified if known at build time, in which case |
| 3305 | * these will be used to set the default `<Image/>` component dimensions. | |
d24fea86Joshua Skelton10 years ago | 3306 | */ |
1f817868Vladimir Kotikov9 years ago | 3307 | width?: number, |
| 3308 | height?: number, | |
d24fea86Joshua Skelton10 years ago | 3309 | /** |
1f817868Vladimir Kotikov9 years ago | 3310 | * `scale` is used to indicate the scale factor of the image. Defaults to 1.0 if |
| 3311 | * unspecified, meaning that one image pixel equates to one display point / DIP. | |
d24fea86Joshua Skelton10 years ago | 3312 | */ |
1f817868Vladimir Kotikov9 years ago | 3313 | scale?: number, |
d24fea86Joshua Skelton10 years ago | 3314 | } |
| 3315 | | |
| 3316 | /** | |
1f817868Vladimir Kotikov9 years ago | 3317 | * @see https://facebook.github.io/react-native/docs/image.html |
d24fea86Joshua Skelton10 years ago | 3318 | */ |
1f817868Vladimir Kotikov9 years ago | 3319 | export interface ImageProperties extends ImagePropertiesIOS, React.Props<Image> { |
| 3320 | fadeDuration?: number | |
d24fea86Joshua Skelton10 years ago | 3321 | /** |
1f817868Vladimir Kotikov9 years ago | 3322 | * onLayout function |
| 3323 | * | |
| 3324 | * Invoked on mount and layout changes with | |
| 3325 | * | |
| 3326 | * {nativeEvent: { layout: {x, y, width, height}}}. | |
d24fea86Joshua Skelton10 years ago | 3327 | */ |
1f817868Vladimir Kotikov9 years ago | 3328 | onLayout?: ( event: LayoutChangeEvent ) => void; |
d24fea86Joshua Skelton10 years ago | 3329 | |
| 3330 | /** | |
1f817868Vladimir Kotikov9 years ago | 3331 | * Invoked when load completes successfully |
d24fea86Joshua Skelton10 years ago | 3332 | */ |
1f817868Vladimir Kotikov9 years ago | 3333 | onLoad?: () => void |
d24fea86Joshua Skelton10 years ago | 3334 | |
| 3335 | /** | |
1f817868Vladimir Kotikov9 years ago | 3336 | * Invoked when load either succeeds or fails |
d24fea86Joshua Skelton10 years ago | 3337 | */ |
1f817868Vladimir Kotikov9 years ago | 3338 | onLoadEnd?: () => void |
d24fea86Joshua Skelton10 years ago | 3339 | |
1f817868Vladimir Kotikov9 years ago | 3340 | /** |
| 3341 | * Invoked on load start | |
| 3342 | */ | |
| 3343 | onLoadStart?: () => void | |
d24fea86Joshua Skelton10 years ago | 3344 | |
1f817868Vladimir Kotikov9 years ago | 3345 | progressiveRenderingEnabled?: boolean |
d24fea86Joshua Skelton10 years ago | 3346 | |
| 3347 | /** | |
1f817868Vladimir Kotikov9 years ago | 3348 | * Determines how to resize the image when the frame doesn't match the raw |
| 3349 | * image dimensions. | |
| 3350 | * | |
| 3351 | * 'cover': Scale the image uniformly (maintain the image's aspect ratio) | |
| 3352 | * so that both dimensions (width and height) of the image will be equal | |
| 3353 | * to or larger than the corresponding dimension of the view (minus padding). | |
| 3354 | * | |
| 3355 | * 'contain': Scale the image uniformly (maintain the image's aspect ratio) | |
| 3356 | * so that both dimensions (width and height) of the image will be equal to | |
| 3357 | * or less than the corresponding dimension of the view (minus padding). | |
| 3358 | * | |
| 3359 | * 'stretch': Scale width and height independently, This may change the | |
| 3360 | * aspect ratio of the src. | |
| 3361 | * | |
| 3362 | * 'center': Scale the image down so that it is completely visible, | |
| 3363 | * if bigger than the area of the view. | |
| 3364 | * The image will not be scaled up. | |
d24fea86Joshua Skelton10 years ago | 3365 | */ |
1f817868Vladimir Kotikov9 years ago | 3366 | resizeMode?: 'cover' |'contain' |'stretch' |'center' |
| 3367 | | |
d24fea86Joshua Skelton10 years ago | 3368 | /** |
1f817868Vladimir Kotikov9 years ago | 3369 | * The mechanism that should be used to resize the image when the image's dimensions |
| 3370 | * differ from the image view's dimensions. Defaults to `auto`. | |
| 3371 | * | |
| 3372 | * - `auto`: Use heuristics to pick between `resize` and `scale`. | |
| 3373 | * | |
| 3374 | * - `resize`: A software operation which changes the encoded image in memory before it | |
| 3375 | * gets decoded. This should be used instead of `scale` when the image is much larger | |
| 3376 | * than the view. | |
| 3377 | * | |
| 3378 | * - `scale`: The image gets drawn downscaled or upscaled. Compared to `resize`, `scale` is | |
| 3379 | * faster (usually hardware accelerated) and produces higher quality images. This | |
| 3380 | * should be used if the image is smaller than the view. It should also be used if the | |
| 3381 | * image is slightly bigger than the view. | |
| 3382 | * | |
| 3383 | * More details about `resize` and `scale` can be found at http://frescolib.org/docs/resizing-rotating.html. | |
| 3384 | * | |
| 3385 | * @platform android | |
d24fea86Joshua Skelton10 years ago | 3386 | */ |
1f817868Vladimir Kotikov9 years ago | 3387 | resizeMethod?: 'auto' | 'resize' | 'scale' |
d24fea86Joshua Skelton10 years ago | 3388 | |
| 3389 | /** | |
1f817868Vladimir Kotikov9 years ago | 3390 | * `uri` is a string representing the resource identifier for the image, which |
| 3391 | * could be an http address, a local file path, or a static image | |
| 3392 | * resource (which should be wrapped in the `require('./path/to/image.png')` function). | |
| 3393 | * This prop can also contain several remote `uri`, specified together with | |
| 3394 | * their width and height. The native side will then choose the best `uri` to display | |
| 3395 | * based on the measured size of the image container. | |
d24fea86Joshua Skelton10 years ago | 3396 | */ |
1f817868Vladimir Kotikov9 years ago | 3397 | // source: {uri: string} | number | {uri: string, width: number, height: number}[]; |
| 3398 | | |
| 3399 | source: ImageURISource | ImageURISource[] | |
d24fea86Joshua Skelton10 years ago | 3400 | |
| 3401 | /** | |
1f817868Vladimir Kotikov9 years ago | 3402 | * similarly to `source`, this property represents the resource used to render |
| 3403 | * the loading indicator for the image, displayed until image is ready to be | |
| 3404 | * displayed, typically after when it got downloaded from network. | |
d24fea86Joshua Skelton10 years ago | 3405 | */ |
1f817868Vladimir Kotikov9 years ago | 3406 | loadingIndicatorSource?: ImageURISource; |
| 3407 | | |
d24fea86Joshua Skelton10 years ago | 3408 | /** |
1f817868Vladimir Kotikov9 years ago | 3409 | * |
| 3410 | * Style | |
d24fea86Joshua Skelton10 years ago | 3411 | */ |
1f817868Vladimir Kotikov9 years ago | 3412 | style?: ImageStyle; |
d24fea86Joshua Skelton10 years ago | 3413 | |
| 3414 | /** | |
1f817868Vladimir Kotikov9 years ago | 3415 | * A unique identifier for this element to be used in UI Automation testing scripts. |
d24fea86Joshua Skelton10 years ago | 3416 | */ |
1f817868Vladimir Kotikov9 years ago | 3417 | testID?: string; |
| 3418 | | |
| 3419 | } | |
| 3420 | | |
| 3421 | export interface ImageStatic extends React.NativeMethodsMixin, React.ComponentClass<ImageProperties> { | |
| 3422 | resizeMode: ImageResizeMode | |
| 3423 | getSize(uri: string, success: (width: number, height: number) => void, failure: (error: any) => void): any | |
| 3424 | prefetch(url: string): any | |
| 3425 | abortPrefetch?(requestId: number): void | |
| 3426 | queryCache?(urls: string[]): Promise<Map<string, 'memory' | 'disk'>> | |
| 3427 | } | |
| 3428 | | |
| 3429 | /** | |
| 3430 | * @see https://facebook.github.io/react-native/docs/listview.html#props | |
| 3431 | */ | |
| 3432 | export interface ListViewProperties extends ScrollViewProperties, React.Props<ListViewStatic> { | |
d24fea86Joshua Skelton10 years ago | 3433 | |
| 3434 | /** | |
1f817868Vladimir Kotikov9 years ago | 3435 | * An instance of [ListView.DataSource](docs/listviewdatasource.html) to use |
d24fea86Joshua Skelton10 years ago | 3436 | */ |
1f817868Vladimir Kotikov9 years ago | 3437 | dataSource: ListViewDataSource |
d24fea86Joshua Skelton10 years ago | 3438 | |
| 3439 | /** | |
1f817868Vladimir Kotikov9 years ago | 3440 | * Flag indicating whether empty section headers should be rendered. |
| 3441 | * In the future release empty section headers will be rendered by | |
| 3442 | * default, and the flag will be deprecated. If empty sections are not | |
| 3443 | * desired to be rendered their indices should be excluded from | |
| 3444 | * sectionID object. | |
d24fea86Joshua Skelton10 years ago | 3445 | */ |
1f817868Vladimir Kotikov9 years ago | 3446 | enableEmptySections?: boolean |
d24fea86Joshua Skelton10 years ago | 3447 | |
| 3448 | /** | |
1f817868Vladimir Kotikov9 years ago | 3449 | * How many rows to render on initial component mount. Use this to make |
| 3450 | * it so that the first screen worth of data apears at one time instead of | |
| 3451 | * over the course of multiple frames. | |
d24fea86Joshua Skelton10 years ago | 3452 | */ |
1f817868Vladimir Kotikov9 years ago | 3453 | initialListSize?: number |
d24fea86Joshua Skelton10 years ago | 3454 | |
| 3455 | /** | |
1f817868Vladimir Kotikov9 years ago | 3456 | * (visibleRows, changedRows) => void |
| 3457 | * | |
| 3458 | * Called when the set of visible rows changes. `visibleRows` maps | |
| 3459 | * { sectionID: { rowID: true }} for all the visible rows, and | |
| 3460 | * `changedRows` maps { sectionID: { rowID: true | false }} for the rows | |
| 3461 | * that have changed their visibility, with true indicating visible, and | |
| 3462 | * false indicating the view has moved out of view. | |
d24fea86Joshua Skelton10 years ago | 3463 | */ |
1f817868Vladimir Kotikov9 years ago | 3464 | onChangeVisibleRows?: ( visibleRows: Array<{[sectionId: string]: {[rowID: string]: boolean}}>, changedRows: Array<{[sectionId: string]: {[rowID: string]: boolean}}> ) => void |
d24fea86Joshua Skelton10 years ago | 3465 | |
| 3466 | /** | |
1f817868Vladimir Kotikov9 years ago | 3467 | * Called when all rows have been rendered and the list has been scrolled |
| 3468 | * to within onEndReachedThreshold of the bottom. The native scroll | |
| 3469 | * event is provided. | |
d24fea86Joshua Skelton10 years ago | 3470 | */ |
1f817868Vladimir Kotikov9 years ago | 3471 | onEndReached?: () => void |
d24fea86Joshua Skelton10 years ago | 3472 | |
| 3473 | /** | |
1f817868Vladimir Kotikov9 years ago | 3474 | * Threshold in pixels for onEndReached. |
d24fea86Joshua Skelton10 years ago | 3475 | */ |
1f817868Vladimir Kotikov9 years ago | 3476 | onEndReachedThreshold?: number |
d24fea86Joshua Skelton10 years ago | 3477 | |
| 3478 | /** | |
1f817868Vladimir Kotikov9 years ago | 3479 | * Number of rows to render per event loop. |
d24fea86Joshua Skelton10 years ago | 3480 | */ |
1f817868Vladimir Kotikov9 years ago | 3481 | pageSize?: number |
d24fea86Joshua Skelton10 years ago | 3482 | |
| 3483 | /** | |
1f817868Vladimir Kotikov9 years ago | 3484 | * A performance optimization for improving scroll perf of |
| 3485 | * large lists, used in conjunction with overflow: 'hidden' on the row | |
| 3486 | * containers. Use at your own risk. | |
d24fea86Joshua Skelton10 years ago | 3487 | */ |
1f817868Vladimir Kotikov9 years ago | 3488 | removeClippedSubviews?: boolean |
d24fea86Joshua Skelton10 years ago | 3489 | |
| 3490 | /** | |
1f817868Vladimir Kotikov9 years ago | 3491 | * () => renderable |
| 3492 | * | |
| 3493 | * The header and footer are always rendered (if these props are provided) | |
| 3494 | * on every render pass. If they are expensive to re-render, wrap them | |
| 3495 | * in StaticContainer or other mechanism as appropriate. Footer is always | |
| 3496 | * at the bottom of the list, and header at the top, on every render pass. | |
d24fea86Joshua Skelton10 years ago | 3497 | */ |
1f817868Vladimir Kotikov9 years ago | 3498 | renderFooter?: () => React.ReactElement<any> |
d24fea86Joshua Skelton10 years ago | 3499 | |
| 3500 | /** | |
1f817868Vladimir Kotikov9 years ago | 3501 | * () => renderable |
| 3502 | * | |
| 3503 | * The header and footer are always rendered (if these props are provided) | |
| 3504 | * on every render pass. If they are expensive to re-render, wrap them | |
| 3505 | * in StaticContainer or other mechanism as appropriate. Footer is always | |
| 3506 | * at the bottom of the list, and header at the top, on every render pass. | |
d24fea86Joshua Skelton10 years ago | 3507 | */ |
1f817868Vladimir Kotikov9 years ago | 3508 | renderHeader?: () => React.ReactElement<any> |
d24fea86Joshua Skelton10 years ago | 3509 | |
| 3510 | /** | |
1f817868Vladimir Kotikov9 years ago | 3511 | * (rowData, sectionID, rowID) => renderable |
| 3512 | * Takes a data entry from the data source and its ids and should return | |
| 3513 | * a renderable component to be rendered as the row. By default the data | |
| 3514 | * is exactly what was put into the data source, but it's also possible to | |
| 3515 | * provide custom extractors. | |
d24fea86Joshua Skelton10 years ago | 3516 | */ |
1f817868Vladimir Kotikov9 years ago | 3517 | renderRow: ( rowData: any, sectionID: string | number, rowID: string | number, highlightRow?: boolean ) => React.ReactElement<any> |
| 3518 | | |
d24fea86Joshua Skelton10 years ago | 3519 | |
| 3520 | /** | |
1f817868Vladimir Kotikov9 years ago | 3521 | * A function that returns the scrollable component in which the list rows are rendered. |
| 3522 | * Defaults to returning a ScrollView with the given props. | |
d24fea86Joshua Skelton10 years ago | 3523 | */ |
1f817868Vladimir Kotikov9 years ago | 3524 | renderScrollComponent?: ( props: ScrollViewProperties ) => React.ReactElement<ScrollViewProperties> |
d24fea86Joshua Skelton10 years ago | 3525 | |
| 3526 | /** | |
1f817868Vladimir Kotikov9 years ago | 3527 | * (sectionData, sectionID) => renderable |
| 3528 | * | |
| 3529 | * If provided, a sticky header is rendered for this section. The sticky | |
| 3530 | * behavior means that it will scroll with the content at the top of the | |
| 3531 | * section until it reaches the top of the screen, at which point it will | |
| 3532 | * stick to the top until it is pushed off the screen by the next section | |
| 3533 | * header. | |
d24fea86Joshua Skelton10 years ago | 3534 | */ |
1f817868Vladimir Kotikov9 years ago | 3535 | renderSectionHeader?: ( sectionData: any, sectionId: string | number ) => React.ReactElement<any> |
| 3536 | | |
d24fea86Joshua Skelton10 years ago | 3537 | |
| 3538 | /** | |
1f817868Vladimir Kotikov9 years ago | 3539 | * (sectionID, rowID, adjacentRowHighlighted) => renderable |
| 3540 | * If provided, a renderable component to be rendered as the separator below each row | |
| 3541 | * but not the last row if there is a section header below. | |
| 3542 | * Take a sectionID and rowID of the row above and whether its adjacent row is highlighted. | |
d24fea86Joshua Skelton10 years ago | 3543 | */ |
1f817868Vladimir Kotikov9 years ago | 3544 | renderSeparator?: ( sectionID: string | number, rowID: string | number, adjacentRowHighlighted?: boolean ) => React.ReactElement<any> |
d24fea86Joshua Skelton10 years ago | 3545 | |
| 3546 | /** | |
1f817868Vladimir Kotikov9 years ago | 3547 | * How early to start rendering rows before they come on screen, in |
| 3548 | * pixels. | |
d24fea86Joshua Skelton10 years ago | 3549 | */ |
1f817868Vladimir Kotikov9 years ago | 3550 | scrollRenderAheadDistance?: number |
d24fea86Joshua Skelton10 years ago | 3551 | |
| 3552 | /** | |
| 3553 | * An array of child indices determining which children get docked to the | |
1f817868Vladimir Kotikov9 years ago | 3554 | * top of the screen when scrolling. For example, passing |
d24fea86Joshua Skelton10 years ago | 3555 | * `stickyHeaderIndices={[0]}` will cause the first child to be fixed to the |
| 3556 | * top of the scroll view. This property is not supported in conjunction | |
| 3557 | * with `horizontal={true}`. | |
1f817868Vladimir Kotikov9 years ago | 3558 | * @platform ios |
d24fea86Joshua Skelton10 years ago | 3559 | */ |
| 3560 | stickyHeaderIndices?: number[] | |
| 3561 | | |
1f817868Vladimir Kotikov9 years ago | 3562 | ref?: Ref<ListViewStatic & ScrollViewStatic & ViewStatic> |
| 3563 | } | |
| 3564 | | |
| 3565 | | |
| 3566 | interface TimerMixin { | |
| 3567 | setTimeout: typeof setTimeout, | |
| 3568 | clearTimeout: typeof clearTimeout, | |
| 3569 | setInterval: typeof setInterval, | |
| 3570 | clearInterval: typeof clearInterval, | |
| 3571 | setImmediate: typeof setImmediate, | |
| 3572 | clearImmediate: typeof clearImmediate, | |
| 3573 | requestAnimationFrame: typeof requestAnimationFrame, | |
| 3574 | cancelAnimationFrame: typeof cancelAnimationFrame, | |
d24fea86Joshua Skelton10 years ago | 3575 | } |
| 3576 | | |
1f817868Vladimir Kotikov9 years ago | 3577 | export interface ListViewStatic extends ScrollResponderMixin, TimerMixin, React.ComponentClass<ListViewProperties> { |
| 3578 | DataSource: ListViewDataSource; | |
d24fea86Joshua Skelton10 years ago | 3579 | |
| 3580 | /** | |
1f817868Vladimir Kotikov9 years ago | 3581 | * Exports some data, e.g. for perf investigations or analytics. |
d24fea86Joshua Skelton10 years ago | 3582 | */ |
1f817868Vladimir Kotikov9 years ago | 3583 | getMetrics: () => { |
| 3584 | contentLength: number, | |
| 3585 | totalRows: number, | |
| 3586 | renderedRows: number, | |
| 3587 | visibleRows: number, | |
| 3588 | } | |
d24fea86Joshua Skelton10 years ago | 3589 | |
| 3590 | /** | |
1f817868Vladimir Kotikov9 years ago | 3591 | * Provides a handle to the underlying scroll responder. |
d24fea86Joshua Skelton10 years ago | 3592 | */ |
1f817868Vladimir Kotikov9 years ago | 3593 | getScrollResponder: () => any, |
d24fea86Joshua Skelton10 years ago | 3594 | |
| 3595 | /** | |
1f817868Vladimir Kotikov9 years ago | 3596 | * Scrolls to a given x, y offset, either immediately or with a smooth animation. |
| 3597 | * | |
| 3598 | * See `ScrollView#scrollTo`. | |
| 3599 | */ | |
| 3600 | scrollTo: ( y?: number | { x?: number, y?: number, animated?: boolean } , x?: number, animated?: boolean ) => void, | |
| 3601 | } | |
| 3602 | | |
| 3603 | export interface MapViewAnnotation { | |
| 3604 | latitude: number | |
| 3605 | longitude: number | |
| 3606 | animateDrop?: boolean | |
| 3607 | draggable?: boolean | |
| 3608 | onDragStateChange?: () => any, | |
| 3609 | onFocus?: () => any, | |
| 3610 | onBlur?: () => any, | |
| 3611 | title?: string | |
| 3612 | subtitle?: string | |
| 3613 | leftCalloutView?: ReactElement<any> | |
| 3614 | rightCalloutView?: ReactElement<any> | |
| 3615 | detailCalloutView?: ReactElement<any> | |
| 3616 | tintColor?: string | |
| 3617 | image?: ImageURISource | |
| 3618 | view?: ReactElement<any> | |
| 3619 | hasLeftCallout?: boolean | |
| 3620 | hasRightCallout?: boolean | |
| 3621 | onLeftCalloutPress?: () => void | |
| 3622 | onRightCalloutPress?: () => void | |
| 3623 | id?: string | |
| 3624 | } | |
| 3625 | | |
| 3626 | export interface MapViewRegion { | |
| 3627 | latitude: number | |
| 3628 | longitude: number | |
| 3629 | latitudeDelta?: number | |
| 3630 | longitudeDelta?: number | |
| 3631 | } | |
| 3632 | | |
| 3633 | export interface MapViewOverlay { | |
| 3634 | coordinates: ({latitude: number, longitude: number})[] | |
| 3635 | lineWidth?: number | |
| 3636 | strokeColor?: string | |
| 3637 | fillColor?: string | |
| 3638 | id?: string | |
| 3639 | } | |
| 3640 | | |
| 3641 | export interface MapViewProperties extends ViewProperties, React.Props<MapViewStatic> { | |
| 3642 | | |
| 3643 | | |
| 3644 | /** | |
| 3645 | * If false points of interest won't be displayed on the map. | |
| 3646 | * Default value is true. | |
| 3647 | */ | |
| 3648 | showsPointsOfInterest?: boolean | |
| 3649 | | |
| 3650 | /** | |
| 3651 | * If true the map will follow the user's location whenever it changes. | |
| 3652 | * Note that this has no effect unless showsUserLocation is enabled. | |
| 3653 | * Default value is true. | |
| 3654 | */ | |
| 3655 | followUserLocation?: boolean | |
| 3656 | | |
| 3657 | /** | |
| 3658 | * Map overlays | |
| 3659 | */ | |
| 3660 | overlays?: MapViewOverlay[] | |
| 3661 | | |
| 3662 | /** | |
| 3663 | * If false compass won't be displayed on the map. | |
| 3664 | * Default value is true. | |
| 3665 | */ | |
| 3666 | showsCompass?: boolean | |
| 3667 | | |
| 3668 | /** | |
| 3669 | * Map annotations with title/subtitle. | |
| 3670 | */ | |
| 3671 | annotations?: MapViewAnnotation[] | |
| 3672 | | |
| 3673 | /** | |
| 3674 | * Insets for the map's legal label, originally at bottom left of the map. See EdgeInsetsPropType.js for more information. | |
| 3675 | */ | |
| 3676 | legalLabelInsets?: Insets | |
| 3677 | | |
| 3678 | /** | |
| 3679 | * The map type to be displayed. | |
| 3680 | * standard: standard road map (default) | |
| 3681 | * satellite: satellite view | |
| 3682 | * hybrid: satellite view with roads and points of interest overlayed | |
| 3683 | * | |
| 3684 | * enum('standard', 'satellite', 'hybrid') | |
| 3685 | */ | |
| 3686 | mapType?: 'standard' |'satellite' |'hybrid' | |
| 3687 | | |
| 3688 | /** | |
| 3689 | * Maximum size of area that can be displayed. | |
| 3690 | */ | |
| 3691 | maxDelta?: number | |
| 3692 | | |
| 3693 | /** | |
| 3694 | * Minimum size of area that can be displayed. | |
| 3695 | */ | |
| 3696 | minDelta?: number | |
| 3697 | | |
| 3698 | /** | |
| 3699 | * Callback that is called once, when the user taps an annotation. | |
| 3700 | */ | |
| 3701 | onAnnotationPress?: () => void | |
| 3702 | | |
| 3703 | /** | |
| 3704 | * Callback that is called continuously when the user is dragging the map. | |
| 3705 | */ | |
| 3706 | onRegionChange?: ( region: MapViewRegion ) => void | |
| 3707 | | |
| 3708 | /** | |
| 3709 | * Callback that is called once, when the user is done moving the map. | |
| 3710 | */ | |
| 3711 | onRegionChangeComplete?: ( region: MapViewRegion ) => void | |
| 3712 | | |
| 3713 | /** | |
| 3714 | * When this property is set to true and a valid camera is associated with the map, | |
| 3715 | * the camera’s pitch angle is used to tilt the plane of the map. | |
| 3716 | * | |
| 3717 | * When this property is set to false, the camera’s pitch angle is ignored and | |
| 3718 | * the map is always displayed as if the user is looking straight down onto it. | |
| 3719 | */ | |
| 3720 | pitchEnabled?: boolean | |
| 3721 | | |
| 3722 | /** | |
| 3723 | * The region to be displayed by the map. | |
| 3724 | * The region is defined by the center coordinates and the span of coordinates to display. | |
| 3725 | */ | |
| 3726 | region?: MapViewRegion | |
| 3727 | | |
| 3728 | /** | |
| 3729 | * When this property is set to true and a valid camera is associated with the map, | |
| 3730 | * the camera’s heading angle is used to rotate the plane of the map around its center point. | |
| 3731 | * | |
| 3732 | * When this property is set to false, the camera’s heading angle is ignored and the map is always oriented | |
| 3733 | * so that true north is situated at the top of the map view | |
| 3734 | */ | |
| 3735 | rotateEnabled?: boolean | |
| 3736 | | |
| 3737 | /** | |
| 3738 | * If false the user won't be able to change the map region being displayed. | |
| 3739 | * Default value is true. | |
| 3740 | */ | |
| 3741 | scrollEnabled?: boolean | |
| 3742 | | |
| 3743 | /** | |
| 3744 | * If true the app will ask for the user's location and focus on it. | |
| 3745 | * Default value is false. | |
| 3746 | * | |
| 3747 | * NOTE: You need to add NSLocationWhenInUseUsageDescription key in Info.plist to enable geolocation, | |
| 3748 | * otherwise it is going to fail silently! | |
| 3749 | */ | |
| 3750 | showsUserLocation?: boolean | |
| 3751 | | |
| 3752 | /** | |
| 3753 | * If false the user won't be able to pinch/zoom the map. | |
| 3754 | * Default value is true. | |
| 3755 | */ | |
| 3756 | zoomEnabled?: boolean | |
| 3757 | | |
| 3758 | ref?: Ref<MapViewStatic & ViewStatic> | |
| 3759 | } | |
| 3760 | | |
| 3761 | /** | |
| 3762 | * @see https://facebook.github.io/react-native/docs/mapview.html#content | |
| 3763 | */ | |
| 3764 | export interface MapViewStatic extends React.NativeMethodsMixin, React.ComponentClass<MapViewProperties> { | |
| 3765 | PinColors: { | |
| 3766 | RED: string, | |
| 3767 | GREEN: string, | |
| 3768 | PURPLE: string | |
| 3769 | } | |
| 3770 | } | |
| 3771 | | |
| 3772 | export interface ModalProperties extends React.Props<ModalStatic> { | |
| 3773 | | |
| 3774 | // Only `animated` is documented. The JS code says `animated` is | |
| 3775 | // deprecated and `animationType` is preferred. | |
| 3776 | animated?: boolean | |
| 3777 | /** | |
| 3778 | * The `animationType` prop controls how the modal animates. | |
| 3779 | * | |
| 3780 | * - `slide` slides in from the bottom | |
| 3781 | * - `fade` fades into view | |
| 3782 | * - `none` appears without an animation | |
| 3783 | */ | |
| 3784 | animationType?: "none" | "slide" | "fade" | |
| 3785 | /** | |
| 3786 | * The `transparent` prop determines whether your modal will fill the entire view. | |
| 3787 | * Setting this to `true` will render the modal over a transparent background. | |
| 3788 | */ | |
| 3789 | transparent?: boolean | |
| 3790 | /** | |
| 3791 | * The `visible` prop determines whether your modal is visible. | |
| 3792 | */ | |
| 3793 | visible?: boolean | |
| 3794 | /** | |
| 3795 | * The `onRequestClose` prop allows passing a function that will be called once the modal has been dismissed. | |
| 3796 | * _On the Android platform, this is a required function._ | |
| 3797 | */ | |
| 3798 | onRequestClose?: () => void | |
| 3799 | /** | |
| 3800 | * The `onShow` prop allows passing a function that will be called once the modal has been shown. | |
| 3801 | */ | |
| 3802 | onShow?: (event: NativeSyntheticEvent<any>) => void | |
| 3803 | /** | |
| 3804 | * The `supportedOrientations` prop allows the modal to be rotated to any of the specified orientations. | |
| 3805 | * On iOS, the modal is still restricted by what's specified in your app's Info.plist's UISupportedInterfaceOrientations field. | |
| 3806 | * @platform ios | |
| 3807 | */ | |
| 3808 | supportedOrientations: ('portrait' | 'portrait-upside-down' | 'landscape' | 'landscape-left' | 'landscape-right')[] | |
| 3809 | /** | |
| 3810 | * The `onOrientationChange` callback is called when the orientation changes while the modal is being displayed. | |
| 3811 | * The orientation provided is only 'portrait' or 'landscape'. This callback is also called on initial render, regardless of the current orientation. | |
| 3812 | * @platform ios | |
| 3813 | */ | |
| 3814 | onOrientationChange: () => void, | |
| 3815 | } | |
| 3816 | | |
| 3817 | export interface ModalStatic extends React.ComponentClass<ModalProperties> { | |
| 3818 | } | |
| 3819 | | |
| 3820 | /** | |
| 3821 | * @see https://github.com/facebook/react-native/blob/0.34-stable\Libraries\Components\Touchable\Touchable.js | |
| 3822 | */ | |
| 3823 | interface TouchableMixin { | |
| 3824 | | |
| 3825 | /** | |
| 3826 | * Invoked when the item should be highlighted. Mixers should implement this | |
| 3827 | * to visually distinguish the `VisualRect` so that the user knows that | |
| 3828 | * releasing a touch will result in a "selection" (analog to click). | |
| 3829 | */ | |
| 3830 | touchableHandleActivePressIn(e: Event): void | |
| 3831 | | |
| 3832 | /** | |
| 3833 | * Invoked when the item is "active" (in that it is still eligible to become | |
| 3834 | * a "select") but the touch has left the `PressRect`. Usually the mixer will | |
| 3835 | * want to unhighlight the `VisualRect`. If the user (while pressing) moves | |
| 3836 | * back into the `PressRect` `touchableHandleActivePressIn` will be invoked | |
| 3837 | * again and the mixer should probably highlight the `VisualRect` again. This | |
| 3838 | * event will not fire on an `touchEnd/mouseUp` event, only move events while | |
| 3839 | * the user is depressing the mouse/touch. | |
| 3840 | */ | |
| 3841 | touchableHandleActivePressOut(e: Event): void | |
| 3842 | | |
| 3843 | /** | |
| 3844 | * Invoked when the item is "selected" - meaning the interaction ended by | |
| 3845 | * letting up while the item was either in the state | |
| 3846 | * `RESPONDER_ACTIVE_PRESS_IN` or `RESPONDER_INACTIVE_PRESS_IN`. | |
| 3847 | */ | |
| 3848 | touchableHandlePress(e: Event): void | |
| 3849 | | |
| 3850 | /** | |
| 3851 | * Invoked when the item is long pressed - meaning the interaction ended by | |
| 3852 | * letting up while the item was in `RESPONDER_ACTIVE_LONG_PRESS_IN`. If | |
| 3853 | * `touchableHandleLongPress` is *not* provided, `touchableHandlePress` will | |
| 3854 | * be called as it normally is. If `touchableHandleLongPress` is provided, by | |
| 3855 | * default any `touchableHandlePress` callback will not be invoked. To | |
| 3856 | * override this default behavior, override `touchableLongPressCancelsPress` | |
| 3857 | * to return false. As a result, `touchableHandlePress` will be called when | |
| 3858 | * lifting up, even if `touchableHandleLongPress` has also been called. | |
| 3859 | */ | |
| 3860 | touchableHandleLongPress(e: Event): void | |
| 3861 | | |
| 3862 | /** | |
| 3863 | * Returns the amount to extend the `HitRect` into the `PressRect`. Positive | |
| 3864 | * numbers mean the size expands outwards. | |
| 3865 | */ | |
| 3866 | touchableGetPressRectOffset(): Insets | |
| 3867 | | |
| 3868 | /** | |
| 3869 | * Returns the number of millis to wait before triggering a highlight. | |
| 3870 | */ | |
| 3871 | touchableGetHighlightDelayMS(): number | |
| 3872 | | |
| 3873 | // These methods are undocumented but still being used by TouchableMixin internals | |
| 3874 | touchableGetLongPressDelayMS(): number | |
| 3875 | touchableGetPressOutDelayMS(): number | |
2060f3fbVladimir Kotikov9 years ago | 3876 | touchableGetHitSlop(): Insets |
1f817868Vladimir Kotikov9 years ago | 3877 | } |
| 3878 | | |
| 3879 | export interface TouchableWithoutFeedbackAndroidProperties { | |
| 3880 | | |
| 3881 | /** | |
| 3882 | * Indicates to accessibility services to treat UI component like a native one. | |
| 3883 | * Works for Android only. | |
| 3884 | * | |
| 3885 | * @enum('none', 'button', 'radiobutton_checked', 'radiobutton_unchecked' ) | |
| 3886 | */ | |
| 3887 | accessibilityComponentType?: 'none' | 'button' | 'radiobutton_checked' | 'radiobutton_unchecked' | |
| 3888 | } | |
| 3889 | | |
| 3890 | type ViewAccessibilityTraits = 'none' | 'button' | 'link' | 'header' | 'search' | 'image' | 'selected' | 'plays' | 'key' | 'text' | 'summary' | 'disabled' | 'frequentUpdates' | 'startsMedia' | 'adjustable' | 'allowsDirectInteraction' | 'pageTurn' | |
| 3891 | | |
| 3892 | export interface TouchableWithoutFeedbackIOSProperties { | |
| 3893 | | |
| 3894 | /** | |
| 3895 | * Provides additional traits to screen reader. | |
| 3896 | * By default no traits are provided unless specified otherwise in element | |
| 3897 | * | |
| 3898 | * @enum('none', 'button', 'link', 'header', 'search', 'image', 'selected', 'plays', 'key', 'text','summary', 'disabled', 'frequentUpdates', 'startsMedia', 'adjustable', 'allowsDirectInteraction', 'pageTurn') | |
| 3899 | */ | |
| 3900 | accessibilityTraits?: ViewAccessibilityTraits | ViewAccessibilityTraits[] | |
| 3901 | | |
| 3902 | } | |
| 3903 | | |
| 3904 | /** | |
| 3905 | * @see https://facebook.github.io/react-native/docs/touchablewithoutfeedback.html#props | |
| 3906 | */ | |
| 3907 | export interface TouchableWithoutFeedbackProperties extends TouchableWithoutFeedbackAndroidProperties, TouchableWithoutFeedbackIOSProperties { | |
| 3908 | | |
| 3909 | | |
| 3910 | /** | |
| 3911 | * Called when the touch is released, but not if cancelled (e.g. by a scroll that steals the responder lock). | |
| 3912 | */ | |
| 3913 | accessible?: boolean | |
| 3914 | | |
| 3915 | /** | |
| 3916 | * Delay in ms, from onPressIn, before onLongPress is called. | |
| 3917 | */ | |
| 3918 | delayLongPress?: number; | |
| 3919 | | |
| 3920 | /** | |
| 3921 | * Delay in ms, from the start of the touch, before onPressIn is called. | |
| 3922 | */ | |
| 3923 | delayPressIn?: number; | |
| 3924 | | |
| 3925 | /** | |
| 3926 | * Delay in ms, from the release of the touch, before onPressOut is called. | |
| 3927 | */ | |
| 3928 | delayPressOut?: number; | |
| 3929 | | |
| 3930 | /** | |
| 3931 | * If true, disable all interactions for this component. | |
| 3932 | */ | |
| 3933 | disabled?: boolean | |
| 3934 | | |
| 3935 | /** | |
| 3936 | * This defines how far your touch can start away from the button. | |
| 3937 | * This is added to pressRetentionOffset when moving off of the button. | |
| 3938 | * NOTE The touch area never extends past the parent view bounds and | |
| 3939 | * the Z-index of sibling views always takes precedence if a touch hits | |
| 3940 | * two overlapping views. | |
| 3941 | */ | |
| 3942 | hitSlop?: Insets | |
| 3943 | | |
| 3944 | /** | |
| 3945 | * Invoked on mount and layout changes with | |
| 3946 | * {nativeEvent: {layout: {x, y, width, height}}} | |
| 3947 | */ | |
| 3948 | onLayout?: ( event: LayoutChangeEvent ) => void | |
| 3949 | | |
| 3950 | onLongPress?: () => void; | |
| 3951 | | |
| 3952 | /** | |
| 3953 | * Called when the touch is released, | |
| 3954 | * but not if cancelled (e.g. by a scroll that steals the responder lock). | |
| 3955 | */ | |
| 3956 | onPress?: () => void; | |
| 3957 | | |
| 3958 | onPressIn?: () => void; | |
| 3959 | | |
| 3960 | onPressOut?: () => void; | |
| 3961 | | |
| 3962 | /** | |
| 3963 | * //FIXME: not in doc but available in examples | |
| 3964 | */ | |
| 3965 | style?: ViewStyle | |
| 3966 | | |
| 3967 | /** | |
| 3968 | * When the scroll view is disabled, this defines how far your | |
| 3969 | * touch may move off of the button, before deactivating the button. | |
| 3970 | * Once deactivated, try moving it back and you'll see that the button | |
| 3971 | * is once again reactivated! Move it back and forth several times | |
| 3972 | * while the scroll view is disabled. Ensure you pass in a constant | |
| 3973 | * to reduce memory allocations. | |
| 3974 | */ | |
| 3975 | pressRetentionOffset?: Insets | |
| 3976 | } | |
| 3977 | | |
| 3978 | | |
| 3979 | export interface TouchableWithoutFeedbackProps extends TouchableWithoutFeedbackProperties, React.Props<TouchableWithoutFeedbackStatic> {} | |
| 3980 | | |
| 3981 | /** | |
| 3982 | * Do not use unless you have a very good reason. | |
| 3983 | * All the elements that respond to press should have a visual feedback when touched. | |
| 3984 | * This is one of the primary reason a "web" app doesn't feel "native". | |
| 3985 | * | |
| 3986 | * @see https://facebook.github.io/react-native/docs/touchablewithoutfeedback.html | |
| 3987 | */ | |
| 3988 | export interface TouchableWithoutFeedbackStatic extends TimerMixin, TouchableMixin, React.ClassicComponentClass<TouchableWithoutFeedbackProps> {} | |
| 3989 | | |
| 3990 | | |
| 3991 | /** | |
| 3992 | * @see https://facebook.github.io/react-native/docs/touchablehighlight.html#props | |
| 3993 | */ | |
| 3994 | export interface TouchableHighlightProperties extends TouchableWithoutFeedbackProperties, React.Props<TouchableHighlightStatic> { | |
| 3995 | | |
| 3996 | /** | |
| 3997 | * Determines what the opacity of the wrapped view should be when touch is active. | |
| 3998 | */ | |
| 3999 | activeOpacity?: number | |
| 4000 | | |
| 4001 | /** | |
| 4002 | * | |
| 4003 | * Called immediately after the underlay is hidden | |
| 4004 | */ | |
| 4005 | onHideUnderlay?: () => void | |
| 4006 | | |
| 4007 | /** | |
| 4008 | * Called immediately after the underlay is shown | |
| 4009 | */ | |
| 4010 | onShowUnderlay?: () => void | |
| 4011 | | |
| 4012 | /** | |
| 4013 | * @see https://facebook.github.io/react-native/docs/view.html#style | |
| 4014 | */ | |
| 4015 | style?: ViewStyle | |
| 4016 | | |
| 4017 | /** | |
| 4018 | * The color of the underlay that will show through when the touch is active. | |
| 4019 | */ | |
| 4020 | underlayColor?: string | |
| 4021 | } | |
| 4022 | | |
| 4023 | /** | |
| 4024 | * A wrapper for making views respond properly to touches. | |
| 4025 | * On press down, the opacity of the wrapped view is decreased, | |
| 4026 | * which allows the underlay color to show through, darkening or tinting the view. | |
| 4027 | * The underlay comes from adding a view to the view hierarchy, | |
| 4028 | * which can sometimes cause unwanted visual artifacts if not used correctly, | |
| 4029 | * for example if the backgroundColor of the wrapped view isn't explicitly set to an opaque color. | |
| 4030 | * | |
| 4031 | * NOTE: TouchableHighlight supports only one child | |
| 4032 | * If you wish to have several child components, wrap them in a View. | |
| 4033 | * | |
| 4034 | * @see https://facebook.github.io/react-native/docs/touchablehighlight.html | |
| 4035 | */ | |
| 4036 | export interface TouchableHighlightStatic extends NativeMethodsMixin, TimerMixin, TouchableMixin, React.ClassicComponentClass<TouchableHighlightProperties> {} | |
| 4037 | | |
| 4038 | | |
| 4039 | /** | |
| 4040 | * @see https://facebook.github.io/react-native/docs/touchableopacity.html#props | |
| 4041 | */ | |
| 4042 | export interface TouchableOpacityProperties extends TouchableWithoutFeedbackProperties, React.Props<TouchableOpacityStatic> { | |
| 4043 | /** | |
| 4044 | * Determines what the opacity of the wrapped view should be when touch is active. | |
| 4045 | * Defaults to 0.2 | |
| 4046 | */ | |
| 4047 | activeOpacity?: number | |
| 4048 | } | |
| 4049 | | |
| 4050 | /** | |
| 4051 | * A wrapper for making views respond properly to touches. | |
| 4052 | * On press down, the opacity of the wrapped view is decreased, dimming it. | |
| 4053 | * This is done without actually changing the view hierarchy, | |
| 4054 | * and in general is easy to add to an app without weird side-effects. | |
| 4055 | * | |
| 4056 | * @see https://facebook.github.io/react-native/docs/touchableopacity.html | |
| 4057 | */ | |
| 4058 | export interface TouchableOpacityStatic extends TimerMixin, TouchableMixin, NativeMethodsMixin, React.ClassicComponentClass<TouchableOpacityProperties> { | |
| 4059 | /** | |
| 4060 | * Animate the touchable to a new opacity. | |
| 4061 | */ | |
| 4062 | setOpacityTo: (value: number) => void | |
| 4063 | } | |
| 4064 | | |
| 4065 | interface BaseBackgroundPropType { | |
| 4066 | type: string | |
| 4067 | } | |
| 4068 | | |
| 4069 | interface RippleBackgroundPropType extends BaseBackgroundPropType { | |
| 4070 | type: 'RippleAndroid' | |
| 4071 | color?: number, | |
| 4072 | borderless?: boolean | |
| 4073 | } | |
| 4074 | | |
| 4075 | interface ThemeAttributeBackgroundPropType extends BaseBackgroundPropType { | |
| 4076 | type: 'ThemeAttrAndroid' | |
| 4077 | attribute: string | |
| 4078 | } | |
| 4079 | | |
| 4080 | type BackgroundPropType = RippleBackgroundPropType & ThemeAttributeBackgroundPropType | |
| 4081 | | |
| 4082 | /** | |
| 4083 | * @see https://facebook.github.io/react-native/docs/touchableopacity.html#props | |
| 4084 | */ | |
| 4085 | export interface TouchableNativeFeedbackProperties extends TouchableWithoutFeedbackProperties, React.Props<TouchableNativeFeedbackStatic> { | |
| 4086 | /** | |
| 4087 | * Determines the type of background drawable that's going to be used to display feedback. | |
| 4088 | * It takes an object with type property and extra data depending on the type. | |
| 4089 | * It's recommended to use one of the following static methods to generate that dictionary: | |
| 4090 | * 1) TouchableNativeFeedback.SelectableBackground() - will create object that represents android theme's default background for selectable elements (?android:attr/selectableItemBackground) | |
| 4091 | * 2) TouchableNativeFeedback.SelectableBackgroundBorderless() - will create object that represent android theme's default background for borderless selectable elements (?android:attr/selectableItemBackgroundBorderless). Available on android API level 21+ | |
| 4092 | * 3) TouchableNativeFeedback.Ripple(color, borderless) - will create object that represents ripple drawable with specified color (as a string). If property borderless evaluates to true the ripple will render outside of the view bounds (see native actionbar buttons as an example of that behavior). This background type is available on Android API level 21+ | |
| 4093 | */ | |
| 4094 | background?: BackgroundPropType | |
| 4095 | } | |
| 4096 | | |
| 4097 | /** | |
| 4098 | * A wrapper for making views respond properly to touches (Android only). | |
| 4099 | * On Android this component uses native state drawable to display touch feedback. | |
| 4100 | * At the moment it only supports having a single View instance as a child node, | |
| 4101 | * as it's implemented by replacing that View with another instance of RCTView node with some additional properties set. | |
| 4102 | * | |
| 4103 | * Background drawable of native feedback touchable can be customized with background property. | |
| 4104 | * | |
| 4105 | * @see https://facebook.github.io/react-native/docs/touchablenativefeedback.html#content | |
| 4106 | */ | |
| 4107 | export interface TouchableNativeFeedbackStatic extends TouchableMixin, React.ClassicComponentClass<TouchableNativeFeedbackProperties> { | |
| 4108 | | |
| 4109 | /** | |
| 4110 | * Creates an object that represents android theme's default background for | |
| 4111 | * selectable elements (?android:attr/selectableItemBackground). | |
| 4112 | */ | |
| 4113 | SelectableBackground(): ThemeAttributeBackgroundPropType | |
| 4114 | | |
| 4115 | /** | |
| 4116 | * Creates an object that represent android theme's default background for borderless | |
| 4117 | * selectable elements (?android:attr/selectableItemBackgroundBorderless). | |
| 4118 | * Available on android API level 21+. | |
| 4119 | */ | |
| 4120 | SelectableBackgroundBorderless(): ThemeAttributeBackgroundPropType | |
| 4121 | | |
| 4122 | /** | |
| 4123 | * Creates an object that represents ripple drawable with specified color (as a | |
| 4124 | * string). If property `borderless` evaluates to true the ripple will | |
| 4125 | * render outside of the view bounds (see native actionbar buttons as an | |
| 4126 | * example of that behavior). This background type is available on Android | |
| 4127 | * API level 21+. | |
| 4128 | * | |
| 4129 | * @param color The ripple color | |
| 4130 | * @param borderless If the ripple can render outside it's bounds | |
| 4131 | */ | |
| 4132 | Ripple( color: string, borderless?: boolean ): RippleBackgroundPropType | |
| 4133 | } | |
| 4134 | | |
| 4135 | export interface LeftToRightGesture { | |
| 4136 | // If the gesture can end and restart during one continuous touch | |
| 4137 | isDetachable: boolean; | |
| 4138 | // How far the swipe must drag to start transitioning | |
| 4139 | gestureDetectMovement: number; | |
| 4140 | // Amplitude of release velocity that is considered still | |
| 4141 | notMoving: number; | |
| 4142 | // Fraction of directional move required. | |
| 4143 | directionRatio: number; | |
| 4144 | // Velocity to transition with when the gesture release was "not moving" | |
| 4145 | snapVelocity: number; | |
| 4146 | // Region that can trigger swipe. iOS default is 30px from the left edge | |
| 4147 | edgeHitWidth: number; | |
| 4148 | // Ratio of gesture completion when non-velocity release will cause action | |
| 4149 | stillCompletionRatio: number; | |
| 4150 | fullDistance: any; | |
| 4151 | direction: string; | |
| 4152 | } | |
| 4153 | | |
| 4154 | export interface JumpGesture extends LeftToRightGesture{ | |
| 4155 | overswipe: { | |
| 4156 | frictionConstant: number | |
| 4157 | frictionByDistance: number | |
| 4158 | } | |
| 4159 | } | |
| 4160 | | |
| 4161 | // see /NavigatorSceneConfigs.js | |
| 4162 | export interface BaseSceneConfig { | |
| 4163 | // A list of all gestures that are enabled on this scene | |
| 4164 | gestures?: { | |
| 4165 | pop?: LeftToRightGesture, | |
| 4166 | }, | |
| 4167 | | |
| 4168 | // Rebound spring parameters when transitioning FROM this scene | |
| 4169 | springFriction: number; | |
| 4170 | springTension: number; | |
| 4171 | | |
| 4172 | // Velocity to start at when transitioning without gesture | |
| 4173 | defaultTransitionVelocity: number; | |
| 4174 | | |
| 4175 | // Animation interpolators for horizontal transitioning: | |
| 4176 | animationInterpolators: { | |
| 4177 | into: () => boolean, | |
| 4178 | out: () => boolean | |
| 4179 | }; | |
| 4180 | } | |
| 4181 | | |
| 4182 | export interface JumpSceneConfig extends BaseSceneConfig { | |
| 4183 | gestures: { | |
| 4184 | jumpBack: JumpGesture | |
| 4185 | jumpForward: JumpGesture | |
| 4186 | } | |
| 4187 | } | |
| 4188 | | |
| 4189 | // see /NavigatorSceneConfigs.js | |
| 4190 | export interface SceneConfigs { | |
| 4191 | PushFromRight: BaseSceneConfig; | |
| 4192 | PushFromLeft: BaseSceneConfig; | |
| 4193 | FloatFromRight: BaseSceneConfig; | |
| 4194 | FloatFromLeft: BaseSceneConfig; | |
| 4195 | FloatFromBottom: BaseSceneConfig; | |
| 4196 | FloatFromBottomAndroid: BaseSceneConfig; | |
| 4197 | FadeAndroid: BaseSceneConfig; | |
| 4198 | HorizontalSwipeJump: BaseSceneConfig; | |
| 4199 | HorizontalSwipeJumpFromRight: BaseSceneConfig; | |
| 4200 | VerticalUpSwipeJump: BaseSceneConfig; | |
| 4201 | VerticalDownSwipeJump: BaseSceneConfig; | |
| 4202 | } | |
| 4203 | | |
| 4204 | export interface Route { | |
| 4205 | component?: React.ComponentClass<ViewProperties> | |
| 4206 | id?: string | |
| 4207 | title?: string | |
| 4208 | passProps?: Object; | |
| 4209 | | |
| 4210 | //anything else | |
| 4211 | [key: string]: any | |
| 4212 | | |
| 4213 | //Commonly found properties | |
| 4214 | backButtonTitle?: string | |
| 4215 | content?: string | |
| 4216 | message?: string; | |
| 4217 | index?: number | |
| 4218 | onRightButtonPress?: () => void | |
| 4219 | rightButtonTitle?: string | |
| 4220 | sceneConfig?: BaseSceneConfig | |
| 4221 | wrapperStyle?: any | |
| 4222 | } | |
| 4223 | | |
| 4224 | | |
| 4225 | /** | |
| 4226 | * @see https://facebook.github.io/react-native/docs/navigator.html#content | |
| 4227 | */ | |
| 4228 | export interface NavigatorProperties extends React.Props<Navigator> { | |
| 4229 | /** | |
| 4230 | * Optional function that allows configuration about scene animations and gestures. | |
| 4231 | * Will be invoked with `route` and `routeStack` parameters, where `route` | |
| 4232 | * corresponds to the current scene being rendered by the `Navigator` and | |
| 4233 | * `routeStack` is the set of currently mounted routes that the navigator | |
| 4234 | * could transition to. The function should return a scene configuration object. | |
| 4235 | * @param route | |
| 4236 | * @param routeStack | |
| 4237 | */ | |
| 4238 | configureScene?: ( route: Route, routeStack: Route[] ) => BaseSceneConfig | |
| 4239 | /** | |
| 4240 | * Specify a route to start on. | |
| 4241 | * A route is an object that the navigator will use to identify each scene to render. | |
| 4242 | * initialRoute must be a route in the initialRouteStack if both props are provided. | |
| 4243 | * The initialRoute will default to the last item in the initialRouteStack. | |
| 4244 | */ | |
| 4245 | initialRoute?: Route | |
| 4246 | /** | |
| 4247 | * Provide a set of routes to initially mount. | |
| 4248 | * Required if no initialRoute is provided. | |
| 4249 | * Otherwise, it will default to an array containing only the initialRoute | |
| 4250 | */ | |
| 4251 | initialRouteStack?: Route[] | |
| 4252 | | |
| 4253 | /** | |
| 4254 | * Optionally provide a navigation bar that persists across scene transitions | |
| 4255 | */ | |
| 4256 | navigationBar?: React.ReactElement<NavigatorStatic.NavigationBarProperties> | |
| 4257 | | |
| 4258 | /** | |
| 4259 | * Optionally provide the navigator object from a parent Navigator | |
| 4260 | */ | |
| 4261 | navigator?: Navigator | |
| 4262 | | |
| 4263 | /** | |
| 4264 | * @deprecated Use navigationContext.addListener('willfocus', callback) instead. | |
| 4265 | */ | |
| 4266 | onDidFocus?: Function | |
| 4267 | | |
| 4268 | /** | |
| 4269 | * @deprecated Use navigationContext.addListener('willfocus', callback) instead. | |
| 4270 | */ | |
| 4271 | onWillFocus?: Function | |
| 4272 | | |
| 4273 | /** | |
| 4274 | * Required function which renders the scene for a given route. | |
| 4275 | * Will be invoked with the route and the navigator object | |
| 4276 | * @param route | |
| 4277 | * @param navigator | |
| 4278 | */ | |
| 4279 | renderScene: ( route: Route, navigator: Navigator ) => React.ReactElement<ViewProperties> | |
| 4280 | | |
| 4281 | /** | |
| 4282 | * Styles to apply to the container of each scene | |
| 4283 | */ | |
| 4284 | sceneStyle?: ViewStyle | |
| 4285 | | |
| 4286 | } | |
| 4287 | | |
| 4288 | /** | |
| 4289 | * Class that contains the info and methods for app navigation. | |
| 4290 | */ | |
| 4291 | export interface NavigationContext { | |
| 4292 | parent: NavigationContext; | |
| 4293 | top: NavigationContext; | |
| 4294 | currentRoute: any; | |
| 4295 | appendChild(childContext: NavigationContext): void; | |
| 4296 | addListener(eventType: string, listener: () => void, useCapture?: boolean): NativeEventSubscription; | |
| 4297 | emit(eventType: string, data: any, didEmitCallback?: () => void): void; | |
| 4298 | dispose(): void; | |
| 4299 | } | |
| 4300 | | |
| 4301 | interface InteractionMixin { | |
| 4302 | createInteractionHandle(): number | |
| 4303 | clearInteractionHandle(clearHandle: number): void | |
| 4304 | /** | |
| 4305 | * Schedule work for after all interactions have completed. | |
| 4306 | * | |
| 4307 | * @param {function} callback | |
| 4308 | */ | |
| 4309 | runAfterInteractions(callback: () => any): void | |
| 4310 | } | |
| 4311 | | |
| 4312 | interface SubscribableMixin { | |
| 4313 | /** | |
| 4314 | * Special form of calling `addListener` that *guarantees* that a | |
| 4315 | * subscription *must* be tied to a component instance, and therefore will | |
| 4316 | * be cleaned up when the component is unmounted. It is impossible to create | |
| 4317 | * the subscription and pass it in - this method must be the one to create | |
| 4318 | * the subscription and therefore can guarantee it is retained in a way that | |
| 4319 | * will be cleaned up. | |
| 4320 | * | |
| 4321 | * @param {EventEmitter} eventEmitter emitter to subscribe to. | |
| 4322 | * @param {string} eventType Type of event to listen to. | |
| 4323 | * @param {function} listener Function to invoke when event occurs. | |
| 4324 | * @param {object} context Object to use as listener context. | |
| 4325 | */ | |
| 4326 | addListenerOn( eventEmitter: any, eventType: string, listener: () => any, context: any ): void | |
| 4327 | } | |
| 4328 | | |
| 4329 | /** | |
| 4330 | * Use Navigator to transition between different scenes in your app. | |
| 4331 | * To accomplish this, provide route objects to the navigator to identify each scene, | |
| 4332 | * and also a renderScene function that the navigator can use to render the scene for a given route. | |
| 4333 | * | |
| 4334 | * To change the animation or gesture properties of the scene, provide a configureScene prop to get the config object for a given route. | |
| 4335 | * See Navigator.SceneConfigs for default animations and more info on scene config options. | |
| 4336 | * @see https://facebook.github.io/react-native/docs/navigator.html | |
| 4337 | */ | |
| 4338 | export interface NavigatorStatic extends TimerMixin, InteractionMixin, SubscribableMixin, React.ComponentClass<NavigatorProperties> { | |
| 4339 | SceneConfigs: SceneConfigs; | |
| 4340 | NavigationBar: NavigatorStatic.NavigationBarStatic; | |
| 4341 | BreadcrumbNavigationBar: NavigatorStatic.BreadcrumbNavigationBarStatic; | |
| 4342 | | |
| 4343 | navigationContext: NavigationContext; | |
| 4344 | | |
| 4345 | /** | |
| 4346 | * returns the current list of routes | |
| 4347 | */ | |
| 4348 | getCurrentRoutes(): Route[]; | |
| 4349 | | |
| 4350 | /** | |
| 4351 | * Jump backward without unmounting the current scen | |
| 4352 | */ | |
| 4353 | jumpBack(): void; | |
| 4354 | | |
| 4355 | /** | |
| 4356 | * Jump forward to the next scene in the route stack | |
| 4357 | */ | |
| 4358 | jumpForward(): void; | |
| 4359 | | |
| 4360 | /** | |
| 4361 | * Transition to an existing scene without unmounting | |
| 4362 | */ | |
| 4363 | jumpTo( route: Route ): void; | |
| 4364 | | |
| 4365 | /** | |
| 4366 | * Navigate forward to a new scene, squashing any scenes that you could jumpForward to | |
| 4367 | */ | |
| 4368 | push( route: Route ): void; | |
| 4369 | | |
| 4370 | /** | |
| 4371 | * Transition back and unmount the current scene | |
| 4372 | */ | |
| 4373 | pop(): void; | |
| 4374 | | |
| 4375 | /** | |
| 4376 | * Go back N scenes at once. When N=1, behavior matches `pop()`. | |
| 4377 | * When N is invalid(negative or bigger than current routes count), do nothing. | |
| 4378 | * @param {number} n The number of scenes to pop. Should be an integer. | |
| 4379 | */ | |
| 4380 | popN(n: number): void | |
| 4381 | | |
| 4382 | /** | |
| 4383 | * Replace the current scene with a new route | |
| 4384 | */ | |
| 4385 | replace( route: Route ): void; | |
| 4386 | | |
| 4387 | /** | |
| 4388 | * Replace a scene as specified by an index | |
| 4389 | */ | |
| 4390 | replaceAtIndex( route: Route, index: number ): void; | |
| 4391 | | |
| 4392 | /** | |
| 4393 | * Replace the previous scene | |
| 4394 | */ | |
| 4395 | replacePrevious( route: Route ): void; | |
| 4396 | | |
| 4397 | /** | |
| 4398 | * Reset every scene with an array of routes | |
| 4399 | */ | |
| 4400 | immediatelyResetRouteStack( routes: Route[] ): void; | |
| 4401 | | |
| 4402 | /** | |
| 4403 | * Pop to a particular scene, as specified by its route. All scenes after it will be unmounted | |
| 4404 | */ | |
| 4405 | popToRoute( route: Route ): void; | |
| 4406 | | |
| 4407 | /** | |
| 4408 | * Pop to the first scene in the stack, unmounting every other scene | |
| 4409 | */ | |
| 4410 | popToTop(): void; | |
| 4411 | | |
| 4412 | /** | |
| 4413 | * Replace the previous scene and pop to it. | |
| 4414 | */ | |
| 4415 | replacePreviousAndPop( route: Route ): void; | |
| 4416 | | |
| 4417 | /** | |
| 4418 | * Navigate to a new scene and reset route stack. | |
| 4419 | */ | |
| 4420 | resetTo( route: Route ): void; | |
| 4421 | | |
| 4422 | } | |
| 4423 | | |
| 4424 | namespace NavigatorStatic { | |
| 4425 | | |
| 4426 | export interface NavState { | |
| 4427 | routeStack: Route[] | |
| 4428 | presentedIndex: number | |
| 4429 | } | |
| 4430 | | |
| 4431 | // @see NavigationBarStyle.ios.js | |
| 4432 | export interface NavigationBarStyle { | |
| 4433 | General: { | |
| 4434 | NavBarHeight: number | |
| 4435 | StatusBarHeight: number | |
| 4436 | TotalNavHeight: number | |
| 4437 | }, | |
| 4438 | Interpolators: { | |
| 4439 | // Animating *into* the center stage from the right | |
| 4440 | RightToCenter: () => boolean | |
| 4441 | // Animating out of the center stage, to the left | |
| 4442 | CenterToLeft: () => boolean | |
| 4443 | // Both stages (animating *past* the center stage) | |
| 4444 | RightToLeft: () => boolean | |
| 4445 | }, | |
| 4446 | Stages: { | |
| 4447 | Left: { | |
| 4448 | Title: FlexStyle | |
| 4449 | LeftButton: FlexStyle | |
| 4450 | RightButton: FlexStyle | |
| 4451 | }, | |
| 4452 | Center: { | |
| 4453 | Title: FlexStyle | |
| 4454 | LeftButton: FlexStyle | |
| 4455 | RightButton: FlexStyle | |
| 4456 | }, | |
| 4457 | Right: { | |
| 4458 | Title: FlexStyle | |
| 4459 | LeftButton: FlexStyle | |
| 4460 | RightButton: FlexStyle | |
| 4461 | }, | |
| 4462 | } | |
| 4463 | } | |
| 4464 | | |
| 4465 | export interface NavigationBarRouteMapper { | |
| 4466 | Title: ( route: Route, nav: Navigator, index: number, navState: NavState ) => React.ReactElement<any>; | |
| 4467 | LeftButton: ( route: Route, nav: Navigator, index: number, navState: NavState )=> React.ReactElement<any>; | |
| 4468 | RightButton: ( route: Route, nav: Navigator, index: number, navState: NavState )=> React.ReactElement<any>; | |
| 4469 | } | |
| 4470 | | |
| 4471 | /** | |
| 4472 | * @see NavigatorNavigationBar.js | |
| 4473 | */ | |
| 4474 | export interface NavigationBarProperties extends React.Props<NavigationBarStatic> { | |
| 4475 | navigator?: Navigator | |
| 4476 | routeMapper?: NavigationBarRouteMapper | |
| 4477 | navState?: NavState | |
| 4478 | navigationStyles?: NavigationBarStyle | |
| 4479 | style?: ViewStyle | |
| 4480 | } | |
| 4481 | | |
| 4482 | export interface NavigationBarStatic extends React.ComponentClass<NavigationBarProperties> { | |
| 4483 | Styles: NavigationBarStyle | |
| 4484 | StylesAndroid: NavigationBarStyle; | |
| 4485 | StylesIOS: NavigationBarStyle; | |
| 4486 | | |
| 4487 | /** | |
| 4488 | * Stop transtion, immediately resets the cached state and re-render the | |
| 4489 | * whole view. | |
| 4490 | */ | |
| 4491 | immediatelyRefresh(): void; | |
| 4492 | } | |
| 4493 | | |
| 4494 | export type NavigationBar = NavigationBarStatic | |
| 4495 | export var NavigationBar: NavigationBarStatic | |
| 4496 | | |
| 4497 | | |
| 4498 | export interface BreadcrumbNavigationBarStyle { | |
| 4499 | //TODO &see NavigatorBreadcrumbNavigationBar.js | |
| 4500 | } | |
| 4501 | | |
| 4502 | export interface BreadcrumbNavigationBarRouteMapper { | |
| 4503 | rightContentForRoute: ( route: Route, navigator: Navigator ) => React.ReactElement<any> | |
| 4504 | titleContentForRoute: ( route: Route, navigator: Navigator ) => React.ReactElement<any> | |
| 4505 | iconForRoute: ( route: Route, navigator: Navigator ) => React.ReactElement<any> | |
| 4506 | //in samples... | |
| 4507 | separatorForRoute: ( route: Route, navigator: Navigator ) => React.ReactElement<any> | |
| 4508 | } | |
| 4509 | | |
| 4510 | /** | |
| 4511 | * @see NavigatorNavigationBar.js | |
| 4512 | */ | |
| 4513 | export interface BreadcrumbNavigationBarProperties extends React.Props<BreadcrumbNavigationBarStatic> { | |
| 4514 | navigator?: Navigator | |
| 4515 | routeMapper?: BreadcrumbNavigationBarRouteMapper | |
| 4516 | navState?: NavState | |
| 4517 | style?: ViewStyle | |
| 4518 | } | |
| 4519 | | |
| 4520 | export interface BreadcrumbNavigationBarStatic extends React.ComponentClass<BreadcrumbNavigationBarProperties> { | |
| 4521 | Styles: BreadcrumbNavigationBarStyle | |
| 4522 | | |
| 4523 | immediatelyRefresh(): void | |
| 4524 | } | |
| 4525 | | |
| 4526 | export type BreadcrumbNavigationBar = BreadcrumbNavigationBarStatic | |
| 4527 | var BreadcrumbNavigationBar: BreadcrumbNavigationBarStatic | |
| 4528 | | |
| 4529 | } | |
| 4530 | | |
| 4531 | // @see https://github.com/facebook/react-native/blob/0.34-stable\Libraries\StyleSheet\StyleSheetTypes.js | |
| 4532 | export namespace StyleSheet { | |
| 4533 | | |
| 4534 | type Style = ViewStyle | TextStyle | ImageStyle | |
| 4535 | | |
a8307513Vladimir Kotikov9 years ago | 4536 | interface Styles { |
| 4537 | [style: string]: Style | |
| 4538 | } | |
| 4539 | | |
1f817868Vladimir Kotikov9 years ago | 4540 | /** |
| 4541 | * Creates a StyleSheet style reference from the given object. | |
| 4542 | */ | |
a8307513Vladimir Kotikov9 years ago | 4543 | // Non-generic override is required to provide intellisense |
| 4544 | // for JavaScript and non-generic method invocations | |
| 4545 | export function create( styles: Styles ): any; | |
| 4546 | // This is for backward compatibility with previous | |
| 4547 | // implementation where T could be an arbitrary type | |
1f817868Vladimir Kotikov9 years ago | 4548 | export function create<T>( styles: T ): T; |
a8307513Vladimir Kotikov9 years ago | 4549 | export function create<T extends Styles>( styles: T ): T; |
1f817868Vladimir Kotikov9 years ago | 4550 | |
| 4551 | /** | |
| 4552 | * Flattens an array of style objects, into one aggregated style object. | |
| 4553 | * Alternatively, this method can be used to lookup IDs, returned by | |
| 4554 | * StyleSheet.register. | |
| 4555 | * | |
| 4556 | * > **NOTE**: Exercise caution as abusing this can tax you in terms of | |
| 4557 | * > optimizations. | |
| 4558 | * > | |
| 4559 | * > IDs enable optimizations through the bridge and memory in general. Refering | |
| 4560 | * > to style objects directly will deprive you of these optimizations. | |
| 4561 | * | |
| 4562 | * Example: | |
| 4563 | * ``` | |
| 4564 | * var styles = StyleSheet.create({ | |
| 4565 | * listItem: { | |
| 4566 | * flex: 1, | |
| 4567 | * fontSize: 16, | |
| 4568 | * color: 'white' | |
| 4569 | * }, | |
| 4570 | * selectedListItem: { | |
| 4571 | * color: 'green' | |
| 4572 | * } | |
| 4573 | * }); | |
| 4574 | * | |
| 4575 | * StyleSheet.flatten([styles.listItem, styles.selectedListItem]) | |
| 4576 | * // returns { flex: 1, fontSize: 16, color: 'green' } | |
| 4577 | * ``` | |
| 4578 | * Alternative use: | |
| 4579 | * ``` | |
| 4580 | * StyleSheet.flatten(styles.listItem); | |
| 4581 | * // return { flex: 1, fontSize: 16, color: 'white' } | |
| 4582 | * // Simply styles.listItem would return its ID (number) | |
| 4583 | * ``` | |
| 4584 | * This method internally uses `StyleSheetRegistry.getStyleByID(style)` | |
| 4585 | * to resolve style objects represented by IDs. Thus, an array of style | |
| 4586 | * objects (instances of StyleSheet.create), are individually resolved to, | |
| 4587 | * their respective objects, merged as one and then returned. This also explains | |
| 4588 | * the alternative use. | |
| 4589 | */ | |
2060f3fbVladimir Kotikov9 years ago | 4590 | export function flatten(style?: Style | Style[]): Style |
1f817868Vladimir Kotikov9 years ago | 4591 | |
| 4592 | /** | |
| 4593 | * This is defined as the width of a thin line on the platform. It can be | |
| 4594 | * used as the thickness of a border or division between two elements. | |
| 4595 | * Example: | |
| 4596 | * ``` | |
| 4597 | * { | |
| 4598 | * borderBottomColor: '#bbb', | |
| 4599 | * borderBottomWidth: StyleSheet.hairlineWidth | |
| 4600 | * } | |
| 4601 | * ``` | |
| 4602 | * | |
| 4603 | * This constant will always be a round number of pixels (so a line defined | |
| 4604 | * by it look crisp) and will try to match the standard width of a thin line | |
| 4605 | * on the underlying platform. However, you should not rely on it being a | |
| 4606 | * constant size, because on different platforms and screen densities its | |
| 4607 | * value may be calculated differently. | |
| 4608 | */ | |
| 4609 | export var hairlineWidth: number | |
| 4610 | | |
| 4611 | /** | |
| 4612 | * A very common pattern is to create overlays with position absolute and zero positioning, | |
| 4613 | * so `absoluteFill` can be used for convenience and to reduce duplication of these repeated | |
| 4614 | * styles. | |
| 4615 | */ | |
| 4616 | export var absoluteFill: number | |
| 4617 | | |
| 4618 | /** | |
| 4619 | * Sometimes you may want `absoluteFill` but with a couple tweaks - `absoluteFillObject` can be | |
| 4620 | * used to create a customized entry in a `StyleSheet`, e.g.: | |
| 4621 | * | |
| 4622 | * const styles = StyleSheet.create({ | |
| 4623 | * wrapper: { | |
| 4624 | * ...StyleSheet.absoluteFillObject, | |
| 4625 | * top: 10, | |
| 4626 | * backgroundColor: 'transparent', | |
| 4627 | * }, | |
| 4628 | * }); | |
| 4629 | */ | |
| 4630 | export var absoluteFillObject: { | |
| 4631 | position: string | |
| 4632 | left: number | |
| 4633 | right: number | |
| 4634 | top: number | |
| 4635 | bottom: number | |
| 4636 | } | |
| 4637 | } | |
| 4638 | | |
| 4639 | export type RelayProfiler = { | |
| 4640 | attachProfileHandler( | |
| 4641 | name: string, | |
| 4642 | handler: (name: string, state?: any) => () => void | |
| 4643 | ): void, | |
| 4644 | | |
| 4645 | attachAggregateHandler( | |
| 4646 | name: string, | |
| 4647 | handler: (name: string, callback: () => void) => void | |
| 4648 | ): void, | |
| 4649 | } | |
| 4650 | | |
| 4651 | export interface SystraceStatic { | |
| 4652 | setEnabled(enabled: boolean): void | |
| 4653 | /** | |
| 4654 | * beginEvent/endEvent for starting and then ending a profile within the same call stack frame | |
| 4655 | **/ | |
| 4656 | beginEvent(profileName?: any, args?: any): void | |
| 4657 | endEvent(): void | |
| 4658 | /** | |
| 4659 | * beginAsyncEvent/endAsyncEvent for starting and then ending a profile where the end can either | |
| 4660 | * occur on another thread or out of the current stack frame, eg await | |
| 4661 | * the returned cookie variable should be used as input into the endAsyncEvent call to end the profile | |
| 4662 | **/ | |
| 4663 | beginAsyncEvent(profileName?: any): any | |
| 4664 | endAsyncEvent(profileName?: any, cookie?: any): void | |
| 4665 | /** | |
| 4666 | * counterEvent registers the value to the profileName on the systrace timeline | |
| 4667 | **/ | |
| 4668 | counterEvent(profileName?: any, value?: any): void | |
| 4669 | /** | |
| 4670 | * Relay profiles use await calls, so likely occur out of current stack frame | |
| 4671 | * therefore async variant of profiling is used | |
| 4672 | **/ | |
| 4673 | attachToRelayProfiler(relayProfiler: RelayProfiler): void | |
| 4674 | /* This is not called by default due to perf overhead but it's useful | |
| 4675 | if you want to find traces which spend too much time in JSON. */ | |
| 4676 | swizzleJSON(): void | |
| 4677 | /** | |
| 4678 | * Measures multiple methods of a class. For example, you can do: | |
| 4679 | * Systrace.measureMethods(JSON, 'JSON', ['parse', 'stringify']); | |
| 4680 | * | |
| 4681 | * @param object | |
| 4682 | * @param objectName | |
| 4683 | * @param methodNames Map from method names to method display names. | |
| 4684 | */ | |
| 4685 | measureMethods(object: any, objectName: string, methodNames: Array<string>): void | |
| 4686 | /** | |
| 4687 | * Returns an profiled version of the input function. For example, you can: | |
| 4688 | * JSON.parse = Systrace.measure('JSON', 'parse', JSON.parse); | |
| 4689 | * | |
| 4690 | * @param objName | |
| 4691 | * @param fnName | |
| 4692 | * @param {function} func | |
| 4693 | * @return {function} replacement function | |
| 4694 | */ | |
| 4695 | measure(objName: string, fnName: string, func: Function): Function | |
| 4696 | } | |
| 4697 | | |
| 4698 | /** | |
| 4699 | * //FIXME: Could not find docs. Inferred from examples and jscode : ListViewDataSource.js | |
| 4700 | */ | |
| 4701 | export interface DataSourceAssetCallback { | |
| 4702 | rowHasChanged?: ( r1: any, r2: any ) => boolean | |
| 4703 | sectionHeaderHasChanged?: ( h1: any, h2: any ) => boolean | |
| 4704 | getRowData?: <T>( dataBlob: any, sectionID: number | string, rowID: number | string ) => T | |
| 4705 | getSectionHeaderData?: <T>( dataBlob: any, sectionID: number | string ) => T | |
| 4706 | } | |
| 4707 | | |
| 4708 | /** | |
| 4709 | * Provides efficient data processing and access to the | |
| 4710 | * `ListView` component. A `ListViewDataSource` is created with functions for | |
| 4711 | * extracting data from the input blob, and comparing elements (with default | |
| 4712 | * implementations for convenience). The input blob can be as simple as an | |
| 4713 | * array of strings, or an object with rows nested inside section objects. | |
| 4714 | * | |
| 4715 | * To update the data in the datasource, use `cloneWithRows` (or | |
| 4716 | * `cloneWithRowsAndSections` if you care about sections). The data in the | |
| 4717 | * data source is immutable, so you can't modify it directly. The clone methods | |
| 4718 | * suck in the new data and compute a diff for each row so ListView knows | |
| 4719 | * whether to re-render it or not. | |
| 4720 | * | |
| 4721 | * In this example, a component receives data in chunks, handled by | |
| 4722 | * `_onDataArrived`, which concats the new data onto the old data and updates the | |
| 4723 | * data source. We use `concat` to create a new array - mutating `this._data`, | |
| 4724 | * e.g. with `this._data.push(newRowData)`, would be an error. `_rowHasChanged` | |
| 4725 | * understands the shape of the row data and knows how to efficiently compare | |
| 4726 | * it. | |
| 4727 | * | |
| 4728 | * ``` | |
| 4729 | * getInitialState: function() { | |
| 4730 | * var ds = new ListViewDataSource({rowHasChanged: this._rowHasChanged}); | |
| 4731 | * return {ds}; | |
| 4732 | * }, | |
| 4733 | * _onDataArrived(newData) { | |
| 4734 | * this._data = this._data.concat(newData); | |
| 4735 | * this.setState({ | |
| 4736 | * ds: this.state.ds.cloneWithRows(this._data) | |
| 4737 | * }); | |
| 4738 | * } | |
| 4739 | * ``` | |
| 4740 | */ | |
| 4741 | export interface ListViewDataSource { | |
| 4742 | /** | |
| 4743 | * You can provide custom extraction and `hasChanged` functions for section | |
| 4744 | * headers and rows. If absent, data will be extracted with the | |
| 4745 | * `defaultGetRowData` and `defaultGetSectionHeaderData` functions. | |
| 4746 | * | |
| 4747 | * The default extractor expects data of one of the following forms: | |
| 4748 | * | |
| 4749 | * { sectionID_1: { rowID_1: <rowData1>, ... }, ... } | |
| 4750 | * | |
| 4751 | * or | |
| 4752 | * | |
| 4753 | * { sectionID_1: [ <rowData1>, <rowData2>, ... ], ... } | |
| 4754 | * | |
| 4755 | * or | |
| 4756 | * | |
| 4757 | * [ [ <rowData1>, <rowData2>, ... ], ... ] | |
| 4758 | * | |
| 4759 | * The constructor takes in a params argument that can contain any of the | |
| 4760 | * following: | |
| 4761 | * | |
| 4762 | * - getRowData(dataBlob, sectionID, rowID); | |
| 4763 | * - getSectionHeaderData(dataBlob, sectionID); | |
| 4764 | * - rowHasChanged(prevRowData, nextRowData); | |
| 4765 | * - sectionHeaderHasChanged(prevSectionData, nextSectionData); | |
| 4766 | */ | |
| 4767 | new( onAsset: DataSourceAssetCallback ): ListViewDataSource; | |
| 4768 | | |
| 4769 | /** | |
| 4770 | * Clones this `ListViewDataSource` with the specified `dataBlob` and | |
| 4771 | * `rowIdentities`. The `dataBlob` is just an aribitrary blob of data. At | |
| 4772 | * construction an extractor to get the interesting informatoin was defined | |
| 4773 | * (or the default was used). | |
| 4774 | * | |
| 4775 | * The `rowIdentities` is is a 2D array of identifiers for rows. | |
| 4776 | * ie. [['a1', 'a2'], ['b1', 'b2', 'b3'], ...]. If not provided, it's | |
| 4777 | * assumed that the keys of the section data are the row identities. | |
| 4778 | * | |
| 4779 | * Note: This function does NOT clone the data in this data source. It simply | |
| 4780 | * passes the functions defined at construction to a new data source with | |
| 4781 | * the data specified. If you wish to maintain the existing data you must | |
| 4782 | * handle merging of old and new data separately and then pass that into | |
| 4783 | * this function as the `dataBlob`. | |
| 4784 | */ | |
| 4785 | cloneWithRows<T>( dataBlob: Array<any> | {[key: string ]: any}, rowIdentities?: Array<string | number> ): ListViewDataSource | |
| 4786 | | |
| 4787 | /** | |
| 4788 | * This performs the same function as the `cloneWithRows` function but here | |
| 4789 | * you also specify what your `sectionIdentities` are. If you don't care | |
| 4790 | * about sections you should safely be able to use `cloneWithRows`. | |
| 4791 | * | |
| 4792 | * `sectionIdentities` is an array of identifiers for sections. | |
| 4793 | * ie. ['s1', 's2', ...]. If not provided, it's assumed that the | |
| 4794 | * keys of dataBlob are the section identities. | |
| 4795 | * | |
| 4796 | * Note: this returns a new object! | |
| 4797 | */ | |
| 4798 | cloneWithRowsAndSections( dataBlob: Array<any> | {[key: string]: any}, sectionIdentities?: Array<string | number>, rowIdentities?: Array<Array<string | number>> ): ListViewDataSource | |
| 4799 | | |
| 4800 | getRowCount(): number | |
| 4801 | getRowAndSectionCount(): number | |
| 4802 | | |
| 4803 | /** | |
| 4804 | * Returns if the row is dirtied and needs to be rerendered | |
| 4805 | */ | |
| 4806 | rowShouldUpdate(sectionIndex: number, rowIndex: number): boolean | |
| 4807 | | |
| 4808 | /** | |
| 4809 | * Gets the data required to render the row. | |
| 4810 | */ | |
| 4811 | getRowData( sectionIndex: number, rowIndex: number ): any | |
| 4812 | | |
| 4813 | /** | |
| 4814 | * Gets the rowID at index provided if the dataSource arrays were flattened, | |
| 4815 | * or null of out of range indexes. | |
| 4816 | */ | |
2060f3fbVladimir Kotikov9 years ago | 4817 | getRowIDForFlatIndex( index: number ): string |
1f817868Vladimir Kotikov9 years ago | 4818 | |
| 4819 | /** | |
| 4820 | * Gets the sectionID at index provided if the dataSource arrays were flattened, | |
| 4821 | * or null for out of range indexes. | |
| 4822 | */ | |
2060f3fbVladimir Kotikov9 years ago | 4823 | getSectionIDForFlatIndex( index: number ): string |
1f817868Vladimir Kotikov9 years ago | 4824 | |
| 4825 | /** | |
| 4826 | * Returns an array containing the number of rows in each section | |
| 4827 | */ | |
| 4828 | getSectionLengths(): Array<number> | |
| 4829 | | |
| 4830 | /** | |
| 4831 | * Returns if the section header is dirtied and needs to be rerendered | |
| 4832 | */ | |
| 4833 | sectionHeaderShouldUpdate( sectionIndex: number ): boolean | |
| 4834 | | |
| 4835 | /** | |
| 4836 | * Gets the data required to render the section header | |
| 4837 | */ | |
| 4838 | getSectionHeaderData( sectionIndex: number ): any | |
| 4839 | } | |
| 4840 | | |
| 4841 | /** | |
| 4842 | * @see https://facebook.github.io/react-native/docs/tabbarios-item.html#props | |
| 4843 | */ | |
| 4844 | export interface TabBarItemProperties extends ViewProperties, React.Props<TabBarItemStatic> { | |
| 4845 | | |
| 4846 | /** | |
| 4847 | * Little red bubble that sits at the top right of the icon. | |
| 4848 | */ | |
| 4849 | badge?: string | number | |
| 4850 | | |
| 4851 | /** | |
| 4852 | * A custom icon for the tab. It is ignored when a system icon is defined. | |
| 4853 | */ | |
| 4854 | icon?: ImageURISource | |
| 4855 | | |
| 4856 | /** | |
| 4857 | * Callback when this tab is being selected, | |
| 4858 | * you should change the state of your component to set selected={true}. | |
| 4859 | */ | |
| 4860 | onPress?: () => void | |
| 4861 | | |
| 4862 | /** | |
| 4863 | * If set to true it renders the image as original, | |
| 4864 | * it defaults to being displayed as a template | |
| 4865 | */ | |
| 4866 | renderAsOriginal?: boolean | |
| 4867 | | |
| 4868 | /** | |
| 4869 | * It specifies whether the children are visible or not. If you see a blank content, you probably forgot to add a selected one. | |
| 4870 | */ | |
| 4871 | selected?: boolean | |
| 4872 | | |
| 4873 | /** | |
| 4874 | * A custom icon when the tab is selected. | |
| 4875 | * It is ignored when a system icon is defined. If left empty, the icon will be tinted in blue. | |
| 4876 | */ | |
| 4877 | selectedIcon?: ImageURISource | |
| 4878 | | |
| 4879 | /** | |
| 4880 | * React style object. | |
| 4881 | */ | |
| 4882 | style?: ViewStyle | |
| 4883 | | |
| 4884 | /** | |
| 4885 | * Items comes with a few predefined system icons. | |
| 4886 | * Note that if you are using them, the title and selectedIcon will be overriden with the system ones. | |
| 4887 | * | |
| 4888 | * enum('bookmarks', 'contacts', 'downloads', 'favorites', 'featured', 'history', 'more', 'most-recent', 'most-viewed', 'recents', 'search', 'top-rated') | |
| 4889 | */ | |
| 4890 | systemIcon?: "bookmarks" | "contacts" | "downloads" | "favorites" | "featured" | "history" | "more" | "most-recent" | "most-viewed" | "recents" | "search" | "top-rated" | |
| 4891 | | |
| 4892 | /** | |
| 4893 | * Text that appears under the icon. It is ignored when a system icon is defined. | |
| 4894 | */ | |
| 4895 | title?: string | |
| 4896 | | |
| 4897 | ref?: Ref<TabBarItemStatic & ViewStatic> | |
| 4898 | } | |
| 4899 | | |
| 4900 | export interface TabBarItemStatic extends React.ComponentClass<TabBarItemProperties> { | |
| 4901 | } | |
| 4902 | | |
| 4903 | /** | |
| 4904 | * @see https://facebook.github.io/react-native/docs/tabbarios.html#props | |
| 4905 | */ | |
| 4906 | export interface TabBarIOSProperties extends ViewProperties, React.Props<TabBarIOSStatic> { | |
| 4907 | | |
| 4908 | /** | |
| 4909 | * Background color of the tab bar | |
| 4910 | */ | |
| 4911 | barTintColor?: string | |
| 4912 | | |
| 4913 | /** | |
| 4914 | * Specifies tab bar item positioning. Available values are: | |
| 4915 | * - fill - distributes items across the entire width of the tab bar | |
| 4916 | * - center - centers item in the available tab bar space | |
| 4917 | * - auto (default) - distributes items dynamically according to the | |
| 4918 | * user interface idiom. In a horizontally compact environment (e.g. iPhone 5) | |
| 4919 | * this value defaults to `fill`, in a horizontally regular one (e.g. iPad) | |
| 4920 | * it defaults to center. | |
| 4921 | */ | |
| 4922 | itemPositioning?: 'fill' | 'center' | 'auto' | |
| 4923 | | |
| 4924 | /** | |
| 4925 | * Color of the currently selected tab icon | |
| 4926 | */ | |
| 4927 | tintColor?: string | |
| 4928 | | |
| 4929 | /** | |
| 4930 | * A Boolean value that indicates whether the tab bar is translucent | |
| 4931 | */ | |
| 4932 | translucent?: boolean | |
| 4933 | | |
| 4934 | /** | |
| 4935 | * Color of text on unselected tabs | |
| 4936 | */ | |
| 4937 | unselectedTintColor?: string | |
| 4938 | | |
| 4939 | ref?: Ref<TabBarIOSStatic & ViewStatic> | |
| 4940 | } | |
| 4941 | | |
| 4942 | export interface TabBarIOSStatic extends React.ComponentClass<TabBarIOSProperties> { | |
| 4943 | Item: TabBarItemStatic; | |
| 4944 | } | |
| 4945 | | |
| 4946 | | |
| 4947 | export interface PixelRatioStatic { | |
| 4948 | | |
| 4949 | /* | |
| 4950 | Returns the device pixel density. Some examples: | |
| 4951 | PixelRatio.get() === 1 | |
| 4952 | mdpi Android devices (160 dpi) | |
| 4953 | PixelRatio.get() === 1.5 | |
| 4954 | hdpi Android devices (240 dpi) | |
| 4955 | PixelRatio.get() === 2 | |
| 4956 | iPhone 4, 4S | |
| 4957 | iPhone 5, 5c, 5s | |
| 4958 | iPhone 6 | |
| 4959 | xhdpi Android devices (320 dpi) | |
| 4960 | PixelRatio.get() === 3 | |
| 4961 | iPhone 6 plus | |
| 4962 | xxhdpi Android devices (480 dpi) | |
| 4963 | PixelRatio.get() === 3.5 | |
| 4964 | Nexus 6 | |
| 4965 | */ | |
| 4966 | get(): number; | |
| 4967 | | |
| 4968 | /* | |
| 4969 | Returns the scaling factor for font sizes. This is the ratio that is | |
| 4970 | used to calculate the absolute font size, so any elements that | |
| 4971 | heavily depend on that should use this to do calculations. | |
| 4972 | | |
| 4973 | If a font scale is not set, this returns the device pixel ratio. | |
| 4974 | | |
| 4975 | Currently this is only implemented on Android and reflects the user | |
| 4976 | preference set in Settings > Display > Font size, | |
| 4977 | on iOS it will always return the default pixel ratio. | |
| 4978 | */ | |
| 4979 | getFontScale(): number | |
| 4980 | | |
| 4981 | /** | |
| 4982 | * Converts a layout size (dp) to pixel size (px). | |
| 4983 | * Guaranteed to return an integer number. | |
| 4984 | * @param layoutSize | |
| 4985 | */ | |
| 4986 | getPixelSizeForLayoutSize(layoutSize: number): number | |
| 4987 | | |
| 4988 | /** | |
| 4989 | * Rounds a layout size (dp) to the nearest layout size that | |
| 4990 | * corresponds to an integer number of pixels. For example, | |
| 4991 | * on a device with a PixelRatio of 3, | |
| 4992 | * PixelRatio.roundToNearestPixel(8.4) = 8.33, | |
| 4993 | * which corresponds to exactly (8.33 * 3) = 25 pixels. | |
| 4994 | * @param layoutSize | |
| 4995 | */ | |
| 4996 | roundToNearestPixel(layoutSize: number): number | |
| 4997 | | |
| 4998 | /** | |
| 4999 | * No-op for iOS, but used on the web. Should not be documented. [sic] | |
| 5000 | */ |