microsoft/vscode-react-native

Public

mirrored from https://github.com/microsoft/vscode-react-nativeAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
10bc5320aeda86f9f9aee59bb732e61314aaad7e

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

ReactTypings/react-native/react-native.d.ts

8437lines · modeblame

1f817868Vladimir Kotikov9 years ago1// Type definitions for react-native 0.34
d24fea86Joshua Skelton10 years ago2// Project: https://github.com/facebook/react-native
3// Definitions by: Bruno Grieder <https://github.com/bgrieder>
1f817868Vladimir Kotikov9 years ago4// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
d24fea86Joshua Skelton10 years ago5
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
19import React = __React;
20
21//react-native "extends" react
1f817868Vladimir Kotikov9 years ago22declare namespace __React {
d24fea86Joshua Skelton10 years ago23/**
24* Represents the completion of an asynchronous operation
25* @see lib.es6.d.ts
26*/
27export 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*/
34then<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*/
41catch( onrejected?: ( reason: any ) => T | Promise<T> ): Promise<T>;
42
43
44// not in lib.es6.d.ts but called by react-native
45done( callback?: ( value: T ) => void ): void;
46}
47
48export interface PromiseConstructor {
49/**
50* A reference to the prototype.
51*/
52prototype: 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*/
60new <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*/
70all<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*/
78all( 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*/
86race<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*/
93reject( 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*/
100reject<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*/
107resolve<T>( value: T | Promise<T> ): Promise<T>;
108
109/**
110* Creates a new resolved promise .
111* @returns A resolved promise.
112*/
113resolve(): Promise<void>;
114}
115
116// @see lib.es6.d.ts
117export var Promise: PromiseConstructor;
118
1f817868Vladimir Kotikov9 years ago119export type MeasureOnSuccessCallback = (
120x: number,
121y: number,
122width: number,
123height: number,
124pageX: number,
125pageY: number
126) => void
127
128export type MeasureInWindowOnSuccessCallback = (
129x: number,
130y: number,
131width: number,
132height: number
133) => void
134
135export type MeasureLayoutOnSuccessCallback = (
136left: number,
137top: number,
138width: number,
139height: number
140) => void
141
142/**
143* EventSubscription represents a subscription to a particular event. It can
144* remove its own subscription.
145*/
146interface EventSubscription {
147
148eventType: string;
149key: number;
150subscriber: EventSubscriptionVendor;
151
152/**
153* @param {EventSubscriptionVendor} subscriber the subscriber that controls
154* this subscription.
155*/
156new(subscriber: EventSubscriptionVendor): EventSubscription
157
158/**
159* Removes this subscription from the subscriber that controls it.
160*/
161remove(): void
162}
163
164/**
165* EventSubscriptionVendor stores a set of EventSubscriptions that are
166* subscribed to a particular event type.
167*/
168interface EventSubscriptionVendor {
169
170constructor(): EventSubscriptionVendor
171
172/**
173* Adds a subscription keyed by an event type.
174*
175* @param {string} eventType
176* @param {EventSubscription} subscription
177*/
178addSubscription(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*/
186removeAllSubscriptions(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*/
194removeSubscription(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 ago206getSubscriptionsForType(eventType: string): EventSubscription[]
1f817868Vladimir Kotikov9 years ago207}
208
209/**
210* EmitterSubscription represents a subscription with listener and context data.
211*/
212interface EmitterSubscription extends EventSubscription {
213emitter: EventEmitter
214listener: () => any
215context: 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*/
227new(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*/
235remove(): void
236}
237
238interface 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*/
245new(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*/
258addListener(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*/
270once(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*/
279removeAllListeners(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*/
302removeCurrentListener(): 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*/
308removeSubscription(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*/
317listeners(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*/
333emit(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*/
348removeListener(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*/
360export 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*/
378measure(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*/
395measureInWindow(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*/
405measureLayout(
406relativeToNativeNode: number,
407onSuccess: MeasureLayoutOnSuccessCallback,
408onFail: () => 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*/
417setNativeProps(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*/
423focus(): void;
424
425/**
426* Removes focus from an input or view. This is the opposite of `focus()`.
427*/
428blur(): void;
429
430refs: {
431[key: string]: Component<any, any>
432};
d24fea86Joshua Skelton10 years ago433}
434
435// see react-jsx.d.ts
436export function createElement<P>( type: React.ReactType,
437props?: P,
438...children: React.ReactNode[] ): React.ReactElement<P>;
439
440
441export type Runnable = ( appParameters: any ) => void;
442
443
444// Similar to React.SyntheticEvent except for nativeEvent
445interface NativeSyntheticEvent<T> {
446bubbles: boolean
447cancelable: boolean
448currentTarget: EventTarget
449defaultPrevented: boolean
450eventPhase: number
451isTrusted: boolean
452nativeEvent: T
453preventDefault(): void
454stopPropagation(): void
455target: EventTarget
456timeStamp: Date
457type: string
458}
459
460export interface NativeTouchEvent {
461/**
462* Array of all touch events that have changed since the last event
463*/
464changedTouches: NativeTouchEvent[]
465
466/**
467* The ID of the touch
468*/
469identifier: string
470
471/**
472* The X position of the touch, relative to the element
473*/
474locationX: number
475
476/**
477* The Y position of the touch, relative to the element
478*/
479locationY: number
480
481/**
482* The X position of the touch, relative to the screen
483*/
484pageX: number
485
486/**
487* The Y position of the touch, relative to the screen
488*/
489pageY: number
490
491/**
492* The node id of the element receiving the touch event
493*/
494target: string
495
496/**
497* A time identifier for the touch, useful for velocity calculation
498*/
499timestamp: number
500
501/**
502* Array of all current touches on the screen
503*/
504touches : NativeTouchEvent[]
505}
506
507export interface GestureResponderEvent extends NativeSyntheticEvent<NativeTouchEvent> {
508}
509
510
511export interface PointProperties {
512x: number
513y: number
514}
515
516export interface Insets {
517top?: number
518left?: number
519bottom?: number
520right?: 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*/
527export interface Touchable {
528onTouchStart?: ( event: GestureResponderEvent ) => void
529onTouchMove?: ( event: GestureResponderEvent ) => void
530onTouchEnd?: ( event: GestureResponderEvent ) => void
531onTouchCancel?: ( event: GestureResponderEvent ) => void
532onTouchEndCapture?: ( event: GestureResponderEvent ) => void
533}
534
1f817868Vladimir Kotikov9 years ago535export type ComponentProvider = () => React.ComponentClass<any>
536
d24fea86Joshua Skelton10 years ago537export type AppConfig = {
538appKey: string;
1f817868Vladimir Kotikov9 years ago539component?: ComponentProvider
d24fea86Joshua Skelton10 years ago540run?: Runnable;
541}
542
543// https://github.com/facebook/react-native/blob/master/Libraries/AppRegistry/AppRegistry.js
1f817868Vladimir Kotikov9 years ago544/**
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 ago559export class AppRegistry {
560static registerConfig( config: AppConfig[] ): void;
561
1f817868Vladimir Kotikov9 years ago562static registerComponent( appKey: string, getComponentFunc: ComponentProvider ): string;
d24fea86Joshua Skelton10 years ago563
564static registerRunnable( appKey: string, func: Runnable ): string;
565
1f817868Vladimir Kotikov9 years ago566static getAppKeys(): string[];
567
568static unmountApplicationComponentAtRootTag(rootTag: number): void;
569
d24fea86Joshua Skelton10 years ago570static runApplication( appKey: string, appParameters: any ): void;
571}
572
573export interface LayoutAnimationTypes {
574spring: string
575linear: string
576easeInEaseOut: string
577easeIn: string
578easeOut: string
579}
580
581export interface LayoutAnimationProperties {
582opacity: string
583scaleXY: string
584}
585
586export interface LayoutAnimationAnim {
587duration?: number
588delay?: number
589springDamping?: number
590initialVelocity?: number
591type?: string //LayoutAnimationTypes
592property?: string //LayoutAnimationProperties
593}
594
595export interface LayoutAnimationConfig {
596duration: number
597create?: LayoutAnimationAnim
598update?: LayoutAnimationAnim
599delete?: LayoutAnimationAnim
600}
601
1f817868Vladimir Kotikov9 years ago602/** 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 ago605export interface LayoutAnimationStatic {
1f817868Vladimir Kotikov9 years ago606/** 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*/
613configureNext: (config: LayoutAnimationConfig, onAnimationDidEnd?: () => void) => void
614/** Helper for creating a config for configureNext. */
615create: (duration: number, type?: string, creationProp?: string) => LayoutAnimationConfig
d24fea86Joshua Skelton10 years ago616Types: LayoutAnimationTypes
617Properties: LayoutAnimationProperties
1f817868Vladimir Kotikov9 years ago618configChecker: (shapeTypes: {[key: string]: any}) => any
d24fea86Joshua Skelton10 years ago619Presets : {
620easeInEaseOut: LayoutAnimationConfig
621linear:LayoutAnimationConfig
622spring: LayoutAnimationConfig
623}
1f817868Vladimir Kotikov9 years ago624easeInEaseOut: (config: LayoutAnimationConfig, onAnimationDidEnd?: () => void) => void
625linear: (config: LayoutAnimationConfig, onAnimationDidEnd?: () => void) => void
626spring: (config: LayoutAnimationConfig, onAnimationDidEnd?: () => void) => void
d24fea86Joshua Skelton10 years ago627}
628
1f817868Vladimir Kotikov9 years ago629export type FlexAlignType = "flex-start" | "flex-end" | "center" | "stretch";
630export type FlexJustifyType = "flex-start" | "flex-end" | "center" | "space-between" | "space-around";
631export type FlexDirection = "row" | "column" | "row-reverse" | "column-reverse";
d24fea86Joshua Skelton10 years ago632
633/**
634* Flex Prop Types
635* @see https://facebook.github.io/react-native/docs/flexbox.html#proptypes
636* @see LayoutPropTypes.js
637*/
638export interface FlexStyle {
639
1f817868Vladimir Kotikov9 years ago640alignItems?: FlexAlignType;
641alignSelf?: "auto" | FlexAlignType;
d24fea86Joshua Skelton10 years ago642borderBottomWidth?: number
643borderLeftWidth?: number
644borderRightWidth?: number
645borderTopWidth?: number
646borderWidth?: number
647bottom?: number
648flex?: number
1f817868Vladimir Kotikov9 years ago649flexGrow?: number
650flexShrink?: number
651flexBasis?: number
2eacfc1edaserge9 years ago652flexDirection?: FlexDirection
1f817868Vladimir Kotikov9 years ago653flexWrap?: "wrap" | "nowrap"
d24fea86Joshua Skelton10 years ago654height?: number
1f817868Vladimir Kotikov9 years ago655justifyContent?: FlexJustifyType
d24fea86Joshua Skelton10 years ago656left?: number
1f817868Vladimir Kotikov9 years ago657minWidth?: number
658maxWidth?: number
659minHeight?: number
660maxHeight?: number
d24fea86Joshua Skelton10 years ago661margin?: number
662marginBottom?: number
663marginHorizontal?: number
664marginLeft?: number
665marginRight?: number
666marginTop?: number
667marginVertical?: number
1f817868Vladimir Kotikov9 years ago668overflow?: "visible" | "hidden" | "scroll"
d24fea86Joshua Skelton10 years ago669padding?: number
670paddingBottom?: number
671paddingHorizontal?: number
672paddingLeft?: number
673paddingRight?: number
674paddingTop?: number
675paddingVertical?: number
1f817868Vladimir Kotikov9 years ago676position?: "absolute" | "relative"
d24fea86Joshua Skelton10 years ago677right?: number
678top?: number
679width?: number
1f817868Vladimir Kotikov9 years ago680
681/**
682* @platform ios
683*/
684zIndex?: number
685}
686
687/**
688* @see ShadowPropTypesIOS.js
689*/
690export interface ShadowPropTypesIOSStatic {
691/**
692* Sets the drop shadow color
693* @platform ios
694*/
695shadowColor: string
696
697/**
698* Sets the drop shadow offset
699* @platform ios
700*/
701shadowOffset: {width: number, height: number}
702
703/**
704* Sets the drop shadow opacity (multiplied by the color's alpha component)
705* @platform ios
706*/
707shadowOpacity: number
708
709/**
710* Sets the drop shadow blur radius
711* @platform ios
712*/
713shadowRadius: number
714}
715
716type GetCurrentPositionOptions = {
717timeout: number
718maximumAge: number
719enableHighAccuracy: boolean
720distanceFilter: number
721}
722
723type WatchPositionOptions = {
724timeout: number
725maximumAge: number
726enableHighAccuracy: boolean
727distanceFilter: number
728}
729
730type GeolocationReturnType = {
731coords: {
732latitude: number
733longitude: number
734altitude?: number
735accuracy?: number
736altitudeAccuracy?: number
737heading?: number
738speed?: number
739}
740timestamp: number
d24fea86Joshua Skelton10 years ago741}
742
743
744export interface TransformsStyle {
745
746transform?: [{perspective: number}, {rotate: string}, {rotateX: string}, {rotateY: string}, {rotateZ: string}, {scale: number}, {scaleX: number}, {scaleY: number}, {translateX: number}, {translateY: number}, {skewX: string}, {skewY: string}]
747transformMatrix?: Array<number>
748rotation?: number
749scaleX?: number
750scaleY?: number
751translateX?: number
752translateY?: number
753}
754
755
756export interface StyleSheetProperties {
1f817868Vladimir Kotikov9 years ago757hairlineWidth: number
758flatten<T extends string>(style: T): T
d24fea86Joshua Skelton10 years ago759}
760
761export interface LayoutRectangle {
762x: number;
763y: number;
764width: number;
765height: number;
766}
767
768// @see TextProperties.onLayout
769export interface LayoutChangeEvent {
770nativeEvent: {
771layout: LayoutRectangle
772}
773}
774
1f817868Vladimir Kotikov9 years ago775export interface TextStyleIOS extends ViewStyle {
776letterSpacing?: number
777textDecorationColor?: string
778textDecorationStyle?: "solid" | "double" | "dotted" | "dashed"
779writingDirection?: "auto" | "ltr" | "rtl"
780}
781
782export interface TextStyleAndroid extends ViewStyle {
783textAlignVertical?: "auto" | "top" | "bottom" | "center"
784}
785
d24fea86Joshua Skelton10 years ago786// @see https://facebook.github.io/react-native/docs/text.html#style
1f817868Vladimir Kotikov9 years ago787export interface TextStyle extends TextStyleIOS, TextStyleAndroid, ViewStyle {
d24fea86Joshua Skelton10 years ago788color?: string
789fontFamily?: string
790fontSize?: number
1f817868Vladimir Kotikov9 years ago791fontStyle?: "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*/
797fontWeight?: "normal" | "bold" | "100" | "200" | "300" | "400" | "500" | "600" | "700" | "800" | "900"
d24fea86Joshua Skelton10 years ago798letterSpacing?: number
799lineHeight?: number
1f817868Vladimir Kotikov9 years ago800/**
801* Specifies text alignment.
802* The value 'justify' is only supported on iOS.
803*/
804textAlign?: "auto" | "left" | "right" | "center"
805textDecorationLine?: "none" | "underline" | "line-through" | "underline line-through"
806textDecorationStyle?: "solid" | "double" | "dotted" | "dashed"
d24fea86Joshua Skelton10 years ago807textDecorationColor?: string
1f817868Vladimir Kotikov9 years ago808textShadowColor?: string
809textShadowOffset?: {width: number, height: number}
810textShadowRadius?: number
811testID?: string
d24fea86Joshua Skelton10 years ago812}
813
74953675Vladimir Kotikov9 years ago814export interface TextPropertiesIOS {
1f817868Vladimir Kotikov9 years ago815/**
816* Specifies whether fonts should scale to respect Text Size accessibility setting on iOS. The
817* default is `true`.
818*/
819allowFontScaling?: boolean
820
821/**
822* Specifies whether font should be scaled down automatically to fit given style constraints.
823*/
824adjustsFontSizeToFit?: boolean
825
826/**
827* Specifies smallest possible scale a font can reach when adjustsFontSizeToFit is enabled. (values 0.01-1.0).
828*/
829minimumFontScale?: number
d24fea86Joshua Skelton10 years ago830
831/**
1f817868Vladimir Kotikov9 years ago832* 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 ago834*/
835suppressHighlighting?: boolean
836}
837
74953675Vladimir Kotikov9 years ago838export interface TextPropertiesAndroid {
1f817868Vladimir Kotikov9 years ago839/**
840* Lets the user select text, to use the native copy and paste functionality.
841*/
842selectable?: boolean
843}
844
d24fea86Joshua Skelton10 years ago845// https://facebook.github.io/react-native/docs/text.html#props
74953675Vladimir Kotikov9 years ago846export interface TextProperties extends TextPropertiesIOS, TextPropertiesAndroid, React.Props<TextStatic> {
d24fea86Joshua Skelton10 years ago847
848/**
1f817868Vladimir Kotikov9 years ago849* 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 ago855*/
1f817868Vladimir Kotikov9 years ago856accessible?: 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*/
875ellipsizeMode?: 'head' | 'middle' | 'tail' | 'clip'
876
877/**
878* Line Break mode. Works only with numberOfLines.
879* clip is working only for iOS
880*/
881lineBreakMode?: 'head' | 'middle' | 'tail' | 'clip'
d24fea86Joshua Skelton10 years ago882
883/**
1f817868Vladimir Kotikov9 years ago884* 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 ago889*/
890numberOfLines?: number
891
892/**
893* Invoked on mount and layout changes with
894*
895* {nativeEvent: { layout: {x, y, width, height}}}.
896*/
897onLayout?: ( 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*/
903onPress?: () => void
904
1f817868Vladimir Kotikov9 years ago905/**
906* This function is called on long press.
907* e.g., `onLongPress={this.increaseSize}>``
908*/
909onLongPress?: () => void
910
d24fea86Joshua Skelton10 years ago911/**
912* @see https://facebook.github.io/react-native/docs/text.html#style
913*/
914style?: TextStyle
915
916/**
917* Used to locate this view in end-to-end tests.
918*/
919testID?: string
920}
921
922/**
923* A React component for displaying text which supports nesting, styling, and touch handling.
924*/
1f817868Vladimir Kotikov9 years ago925export interface TextStatic extends NativeMethodsMixin, React.ClassicComponentClass<TextProperties> {}
d24fea86Joshua Skelton10 years ago926
1f817868Vladimir Kotikov9 years ago927type 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*/
938export interface DocumentSelectionState extends EventEmitter {
939new(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*/
948update(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*/
956constrainLength(maxLength: number): void
d24fea86Joshua Skelton10 years ago957
1f817868Vladimir Kotikov9 years ago958focus(): void
959blur(): void
960hasFocus(): boolean
961isCollapsed(): boolean
962isBackward(): boolean
963
2060f3fbVladimir Kotikov9 years ago964getAnchorOffset(): number
965getFocusOffset(): number
966getStartOffset(): number
967getEndOffset(): number
1f817868Vladimir Kotikov9 years ago968overlaps(start: number, end: number): boolean
969}
d24fea86Joshua Skelton10 years ago970
971/**
972* IOS Specific properties for TextInput
973* @see https://facebook.github.io/react-native/docs/textinput.html#props
974*/
975export 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 ago981clearButtonMode?: 'never' | 'while-editing' | 'unless-editing' | 'always'
d24fea86Joshua Skelton10 years ago982
983/**
984* If true, clears the text field automatically when editing begins
985*/
986clearTextOnFocus?: boolean
987
988/**
1f817868Vladimir Kotikov9 years ago989* 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 ago1003*/
1f817868Vladimir Kotikov9 years ago1004dataDetectorTypes?: DataDetectorTypes | DataDetectorTypes[]
d24fea86Joshua Skelton10 years ago1005
1006/**
1f817868Vladimir Kotikov9 years ago1007* 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 ago1009*/
1f817868Vladimir Kotikov9 years ago1010enablesReturnKeyAutomatically?: boolean
d24fea86Joshua Skelton10 years ago1011
1012/**
1f817868Vladimir Kotikov9 years ago1013* Determines the color of the keyboard.
d24fea86Joshua Skelton10 years ago1014*/
1f817868Vladimir Kotikov9 years ago1015keyboardAppearance?: 'default' | 'light' | 'dark'
d24fea86Joshua Skelton10 years ago1016
1017/**
1f817868Vladimir Kotikov9 years ago1018* 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 ago1021*/
1f817868Vladimir Kotikov9 years ago1022onKeyPress?: (key: string) => void
d24fea86Joshua Skelton10 years ago1023
1024/**
1025* See DocumentSelectionState.js, some state that is responsible for maintaining selection information for a document
1026*/
1f817868Vladimir Kotikov9 years ago1027selectionState?: DocumentSelectionState
d24fea86Joshua Skelton10 years ago1028}
1029
1030/**
1031* Android Specific properties for TextInput
1032* @see https://facebook.github.io/react-native/docs/textinput.html#props
1033*/
1034export interface TextInputAndroidProperties {
1035
1036/**
1f817868Vladimir Kotikov9 years ago1037* If defined, the provided image resource will be rendered on the left.
d24fea86Joshua Skelton10 years ago1038*/
1f817868Vladimir Kotikov9 years ago1039inlineImageLeft?: string
1040
1041/**
1042* Padding between the inline image, if any, and the text input itself.
1043*/
1044inlineImagePadding?: number
d24fea86Joshua Skelton10 years ago1045
1046/**
1f817868Vladimir Kotikov9 years ago1047* 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 ago1049*/
1f817868Vladimir Kotikov9 years ago1050numberOfLines?: number
d24fea86Joshua Skelton10 years ago1051
1052/**
1f817868Vladimir Kotikov9 years ago1053* Sets the return key to the label. Use it instead of `returnKeyType`.
1054* @platform android
d24fea86Joshua Skelton10 years ago1055*/
1f817868Vladimir Kotikov9 years ago1056returnKeyLabel?: string
d24fea86Joshua Skelton10 years ago1057
1058/**
1059* The color of the textInput underline.
1060*/
1061underlineColorAndroid?: string
1062}
1063
1f817868Vladimir Kotikov9 years ago1064export type KeyboardType = "default" | "email-address" | "numeric" | "phone-pad"
1065export type KeyboardTypeIOS = "ascii-capable" | "numbers-and-punctuation" | "url" | "number-pad" | "name-phone-pad" | "decimal-pad" | "twitter" | "web-search"
1066
1067export type ReturnKeyType = "done" | "go" | "next" | "search" | "send"
1068export type ReturnKeyTypeAndroid = "none" | "previous"
1069export type ReturnKeyTypeIOS = "default" | "google" | "join" | "route" | "yahoo" | "emergency-call"
d24fea86Joshua Skelton10 years ago1070
1071/**
1072* @see https://facebook.github.io/react-native/docs/textinput.html#props
1073*/
1f817868Vladimir Kotikov9 years ago1074export interface TextInputProperties extends ViewProperties, TextInputIOSProperties, TextInputAndroidProperties, React.Props<TextInputStatic> {
d24fea86Joshua Skelton10 years ago1075
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 ago1085autoCapitalize?: "none" | "sentences" | "words" | "characters"
d24fea86Joshua Skelton10 years ago1086
1087/**
1088* If false, disables auto-correct.
1089* The default value is true.
1090*/
1091autoCorrect?: boolean
1092
1093/**
1094* If true, focuses the input on componentDidMount.
1095* The default value is false.
1096*/
1097autoFocus?: boolean
1098
1f817868Vladimir Kotikov9 years ago1099/**
1100* If true, the text field will blur when submitted.
1101* The default value is true.
1102*/
1103blurOnSubmit?: boolean
1104
d24fea86Joshua Skelton10 years ago1105/**
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*/
1110defaultValue?: string
1111
1112/**
1113* If false, text is not editable. The default value is true.
1114*/
1115editable?: 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 ago1120* The following values work across platforms: - default - numeric - email-address - phone-pad
d24fea86Joshua Skelton10 years ago1121*/
1f817868Vladimir Kotikov9 years ago1122keyboardType?: KeyboardType | KeyboardTypeIOS
d24fea86Joshua Skelton10 years ago1123
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*/
1128maxLength?: number
1129
1130/**
1131* If true, the text input can be multiple lines. The default value is false.
1132*/
1133multiline?: boolean
1134
1135/**
1136* Callback that is called when the text input is blurred
1137*/
1138onBlur?: () => void
1139
1140/**
1141* Callback that is called when the text input's text changes.
1142*/
1143onChange?: ( 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*/
1149onChangeText?: ( text: string ) => void
1150
1f817868Vladimir Kotikov9 years ago1151/**
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*/
1158onContentSizeChange?: ( event: {nativeEvent: {contentSize: { width: number, height: number}}} ) => void
1159
d24fea86Joshua Skelton10 years ago1160/**
1161* Callback that is called when text input ends.
1162*/
1163onEndEditing?: ( event: {nativeEvent: {text: string}} ) => void
1164
1165/**
1166* Callback that is called when the text input is focused
1167*/
1168onFocus?: () => void
1169
1170/**
1f817868Vladimir Kotikov9 years ago1171* Callback that is called when the text input selection is changed.
d24fea86Joshua Skelton10 years ago1172*/
1f817868Vladimir Kotikov9 years ago1173onSelectionChange?: () => void
d24fea86Joshua Skelton10 years ago1174
1175/**
1176* Callback that is called when the text input's submit button is pressed.
1177*/
1178onSubmitEditing?: ( event: {nativeEvent: {text: string}} ) => void
1179
1180/**
1181* The string that will be rendered before text input has been entered
1182*/
1183placeholder?: string
1184
1185/**
1186* The text color of the placeholder string
1187*/
1188placeholderTextColor?: string
1189
1f817868Vladimir Kotikov9 years ago1190/**
1191* enum('default', 'go', 'google', 'join', 'next', 'route', 'search', 'send', 'yahoo', 'done', 'emergency-call')
1192* Determines how the return key should look.
1193*/
1194returnKeyType?: ReturnKeyType | ReturnKeyTypeAndroid | ReturnKeyTypeIOS
1195
d24fea86Joshua Skelton10 years ago1196/**
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*/
1200secureTextEntry?: boolean
1201
1f817868Vladimir Kotikov9 years ago1202/**
1203* If true, all text will automatically be selected on focus
1204*/
1205selectTextOnFocus?: 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*/
1211selection?: { start: number, end?: number }
1212
1213/**
1214* The highlight (and cursor on ios) color of the text input
1215*/
1216selectionColor?: string
1217
d24fea86Joshua Skelton10 years ago1218/**
1219* Styles
1220*/
1221style?: TextStyle
1222
1223/**
1224* Used to locate this view in end-to-end tests
1225*/
1226testID?: 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*/
1235value?: string
1236
1f817868Vladimir Kotikov9 years ago1237ref?: Ref<ViewStatic & TextInputStatic>
d24fea86Joshua Skelton10 years ago1238}
1239
1f817868Vladimir Kotikov9 years ago1240/**
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*/
1245interface 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 ago1250currentlyFocusedField(): number
1f817868Vladimir Kotikov9 years ago1251
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 ago1257focusTextInput(textFieldID?: number): void
1f817868Vladimir Kotikov9 years ago1258
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 ago1264blurTextInput(textFieldID?: number) : void
1f817868Vladimir Kotikov9 years ago1265}
1266
1267/**
1268* @see https://facebook.github.io/react-native/docs/textinput.html#methods
1269*/
1270export interface TextInputStatic extends NativeMethodsMixin, TimerMixin, React.ComponentClass<TextInputProperties> {
1271State: TextInputState
1272
1273/**
1274* Returns if the input is currently focused.
1275*/
1276isFocused: () => boolean
1277
1278/**
1279* Removes all text from the input.
1280*/
1281clear: () => void
1282}
1283
1284export type ToolbarAndroidAction = {
1285/**
1286* title: required, the title of this action
1287*/
1288title: string
1289
1290/**
1291* icon: the icon for this action, e.g. require('./some_icon.png')
1292*/
2060f3fbVladimir Kotikov9 years ago1293icon?: ImageURISource
1f817868Vladimir Kotikov9 years ago1294
1295/**
1296* show: when to show this action as an icon or hide it in the overflow menu: always, ifRoom or never
1297*/
1298show?: "always" | "ifRoom" | "never"
1299
1300/**
1301* showWithText: boolean, whether to show text alongside the icon or not
1302*/
1303showWithText?: boolean
1304}
1305
1306export 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*/
1321actions?: 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*/
1330contentInsetEnd?: 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*/
1339contentInsetStart?: number
1340
1341/**
1342* Sets the toolbar logo.
1343*/
2060f3fbVladimir Kotikov9 years ago1344logo?: ImageURISource
1f817868Vladimir Kotikov9 years ago1345
1346/**
1347* Sets the navigation icon.
1348*/
2060f3fbVladimir Kotikov9 years ago1349navIcon?: ImageURISource
1f817868Vladimir Kotikov9 years ago1350
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*/
1356onActionSelected?: (position: number) => void
1357
1358/**
1359* Callback called when the icon is selected.
1360*/
1361onIconClicked?: () => void
1362
1363/**
1364* Sets the overflow icon.
1365*/
2060f3fbVladimir Kotikov9 years ago1366overflowIcon?: ImageURISource
1f817868Vladimir Kotikov9 years ago1367
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*/
1376rtl?: boolean
1377
1378/**
1379* Sets the toolbar subtitle.
1380*/
1381subtitle?: string
1382
1383/**
1384* Sets the toolbar subtitle color.
1385*/
1386subtitleColor?: string
1387
1388/**
1389* Used to locate this view in end-to-end tests.
1390*/
1391testID?: string
1392
1393/**
1394* Sets the toolbar title.
1395*/
1396title?: string
1397
1398/**
1399* Sets the toolbar title color.
1400*/
1401titleColor?: string
1402
1403ref?: 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*/
1441export interface ToolbarAndroidStatic extends NativeMethodsMixin, React.ComponentClass<ToolbarAndroidProperties> {}
1442
1443
d24fea86Joshua Skelton10 years ago1444/**
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*/
1469export 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*/
1479onStartShouldSetResponder?: ( 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*/
1484onMoveShouldSetResponder?: ( 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 ago1490onResponderEnd?: ( event: GestureResponderEvent ) => void
1491
d24fea86Joshua Skelton10 years ago1492/**
1493* The View is now responding for touch events.
1494* This is the time to highlight and show the user what is happening
1495*/
1496onResponderGrant?: ( event: GestureResponderEvent ) => void
1497
1498/**
1499* Something else is the responder right now and will not release it
1500*/
1501onResponderReject?: ( 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*/
1510onResponderMove?: ( event: GestureResponderEvent ) => void
1511
1512/**
1513* Fired at the end of the touch, ie "touchUp"
1514*/
1515onResponderRelease?: ( event: GestureResponderEvent ) => void
1516
1f817868Vladimir Kotikov9 years ago1517onResponderStart?: ( event: GestureResponderEvent ) => void
1518
d24fea86Joshua Skelton10 years ago1519/**
1520* Something else wants to become responder.
1521* Should this view release the responder? Returning true allows release
1522*/
1523onResponderTerminationRequest?: ( 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*/
1530onResponderTerminate?: ( 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*/
1545onStartShouldSetResponderCapture?: ( 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*/
1560onMoveShouldSetResponderCapture?: () => void;
1561
1562}
1563
1564// @see https://facebook.github.io/react-native/docs/view.html#style
1565export interface ViewStyle extends FlexStyle, TransformsStyle {
1f817868Vladimir Kotikov9 years ago1566backfaceVisibility?: "visible" | "hidden"
d24fea86Joshua Skelton10 years ago1567backgroundColor?: string;
1568borderBottomColor?: string;
1569borderBottomLeftRadius?: number;
1570borderBottomRightRadius?: number;
1f817868Vladimir Kotikov9 years ago1571borderBottomWidth?: number;
d24fea86Joshua Skelton10 years ago1572borderColor?: string;
1573borderLeftColor?: string;
1574borderRadius?: number;
1575borderRightColor?: string;
1f817868Vladimir Kotikov9 years ago1576borderRightWidth?: number;
1577borderStyle?: "solid" | "dotted" | "dashed"
d24fea86Joshua Skelton10 years ago1578borderTopColor?: string;
1579borderTopLeftRadius?: number;
1580borderTopRightRadius?: number;
1f817868Vladimir Kotikov9 years ago1581borderTopWidth?: number
d24fea86Joshua Skelton10 years ago1582opacity?: number;
1f817868Vladimir Kotikov9 years ago1583overflow?: "visible" | "hidden"
d24fea86Joshua Skelton10 years ago1584shadowColor?: string;
1585shadowOffset?: {width: number, height: number};
1586shadowOpacity?: number;
1587shadowRadius?: number;
1f817868Vladimir Kotikov9 years ago1588elevation?: number;
1589testID?: string;
d24fea86Joshua Skelton10 years ago1590}
1591
1592export 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 ago1600accessibilityTraits?: ViewAccessibilityTraits | ViewAccessibilityTraits[];
d24fea86Joshua Skelton10 years ago1601
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*/
1612shouldRasterizeIOS?: boolean
1613}
1614
1615export 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 ago1623accessibilityComponentType?: 'none' | 'button' | 'radiobutton_checked' | 'radiobutton_unchecked'
d24fea86Joshua Skelton10 years ago1624
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 ago1631accessibilityLiveRegion?: 'none' | 'polite' | 'assertive'
d24fea86Joshua Skelton10 years ago1632
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*/
1638collapsable?: 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 ago1652importantForAccessibility?: 'auto' | 'yes' | 'no' | 'no-hide-descendants'
d24fea86Joshua Skelton10 years ago1653
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*/
1669needsOffscreenAlphaCompositing?: 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*/
1679renderToHardwareTextureAndroid?: boolean;
1680
1681}
1682
1683/**
1684* @see https://facebook.github.io/react-native/docs/view.html#props
1685*/
1686export 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*/
1691accessibilityLabel?: string;
1692
1693/**
1694* When true, indicates that the view is an accessibility element.
1695* By default, all the touchable elements are accessible.
1696*/
1697accessible?: boolean;
1698
1f817868Vladimir Kotikov9 years ago1699/**
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
1710hitSlop?: Insets
1711
d24fea86Joshua Skelton10 years ago1712/**
1713* When `accessible` is true, the system will try to invoke this function when the user performs accessibility tap gesture.
1714*/
1715onAcccessibilityTap?: () => void;
1716
1717/**
1718* Invoked on mount and layout changes with
1719*
1720* {nativeEvent: { layout: {x, y, width, height}}}.
1721*/
1722onLayout?: ( 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*/
1727onMagicTap?: () => 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 ago1752pointerEvents?: "box-none" | "none" | "box-only" | "auto"
d24fea86Joshua Skelton10 years ago1753
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*/
1760removeClippedSubviews?: boolean
1761
1762style?: ViewStyle;
1763
1764/**
1765* Used to locate this view in end-to-end tests.
1766*/
1767testID?: 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 ago1776export interface ViewStatic extends NativeMethodsMixin, React.ClassicComponentClass<ViewProperties> {
1777AccessibilityTraits: [
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
1797AccessibilityComponentType: [
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*/
1808forceTouchAvailable: boolean,
d24fea86Joshua Skelton10 years ago1809}
1810
1811/**
1f817868Vladimir Kotikov9 years ago1812* @see https://facebook.github.io/react-native/docs/viewpagerandroid.html#props
d24fea86Joshua Skelton10 years ago1813*/
1814
1815
1f817868Vladimir Kotikov9 years ago1816export interface ViewPagerAndroidOnPageScrollEventData {
1817position: number;
1818offset: number;
d24fea86Joshua Skelton10 years ago1819}
1820
1f817868Vladimir Kotikov9 years ago1821export interface ViewPagerAndroidOnPageSelectedEventData {
1822position: number;
1823}
d24fea86Joshua Skelton10 years ago1824
1f817868Vladimir Kotikov9 years ago1825export interface ViewPagerAndroidProperties extends ViewProperties {
d24fea86Joshua Skelton10 years ago1826/**
1f817868Vladimir Kotikov9 years ago1827* 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 ago1829*/
1f817868Vladimir Kotikov9 years ago1830initialPage?: number;
d24fea86Joshua Skelton10 years ago1831
1832/**
1f817868Vladimir Kotikov9 years ago1833* When false, the content does not scroll.
1834* The default value is true.
d24fea86Joshua Skelton10 years ago1835*/
1f817868Vladimir Kotikov9 years ago1836scrollEnabled?: boolean;
d24fea86Joshua Skelton10 years ago1837
1f817868Vladimir Kotikov9 years ago1838/**
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*/
1847onPageScroll?: ( event: NativeSyntheticEvent<ViewPagerAndroidOnPageScrollEventData> ) => void;
d24fea86Joshua Skelton10 years ago1848
1849/**
1f817868Vladimir Kotikov9 years ago1850* 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 ago1854*/
1f817868Vladimir Kotikov9 years ago1855onPageSelected?: ( event: NativeSyntheticEvent<ViewPagerAndroidOnPageSelectedEventData> ) => void;
d24fea86Joshua Skelton10 years ago1856
1f817868Vladimir Kotikov9 years ago1857/**
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*/
1865onPageScrollStateChanged?: (state: "Idle" | "Dragging" | "Settling") => void
d24fea86Joshua Skelton10 years ago1866
1867/**
1f817868Vladimir Kotikov9 years ago1868* 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 ago1871*/
1f817868Vladimir Kotikov9 years ago1872keyboardDismissMode?: "none" | "on-drag"
d24fea86Joshua Skelton10 years ago1873
1874/**
1f817868Vladimir Kotikov9 years ago1875* Blank space to show between pages. This is only visible while scrolling, pages are still
1876* edge-to-edge.
d24fea86Joshua Skelton10 years ago1877*/
1f817868Vladimir Kotikov9 years ago1878pageMargin?: number
1879}
d24fea86Joshua Skelton10 years ago1880
1f817868Vladimir Kotikov9 years ago1881export interface ViewPagerAndroidStatic extends NativeMethodsMixin, React.ComponentClass<ViewPagerAndroidProperties> {
d24fea86Joshua Skelton10 years ago1882/**
1f817868Vladimir Kotikov9 years ago1883* A helper function to scroll to a specific page in the ViewPager.
1884* The transition between pages will be animated.
d24fea86Joshua Skelton10 years ago1885*/
1f817868Vladimir Kotikov9 years ago1886setPage(selectedPage: number): void
d24fea86Joshua Skelton10 years ago1887
1f817868Vladimir Kotikov9 years ago1888/**
1889* A helper function to scroll to a specific page in the ViewPager.
1890* The transition between pages will *not* be animated.
1891*/
1892setPageWithoutAnimation(selectedPage: number): void
1893}
d24fea86Joshua Skelton10 years ago1894
1f817868Vladimir Kotikov9 years ago1895/**
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*/
1899export interface KeyboardAvoidingViewStatic extends TimerMixin, React.ClassicComponentClass<KeyboardAvoidingViewProps> {}
d24fea86Joshua Skelton10 years ago1900
1f817868Vladimir Kotikov9 years ago1901export interface KeyboardAvoidingViewProps extends ViewProperties, React.Props<KeyboardAvoidingViewStatic> {
d24fea86Joshua Skelton10 years ago1902
1f817868Vladimir Kotikov9 years ago1903behavior?: 'height' | 'position' | 'padding'
d24fea86Joshua Skelton10 years ago1904
1f817868Vladimir Kotikov9 years ago1905/**
1906* The style of the content container(View) when behavior is 'position'.
1907*/
1908contentContainerStyle: ViewStyle
d24fea86Joshua Skelton10 years ago1909
1f817868Vladimir Kotikov9 years ago1910/**
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*/
1914keyboardVerticalOffset: number
d24fea86Joshua Skelton10 years ago1915
1f817868Vladimir Kotikov9 years ago1916ref?: Ref<KeyboardAvoidingViewStatic & ViewStatic>
d24fea86Joshua Skelton10 years ago1917}
1918
1919/**
1f817868Vladimir Kotikov9 years ago1920* //FIXME: No documentation extracted from code comment on WebView.ios.js
d24fea86Joshua Skelton10 years ago1921*/
1f817868Vladimir Kotikov9 years ago1922export interface NavState {
d24fea86Joshua Skelton10 years ago1923
1f817868Vladimir Kotikov9 years ago1924url?: string
1925title?: string
1926loading?: boolean
1927canGoBack?: boolean
1928canGoForward?: boolean;
d24fea86Joshua Skelton10 years ago1929
1f817868Vladimir Kotikov9 years ago1930[key: string]: any
1931}
1932
1933export interface WebViewPropertiesAndroid {
d24fea86Joshua Skelton10 years ago1934
1935/**
1f817868Vladimir Kotikov9 years ago1936* Used for android only, JS is enabled by default for WebView on iOS
d24fea86Joshua Skelton10 years ago1937*/
1f817868Vladimir Kotikov9 years ago1938javaScriptEnabled?: boolean
d24fea86Joshua Skelton10 years ago1939
1940/**
1f817868Vladimir Kotikov9 years ago1941* Used on Android only, controls whether DOM Storage is enabled
1942* or not android
d24fea86Joshua Skelton10 years ago1943*/
1f817868Vladimir Kotikov9 years ago1944domStorageEnabled?: boolean
1945}
1946
1947export interface WebViewIOSLoadRequestEvent {
1948target: number
1949canGoBack: boolean
1950lockIdentifier: number
1951loading: boolean
1952title: string
1953canGoForward: boolean
1954navigationType: 'other' | 'click'
1955url: string
1956}
1957
1958export interface WebViewPropertiesIOS {
d24fea86Joshua Skelton10 years ago1959
1960/**
1f817868Vladimir Kotikov9 years ago1961* 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 ago1967*/
1f817868Vladimir Kotikov9 years ago1968allowsInlineMediaPlayback?: boolean
d24fea86Joshua Skelton10 years ago1969
1970/**
1f817868Vladimir Kotikov9 years ago1971* 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 ago1974*/
1f817868Vladimir Kotikov9 years ago1975bounces?: boolean
d24fea86Joshua Skelton10 years ago1976
1977/**
1f817868Vladimir Kotikov9 years ago1978* 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 ago1984*/
1f817868Vladimir Kotikov9 years ago1985decelerationRate?: "normal" | "fast" | number
d24fea86Joshua Skelton10 years ago1986
1987/**
1f817868Vladimir Kotikov9 years ago1988* 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 ago1991*/
1f817868Vladimir Kotikov9 years ago1992onShouldStartLoadWithRequest?: (event: WebViewIOSLoadRequestEvent) => boolean
d24fea86Joshua Skelton10 years ago1993
1994/**
1f817868Vladimir Kotikov9 years ago1995* Boolean value that determines whether scrolling is enabled in the
1996* `WebView`. The default value is `true`.
d24fea86Joshua Skelton10 years ago1997*/
1f817868Vladimir Kotikov9 years ago1998scrollEnabled?: boolean
1999}
d24fea86Joshua Skelton10 years ago2000
1f817868Vladimir Kotikov9 years ago2001export interface WebViewUriSource {
2002
2003/*
2004* The URI to load in the WebView. Can be a local or remote file.
d24fea86Joshua Skelton10 years ago2005*/
1f817868Vladimir Kotikov9 years ago2006uri?: 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*/
2012method?: 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*/
2018headers?: 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*/
2026body?: string;
2027}
2028
2029export interface WebViewHtmlSource {
2030
2031/*
2032* A static HTML page to display in the WebView.
2033*/
2034html: string;
2035
2036/*
2037* The base URL to be used for any relative links in the HTML.
2038*/
2039baseUrl?: string;
d24fea86Joshua Skelton10 years ago2040}
2041
2042/**
1f817868Vladimir Kotikov9 years ago2043* @see https://facebook.github.io/react-native/docs/webview.html#props
d24fea86Joshua Skelton10 years ago2044*/
1f817868Vladimir Kotikov9 years ago2045export interface WebViewProperties extends ViewProperties, WebViewPropertiesAndroid, WebViewPropertiesIOS, React.Props<WebViewStatic> {
2046
d24fea86Joshua Skelton10 years ago2047/**
1f817868Vladimir Kotikov9 years ago2048* 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 ago2051*/
1f817868Vladimir Kotikov9 years ago2052automaticallyAdjustContentInsets?: boolean
d24fea86Joshua Skelton10 years ago2053
2054/**
1f817868Vladimir Kotikov9 years ago2055* 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 ago2057*/
1f817868Vladimir Kotikov9 years ago2058contentInset?: Insets
d24fea86Joshua Skelton10 years ago2059
2060/**
1f817868Vladimir Kotikov9 years ago2061* @deprecated
d24fea86Joshua Skelton10 years ago2062*/
1f817868Vladimir Kotikov9 years ago2063html?: string
d24fea86Joshua Skelton10 years ago2064
2065/**
1f817868Vladimir Kotikov9 years ago2066* Set this to provide JavaScript that will be injected into the web page
2067* when the view loads.
d24fea86Joshua Skelton10 years ago2068*/
1f817868Vladimir Kotikov9 years ago2069injectedJavaScript?: string
d24fea86Joshua Skelton10 years ago2070
2071/**
1f817868Vladimir Kotikov9 years ago2072* Invoked when load fails
d24fea86Joshua Skelton10 years ago2073*/
1f817868Vladimir Kotikov9 years ago2074onError?: ( event: NavState ) => void
d24fea86Joshua Skelton10 years ago2075
2076/**
1f817868Vladimir Kotikov9 years ago2077* Invoked when load finish
d24fea86Joshua Skelton10 years ago2078*/
1f817868Vladimir Kotikov9 years ago2079onLoad?: ( event: NavState ) => void
d24fea86Joshua Skelton10 years ago2080
2081/**
1f817868Vladimir Kotikov9 years ago2082* Invoked when load either succeeds or fails
d24fea86Joshua Skelton10 years ago2083*/
1f817868Vladimir Kotikov9 years ago2084onLoadEnd?: ( event: NavState ) => void
d24fea86Joshua Skelton10 years ago2085
2086/**
1f817868Vladimir Kotikov9 years ago2087* Invoked on load start
d24fea86Joshua Skelton10 years ago2088*/
1f817868Vladimir Kotikov9 years ago2089onLoadStart?: ( event: NavState ) => void
d24fea86Joshua Skelton10 years ago2090
2091/**
1f817868Vladimir Kotikov9 years ago2092* Function that is invoked when the `WebView` loading starts or ends.
d24fea86Joshua Skelton10 years ago2093*/
1f817868Vladimir Kotikov9 years ago2094onNavigationStateChange?: ( event: NavState ) => void
d24fea86Joshua Skelton10 years ago2095
1f817868Vladimir Kotikov9 years ago2096/**
2097* Function that returns a view to show if there's an error.
2098*/
2099renderError?: () => React.ReactElement<ViewProperties>
d24fea86Joshua Skelton10 years ago2100
1f817868Vladimir Kotikov9 years ago2101/**
2102* Function that returns a loading indicator.
2103*/
2104renderLoading?: () => React.ReactElement<ViewProperties>
d24fea86Joshua Skelton10 years ago2105
1f817868Vladimir Kotikov9 years ago2106/**
2107* Boolean value that forces the `WebView` to show the loading view
2108* on the first load.
2109*/
2110startInLoadingState?: boolean
2111
2112style?: ViewStyle
2113
2114// Deprecated: Use the `source` prop instead.
2115url?: string
2116
2117source?: WebViewUriSource | WebViewHtmlSource | number
d24fea86Joshua Skelton10 years ago2118
2119/**
1f817868Vladimir Kotikov9 years ago2120* Determines whether HTML5 audio & videos require the user to tap
2121* before they can start playing. The default value is false.
d24fea86Joshua Skelton10 years ago2122*/
1f817868Vladimir Kotikov9 years ago2123mediaPlaybackRequiresUserAction?: boolean
d24fea86Joshua Skelton10 years ago2124
2125/**
1f817868Vladimir Kotikov9 years ago2126* sets whether the webpage scales to fit the view and the user can change the scale
d24fea86Joshua Skelton10 years ago2127*/
1f817868Vladimir Kotikov9 years ago2128scalesPageToFit?: boolean
2129
2130ref?: Ref<WebViewStatic & ViewStatic>
2131}
2132
2133
2134export interface WebViewStatic extends React.ClassicComponentClass<WebViewProperties> {
d24fea86Joshua Skelton10 years ago2135
2136/**
1f817868Vladimir Kotikov9 years ago2137* Go back one page in the webview's history.
d24fea86Joshua Skelton10 years ago2138*/
1f817868Vladimir Kotikov9 years ago2139goBack: () => void
d24fea86Joshua Skelton10 years ago2140
2141/**
1f817868Vladimir Kotikov9 years ago2142* Go forward one page in the webview's history.
d24fea86Joshua Skelton10 years ago2143*/
1f817868Vladimir Kotikov9 years ago2144goForward: () => void
d24fea86Joshua Skelton10 years ago2145
2146/**
1f817868Vladimir Kotikov9 years ago2147* Reloads the current page.
d24fea86Joshua Skelton10 years ago2148*/
1f817868Vladimir Kotikov9 years ago2149reload: () => void
d24fea86Joshua Skelton10 years ago2150
1f817868Vladimir Kotikov9 years ago2151/**
2152* Stop loading the current page.
2153*/
2154stopLoading(): void
d24fea86Joshua Skelton10 years ago2155
1f817868Vladimir Kotikov9 years ago2156/**
2157* Returns the native webview node.
2158*/
2159getWebViewHandle: () => any
d24fea86Joshua Skelton10 years ago2160}
2161
1f817868Vladimir Kotikov9 years ago2162/**
2163* @see https://facebook.github.io/react-native/docs/segmentedcontrolios.html
2164* @see SegmentedControlIOS.ios.js
2165*/
2166export interface NativeSegmentedControlIOSChangeEvent {
2167value: string
2168selectedSegmentIndex: number
2169target: number
2170}
d24fea86Joshua Skelton10 years ago2171
1f817868Vladimir Kotikov9 years ago2172export interface SegmentedControlIOSProperties extends ViewProperties, React.Props<SegmentedControlIOSStatic> {
d24fea86Joshua Skelton10 years ago2173
2174/**
1f817868Vladimir Kotikov9 years ago2175* If false the user won't be able to interact with the control. Default value is true.
d24fea86Joshua Skelton10 years ago2176*/
1f817868Vladimir Kotikov9 years ago2177enabled?: boolean
d24fea86Joshua Skelton10 years ago2178
2179/**
1f817868Vladimir Kotikov9 years ago2180* If true, then selecting a segment won't persist visually.
2181* The onValueChange callback will still work as expected.
d24fea86Joshua Skelton10 years ago2182*/
1f817868Vladimir Kotikov9 years ago2183momentary?: boolean
d24fea86Joshua Skelton10 years ago2184
2185/**
1f817868Vladimir Kotikov9 years ago2186* Callback that is called when the user taps a segment;
2187* passes the event as an argument
2188* @param event
d24fea86Joshua Skelton10 years ago2189*/
1f817868Vladimir Kotikov9 years ago2190onChange?: (event: NativeSyntheticEvent<NativeSegmentedControlIOSChangeEvent>) => void
d24fea86Joshua Skelton10 years ago2191
2192/**
1f817868Vladimir Kotikov9 years ago2193* Callback that is called when the user taps a segment; passes the segment's value as an argument
2194* @param value
d24fea86Joshua Skelton10 years ago2195*/
1f817868Vladimir Kotikov9 years ago2196onValueChange?: (value: string) => void
d24fea86Joshua Skelton10 years ago2197
2198/**
1f817868Vladimir Kotikov9 years ago2199* The index in props.values of the segment to be (pre)selected.
d24fea86Joshua Skelton10 years ago2200*/
1f817868Vladimir Kotikov9 years ago2201selectedIndex?: number
d24fea86Joshua Skelton10 years ago2202
2203/**
1f817868Vladimir Kotikov9 years ago2204* Accent color of the control.
d24fea86Joshua Skelton10 years ago2205*/
1f817868Vladimir Kotikov9 years ago2206tintColor?: string
d24fea86Joshua Skelton10 years ago2207
2208/**
1f817868Vladimir Kotikov9 years ago2209* The labels for the control's segment buttons, in order.
d24fea86Joshua Skelton10 years ago2210*/
1f817868Vladimir Kotikov9 years ago2211values?: string[]
d24fea86Joshua Skelton10 years ago2212
1f817868Vladimir Kotikov9 years ago2213ref?: Ref<SegmentedControlIOSStatic>
d24fea86Joshua Skelton10 years ago2214}
2215
2216/**
1f817868Vladimir Kotikov9 years ago2217* 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 ago2235*/
1f817868Vladimir Kotikov9 years ago2236export interface SegmentedControlIOSStatic extends NativeMethodsMixin, React.ClassicComponentClass<SegmentedControlIOSProperties> {}
d24fea86Joshua Skelton10 years ago2237
2238
1f817868Vladimir Kotikov9 years ago2239export interface NavigatorIOSProperties extends React.Props<NavigatorIOSStatic> {
d24fea86Joshua Skelton10 years ago2240
2241/**
1f817868Vladimir Kotikov9 years ago2242* 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 ago2244*/
1f817868Vladimir Kotikov9 years ago2245initialRoute: Route
d24fea86Joshua Skelton10 years ago2246
2247/**
1f817868Vladimir Kotikov9 years ago2248* 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 ago2250*/
1f817868Vladimir Kotikov9 years ago2251itemWrapperStyle?: ViewStyle
d24fea86Joshua Skelton10 years ago2252
2253/**
1f817868Vladimir Kotikov9 years ago2254* 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 ago2263*/
1f817868Vladimir Kotikov9 years ago2264interactivePopGestureEnabled?: boolean
d24fea86Joshua Skelton10 years ago2265
2266/**
1f817868Vladimir Kotikov9 years ago2267* A Boolean value that indicates whether the navigation bar is hidden
d24fea86Joshua Skelton10 years ago2268*/
1f817868Vladimir Kotikov9 years ago2269navigationBarHidden?: boolean
d24fea86Joshua Skelton10 years ago2270
2271/**
1f817868Vladimir Kotikov9 years ago2272* A Boolean value that indicates whether to hide the 1px hairline shadow
d24fea86Joshua Skelton10 years ago2273*/
1f817868Vladimir Kotikov9 years ago2274shadowHidden?: boolean
d24fea86Joshua Skelton10 years ago2275
2276/**
1f817868Vladimir Kotikov9 years ago2277* The color used for buttons in the navigation bar
d24fea86Joshua Skelton10 years ago2278*/
1f817868Vladimir Kotikov9 years ago2279tintColor?: string
d24fea86Joshua Skelton10 years ago2280
2281/**
1f817868Vladimir Kotikov9 years ago2282* The default background color of the navigation bar.
d24fea86Joshua Skelton10 years ago2283*/
1f817868Vladimir Kotikov9 years ago2284barTintColor?: string
d24fea86Joshua Skelton10 years ago2285
2286/**
1f817868Vladimir Kotikov9 years ago2287* The text color of the navigation bar title
d24fea86Joshua Skelton10 years ago2288*/
1f817868Vladimir Kotikov9 years ago2289titleTextColor?: string
d24fea86Joshua Skelton10 years ago2290
2291/**
1f817868Vladimir Kotikov9 years ago2292* A Boolean value that indicates whether the navigation bar is translucent
d24fea86Joshua Skelton10 years ago2293*/
1f817868Vladimir Kotikov9 years ago2294translucent?: boolean
d24fea86Joshua Skelton10 years ago2295
2296/**
1f817868Vladimir Kotikov9 years ago2297* NOT IN THE DOC BUT IN THE EXAMPLES
d24fea86Joshua Skelton10 years ago2298*/
1f817868Vladimir Kotikov9 years ago2299style?: ViewStyle
d24fea86Joshua Skelton10 years ago2300}
2301
2302/**
1f817868Vladimir Kotikov9 years ago2303* 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 ago2309*/
1f817868Vladimir Kotikov9 years ago2310export interface NavigationIOS {
2311/**
2312* Navigate forward to a new route
2313*/
2314push: ( route: Route ) => void
d24fea86Joshua Skelton10 years ago2315
1f817868Vladimir Kotikov9 years ago2316/**
2317* Go back one page
2318*/
2319pop: () => void
d24fea86Joshua Skelton10 years ago2320
2321/**
1f817868Vladimir Kotikov9 years ago2322* Go back N pages at once. When N=1, behavior matches pop()
d24fea86Joshua Skelton10 years ago2323*/
1f817868Vladimir Kotikov9 years ago2324popN: ( n: number ) => void
d24fea86Joshua Skelton10 years ago2325
2326/**
1f817868Vladimir Kotikov9 years ago2327* Replace the route for the current page and immediately load the view for the new route
d24fea86Joshua Skelton10 years ago2328*/
1f817868Vladimir Kotikov9 years ago2329replace: ( route: Route ) => void
d24fea86Joshua Skelton10 years ago2330
2331/**
1f817868Vladimir Kotikov9 years ago2332* Replace the route/view for the previous page
d24fea86Joshua Skelton10 years ago2333*/
1f817868Vladimir Kotikov9 years ago2334replacePrevious: ( route: Route ) => void
d24fea86Joshua Skelton10 years ago2335
2336/**
1f817868Vladimir Kotikov9 years ago2337* Replaces the previous route/view and transitions back to it
d24fea86Joshua Skelton10 years ago2338*/
1f817868Vladimir Kotikov9 years ago2339replacePreviousAndPop: ( route: Route ) => void
d24fea86Joshua Skelton10 years ago2340
2341/**
1f817868Vladimir Kotikov9 years ago2342* Replaces the top item and popToTop
d24fea86Joshua Skelton10 years ago2343*/
1f817868Vladimir Kotikov9 years ago2344resetTo: ( route: Route ) => void
d24fea86Joshua Skelton10 years ago2345
2346/**
1f817868Vladimir Kotikov9 years ago2347* Go back to the item for a particular route object
d24fea86Joshua Skelton10 years ago2348*/
1f817868Vladimir Kotikov9 years ago2349popToRoute( route: Route ): void
d24fea86Joshua Skelton10 years ago2350
1f817868Vladimir Kotikov9 years ago2351/**
2352* Go back to the top item
2353*/
2354popToTop(): void
d24fea86Joshua Skelton10 years ago2355}
2356
1f817868Vladimir Kotikov9 years ago2357export interface NavigatorIOSStatic extends NavigationIOS, React.ComponentClass<NavigatorIOSProperties> {
d24fea86Joshua Skelton10 years ago2358}
2359
2360
2361/**
1f817868Vladimir Kotikov9 years ago2362* @see https://facebook.github.io/react-native/docs/activityindicator.html#props
d24fea86Joshua Skelton10 years ago2363*/
1f817868Vladimir Kotikov9 years ago2364export interface ActivityIndicatorProperties extends ViewProperties, React.Props<ActivityIndicatorStatic> {
2365
d24fea86Joshua Skelton10 years ago2366/**
1f817868Vladimir Kotikov9 years ago2367* Whether to show the indicator (true, the default) or hide it (false).
2368*/
2369animating?: 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 ago2386*/
1f817868Vladimir Kotikov9 years ago2387color?: string | number
2388
d24fea86Joshua Skelton10 years ago2389/**
1f817868Vladimir Kotikov9 years ago2390* Whether the indicator should hide when not animating (true by default).
d24fea86Joshua Skelton10 years ago2391*/
1f817868Vladimir Kotikov9 years ago2392hidesWhenStopped?: boolean
2393
d24fea86Joshua Skelton10 years ago2394/**
1f817868Vladimir Kotikov9 years ago2395* 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 ago2399*/
1f817868Vladimir Kotikov9 years ago2400size?: number | 'small' | 'large'
2401
2402style?: ViewStyle
2403
2404ref?: Ref<ActivityIndicatorStatic>
2405}
2406
2407export interface ActivityIndicatorStatic extends React.NativeMethodsMixin, React.ClassicComponentClass<ActivityIndicatorProperties> {
d24fea86Joshua Skelton10 years ago2408}
2409
1f817868Vladimir Kotikov9 years ago2410
d24fea86Joshua Skelton10 years ago2411/**
1f817868Vladimir Kotikov9 years ago2412* @see https://facebook.github.io/react-native/docs/activityindicatorios.html#props
d24fea86Joshua Skelton10 years ago2413*/
1f817868Vladimir Kotikov9 years ago2414export interface ActivityIndicatorIOSProperties extends ViewProperties, React.Props<ActivityIndicatorIOSStatic> {
d24fea86Joshua Skelton10 years ago2415
2416/**
1f817868Vladimir Kotikov9 years ago2417* Whether to show the indicator (true, the default) or hide it (false).
d24fea86Joshua Skelton10 years ago2418*/
1f817868Vladimir Kotikov9 years ago2419animating?: boolean
d24fea86Joshua Skelton10 years ago2420
2421/**
1f817868Vladimir Kotikov9 years ago2422* The foreground color of the spinner (default is gray).
d24fea86Joshua Skelton10 years ago2423*/
1f817868Vladimir Kotikov9 years ago2424color?: string
d24fea86Joshua Skelton10 years ago2425
2426/**
1f817868Vladimir Kotikov9 years ago2427* Whether the indicator should hide when not animating (true by default).
d24fea86Joshua Skelton10 years ago2428*/
1f817868Vladimir Kotikov9 years ago2429hidesWhenStopped?: boolean
d24fea86Joshua Skelton10 years ago2430
2431/**
1f817868Vladimir Kotikov9 years ago2432* Invoked on mount and layout changes with
d24fea86Joshua Skelton10 years ago2433*/
1f817868Vladimir Kotikov9 years ago2434onLayout?: ( event: {nativeEvent: { layout: {x: number, y: number , width: number, height: number}}} ) => void
d24fea86Joshua Skelton10 years ago2435
2436/**
1f817868Vladimir Kotikov9 years ago2437* 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 ago2441*/
1f817868Vladimir Kotikov9 years ago2442size?: 'small' | 'large'
d24fea86Joshua Skelton10 years ago2443
1f817868Vladimir Kotikov9 years ago2444style?: ViewStyle
d24fea86Joshua Skelton10 years ago2445
1f817868Vladimir Kotikov9 years ago2446ref?: Ref<ActivityIndicatorIOSStatic>
2447}
2448
2449/**
2450* @Deprecated since version 0.28.0
2451*/
2452export interface ActivityIndicatorIOSStatic extends React.ComponentClass<ActivityIndicatorIOSProperties> {
2453}
2454
2455
2456export interface DatePickerIOSProperties extends ViewProperties, React.Props<DatePickerIOSStatic> {
d24fea86Joshua Skelton10 years ago2457
2458/**
1f817868Vladimir Kotikov9 years ago2459* The currently selected date.
d24fea86Joshua Skelton10 years ago2460*/
1f817868Vladimir Kotikov9 years ago2461date: Date
2462
d24fea86Joshua Skelton10 years ago2463
2464/**
1f817868Vladimir Kotikov9 years ago2465* Maximum date.
2466* Restricts the range of possible date/time values.
d24fea86Joshua Skelton10 years ago2467*/
1f817868Vladimir Kotikov9 years ago2468maximumDate?: Date
d24fea86Joshua Skelton10 years ago2469
2470/**
1f817868Vladimir Kotikov9 years ago2471* Maximum date.
2472* Restricts the range of possible date/time values.
d24fea86Joshua Skelton10 years ago2473*/
1f817868Vladimir Kotikov9 years ago2474minimumDate?: Date
d24fea86Joshua Skelton10 years ago2475
2476/**
1f817868Vladimir Kotikov9 years ago2477* enum(1, 2, 3, 4, 5, 6, 10, 12, 15, 20, 30)
2478* The interval at which minutes can be selected.
d24fea86Joshua Skelton10 years ago2479*/
2060f3fbVladimir Kotikov9 years ago2480minuteInterval?: number
d24fea86Joshua Skelton10 years ago2481
2482/**
1f817868Vladimir Kotikov9 years ago2483* enum('date', 'time', 'datetime')
2484* The date picker mode.
d24fea86Joshua Skelton10 years ago2485*/
1f817868Vladimir Kotikov9 years ago2486mode?: "date" | "time" | "datetime"
d24fea86Joshua Skelton10 years ago2487
2488/**
1f817868Vladimir Kotikov9 years ago2489* 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 ago2492*/
1f817868Vladimir Kotikov9 years ago2493onDateChange: ( newDate: Date ) => void
d24fea86Joshua Skelton10 years ago2494
2495/**
1f817868Vladimir Kotikov9 years ago2496* 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 ago2499*/
1f817868Vladimir Kotikov9 years ago2500timeZoneOffsetInMinutes?: number
d24fea86Joshua Skelton10 years ago2501
1f817868Vladimir Kotikov9 years ago2502ref?: Ref<DatePickerIOSStatic & ViewStatic>
d24fea86Joshua Skelton10 years ago2503}
2504
1f817868Vladimir Kotikov9 years ago2505export interface DatePickerIOSStatic extends React.NativeMethodsMixin, React.ComponentClass<DatePickerIOSProperties> {
d24fea86Joshua Skelton10 years ago2506}
2507
1f817868Vladimir Kotikov9 years ago2508export interface DrawerSlideEvent extends NativeSyntheticEvent<NativeTouchEvent> {
2509}
d24fea86Joshua Skelton10 years ago2510
2511/**
1f817868Vladimir Kotikov9 years ago2512* @see DrawerLayoutAndroid.android.js
d24fea86Joshua Skelton10 years ago2513*/
1f817868Vladimir Kotikov9 years ago2514export interface DrawerLayoutAndroidProperties extends ViewProperties, React.Props<DrawerLayoutAndroidStatic> {
d24fea86Joshua Skelton10 years ago2515
2516/**
1f817868Vladimir Kotikov9 years ago2517* 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 ago2524*/
1f817868Vladimir Kotikov9 years ago2525drawerBackgroundColor?: string;
d24fea86Joshua Skelton10 years ago2526
2527/**
1f817868Vladimir Kotikov9 years ago2528* Specifies the lock mode of the drawer. The drawer can be locked
2529* in 3 states:
d24fea86Joshua Skelton10 years ago2530*
1f817868Vladimir Kotikov9 years ago2531* - 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 ago2540*/
1f817868Vladimir Kotikov9 years ago2541drawerLockMode?: "unlocked" | "locked-closed" | "locked-open";
d24fea86Joshua Skelton10 years ago2542
2543/**
1f817868Vladimir Kotikov9 years ago2544* Specifies the side of the screen from which the drawer will slide in.
2545* enum(DrawerConsts.DrawerPosition.Left, DrawerConsts.DrawerPosition.Right)
d24fea86Joshua Skelton10 years ago2546*/
1f817868Vladimir Kotikov9 years ago2547drawerPosition?: any;
d24fea86Joshua Skelton10 years ago2548
2549/**
1f817868Vladimir Kotikov9 years ago2550* 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 ago2552*/
1f817868Vladimir Kotikov9 years ago2553drawerWidth?: number;
d24fea86Joshua Skelton10 years ago2554
2555/**
1f817868Vladimir Kotikov9 years ago2556* 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 ago2559*/
1f817868Vladimir Kotikov9 years ago2560keyboardDismissMode?: "none" | "on-drag"
d24fea86Joshua Skelton10 years ago2561
2562/**
1f817868Vladimir Kotikov9 years ago2563* Function called whenever the navigation view has been closed.
d24fea86Joshua Skelton10 years ago2564*/
1f817868Vladimir Kotikov9 years ago2565onDrawerClose?: () => void
d24fea86Joshua Skelton10 years ago2566
2567/**
1f817868Vladimir Kotikov9 years ago2568* Function called whenever the navigation view has been opened.
d24fea86Joshua Skelton10 years ago2569*/
1f817868Vladimir Kotikov9 years ago2570onDrawerOpen?: () => void
d24fea86Joshua Skelton10 years ago2571
2572/**
1f817868Vladimir Kotikov9 years ago2573* Function called whenever there is an interaction with the navigation view.
2574* @param event
d24fea86Joshua Skelton10 years ago2575*/
1f817868Vladimir Kotikov9 years ago2576onDrawerSlide?: (event: DrawerSlideEvent) => void
d24fea86Joshua Skelton10 years ago2577
2578/**
1f817868Vladimir Kotikov9 years ago2579* 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 ago2589*/
1f817868Vladimir Kotikov9 years ago2590onDrawerStateChanged?: (event: "Idle" | "Dragging" | "Settling") => void
d24fea86Joshua Skelton10 years ago2591
2592/**
1f817868Vladimir Kotikov9 years ago2593* The navigation view that will be rendered to the side of the
2594* screen and can be pulled in.
d24fea86Joshua Skelton10 years ago2595*/
1f817868Vladimir Kotikov9 years ago2596renderNavigationView: () => JSX.Element
d24fea86Joshua Skelton10 years ago2597
2598/**
1f817868Vladimir Kotikov9 years ago2599* 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 ago2602*/
1f817868Vladimir Kotikov9 years ago2603statusBarBackgroundColor?: string
2604
2605ref?: Ref<DrawerLayoutAndroidStatic & ViewStatic>
2606}
d24fea86Joshua Skelton10 years ago2607
1f817868Vladimir Kotikov9 years ago2608export interface DrawerLayoutAndroidStatic extends NativeMethodsMixin, React.ClassicComponentClass<DrawerLayoutAndroidProperties> {
d24fea86Joshua Skelton10 years ago2609
2610/**
1f817868Vladimir Kotikov9 years ago2611* Opens the drawer.
d24fea86Joshua Skelton10 years ago2612*/
1f817868Vladimir Kotikov9 years ago2613openDrawer(): void
d24fea86Joshua Skelton10 years ago2614
2615/**
1f817868Vladimir Kotikov9 years ago2616* Closes the drawer.
d24fea86Joshua Skelton10 years ago2617*/
1f817868Vladimir Kotikov9 years ago2618closeDrawer(): void
d24fea86Joshua Skelton10 years ago2619}
2620
1f817868Vladimir Kotikov9 years ago2621
2622/**
2623* @see PickerIOS.ios.js
2624*/
2625export interface PickerIOSItemProperties extends React.Props<PickerIOSItemStatic> {
2626value?: string | number
2627label?: string
d24fea86Joshua Skelton10 years ago2628}
2629
1f817868Vladimir Kotikov9 years ago2630/**
2631* @see PickerIOS.ios.js
2632*/
2633export interface PickerIOSItemStatic extends React.ComponentClass<PickerIOSItemProperties> {}
d24fea86Joshua Skelton10 years ago2634
1f817868Vladimir Kotikov9 years ago2635/**
2636* @see Picker.js
2637*/
2638export interface PickerItemProperties extends React.Props<PickerItemStatic> {
2639label: string
2640value?: any
d24fea86Joshua Skelton10 years ago2641}
2642
1f817868Vladimir Kotikov9 years ago2643export interface PickerItemStatic extends React.ComponentClass<PickerItemProperties> {
d24fea86Joshua Skelton10 years ago2644}
2645
1f817868Vladimir Kotikov9 years ago2646export interface PickerPropertiesIOS extends ViewProperties, React.Props<PickerStatic> {
d24fea86Joshua Skelton10 years ago2647
2648/**
1f817868Vladimir Kotikov9 years ago2649* Style to apply to each of the item labels.
2650* @platform ios
d24fea86Joshua Skelton10 years ago2651*/
1f817868Vladimir Kotikov9 years ago2652itemStyle?: ViewStyle,
d24fea86Joshua Skelton10 years ago2653
1f817868Vladimir Kotikov9 years ago2654ref?: Ref<PickerStatic & ViewStatic>
2655}
d24fea86Joshua Skelton10 years ago2656
1f817868Vladimir Kotikov9 years ago2657export interface PickerPropertiesAndroid extends ViewProperties, React.Props<PickerStatic> {
d24fea86Joshua Skelton10 years ago2658
2659/**
1f817868Vladimir Kotikov9 years ago2660* 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 ago2663*/
1f817868Vladimir Kotikov9 years ago2664enabled?: boolean
d24fea86Joshua Skelton10 years ago2665
2666/**
1f817868Vladimir Kotikov9 years ago2667* On Android, specifies how to display the selection items when the user taps on the picker:
d24fea86Joshua Skelton10 years ago2668*
1f817868Vladimir Kotikov9 years ago2669* - '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 ago2673*/
1f817868Vladimir Kotikov9 years ago2674mode?: "dialog" | "dropdown"
d24fea86Joshua Skelton10 years ago2675
2676/**
1f817868Vladimir Kotikov9 years ago2677* Prompt string for this picker, used on Android in dialog mode as the title of the dialog.
2678* @platform android
d24fea86Joshua Skelton10 years ago2679*/
1f817868Vladimir Kotikov9 years ago2680prompt?: string
d24fea86Joshua Skelton10 years ago2681
1f817868Vladimir Kotikov9 years ago2682ref?: Ref<PickerStatic & ViewStatic>
2683}
d24fea86Joshua Skelton10 years ago2684
1f817868Vladimir Kotikov9 years ago2685/**
2686* @see https://facebook.github.io/react-native/docs/picker.html
2687* @see Picker.js
2688*/
2689export interface PickerProperties extends PickerPropertiesIOS, PickerPropertiesAndroid, React.Props<PickerStatic> {
d24fea86Joshua Skelton10 years ago2690
2691/**
1f817868Vladimir Kotikov9 years ago2692* 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 ago2698*/
1f817868Vladimir Kotikov9 years ago2699onValueChange?: ( itemValue: any, itemPosition: number ) => void
d24fea86Joshua Skelton10 years ago2700
2701/**
1f817868Vladimir Kotikov9 years ago2702* Value matching value of one of the items.
2703* Can be a string or an integer.
d24fea86Joshua Skelton10 years ago2704*/
1f817868Vladimir Kotikov9 years ago2705selectedValue?: any
2706
2707style?: ViewStyle
d24fea86Joshua Skelton10 years ago2708
2709/**
1f817868Vladimir Kotikov9 years ago2710* Used to locate this view in end-to-end tests.
d24fea86Joshua Skelton10 years ago2711*/
1f817868Vladimir Kotikov9 years ago2712testId?: string
2713
2714ref?: Ref<PickerStatic>
2715}
2716
2717/**
2718* @see https://facebook.github.io/react-native/docs/picker.html
2719* @see Picker.js
2720*/
2721export interface PickerStatic extends React.ComponentClass<PickerProperties> {
d24fea86Joshua Skelton10 years ago2722
1f817868Vladimir Kotikov9 years ago2723/**
2724* On Android, display the options in a dialog.
2725*/
2726MODE_DIALOG: string
d24fea86Joshua Skelton10 years ago2727/**
1f817868Vladimir Kotikov9 years ago2728* On Android, display the options in a dropdown (this is the default).
d24fea86Joshua Skelton10 years ago2729*/
1f817868Vladimir Kotikov9 years ago2730MODE_DROPDOWN: string
2731
2732Item?: PickerItemStatic
2733}
2734
2735/**
2736* @see https://facebook.github.io/react-native/docs/pickerios.html
2737* @see PickerIOS.ios.js
2738*/
2739export interface PickerIOSProperties extends ViewProperties, React.Props<PickerIOSStatic> {
2740
2741itemStyle?: TextStyle
2742onValueChange?: ( value: string | number ) => void
2743selectedValue?: string | number
2744
2745ref?: Ref<PickerIOSStatic & ViewStatic>
2746}
2747
2748/**
2749* @see https://facebook.github.io/react-native/docs/pickerios.html
2750* @see PickerIOS.ios.js
2751*/
2752export interface PickerIOSStatic extends NativeMethodsMixin, React.ClassicComponentClass<PickerIOSProperties> {
2753Item: PickerIOSItemStatic
2754}
2755
2756/**
2757* @see https://facebook.github.io/react-native/docs/progressbarandroid.html
2758* @see ProgressBarAndroid.android.js
2759*/
2760export interface ProgressBarAndroidProperties extends ViewProperties, React.Props<ProgressBarAndroidStatic> {
d24fea86Joshua Skelton10 years ago2761
2762/**
1f817868Vladimir Kotikov9 years ago2763* Style of the ProgressBar. One of:
2764Horizontal
2765Normal (default)
2766Small
2767Large
2768Inverse
2769SmallInverse
2770LargeInverse
d24fea86Joshua Skelton10 years ago2771*/
1f817868Vladimir Kotikov9 years ago2772styleAttr?: "Horizontal" | "Normal" | "Small" | "Large" | "Inverse" | "SmallInverse" | "LargeInverse"
d24fea86Joshua Skelton10 years ago2773
2774/**
1f817868Vladimir Kotikov9 years ago2775* If the progress bar will show indeterminate progress.
2776* Note that this can only be false if styleAttr is Horizontal.
d24fea86Joshua Skelton10 years ago2777*/
1f817868Vladimir Kotikov9 years ago2778indeterminate?: boolean
d24fea86Joshua Skelton10 years ago2779
2780/**
1f817868Vladimir Kotikov9 years ago2781* The progress value (between 0 and 1).
d24fea86Joshua Skelton10 years ago2782*/
1f817868Vladimir Kotikov9 years ago2783progress?: number
d24fea86Joshua Skelton10 years ago2784
2785/**
1f817868Vladimir Kotikov9 years ago2786* Color of the progress bar.
d24fea86Joshua Skelton10 years ago2787*/
1f817868Vladimir Kotikov9 years ago2788color?: string
d24fea86Joshua Skelton10 years ago2789
2790/**
1f817868Vladimir Kotikov9 years ago2791* Used to locate this view in end-to-end tests.
d24fea86Joshua Skelton10 years ago2792*/
1f817868Vladimir Kotikov9 years ago2793testID?: string
d24fea86Joshua Skelton10 years ago2794
1f817868Vladimir Kotikov9 years ago2795ref?: Ref<ProgressBarAndroidStatic & ViewProperties>
d24fea86Joshua Skelton10 years ago2796}
2797
1f817868Vladimir Kotikov9 years ago2798/**
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*/
2802export interface ProgressBarAndroidStatic extends NativeMethodsMixin, React.ClassicComponentClass<ProgressBarAndroidProperties> {}
d24fea86Joshua Skelton10 years ago2803
2804/**
1f817868Vladimir Kotikov9 years ago2805* @see https://facebook.github.io/react-native/docs/progressviewios.html
2806* @see ProgressViewIOS.ios.js
d24fea86Joshua Skelton10 years ago2807*/
1f817868Vladimir Kotikov9 years ago2808export interface ProgressViewIOSProperties extends ViewProperties, React.Props<ProgressViewIOSStatic> {
d24fea86Joshua Skelton10 years ago2809
2810/**
1f817868Vladimir Kotikov9 years ago2811* The progress bar style.
d24fea86Joshua Skelton10 years ago2812*/
1f817868Vladimir Kotikov9 years ago2813progressViewStyle?: "default" | "bar"
d24fea86Joshua Skelton10 years ago2814
2815/**
1f817868Vladimir Kotikov9 years ago2816* The progress value (between 0 and 1).
d24fea86Joshua Skelton10 years ago2817*/
1f817868Vladimir Kotikov9 years ago2818progress?: number
d24fea86Joshua Skelton10 years ago2819
2820/**
1f817868Vladimir Kotikov9 years ago2821* The tint color of the progress bar itself.
d24fea86Joshua Skelton10 years ago2822*/
1f817868Vladimir Kotikov9 years ago2823progressTintColor?: string
d24fea86Joshua Skelton10 years ago2824
2825/**
1f817868Vladimir Kotikov9 years ago2826* The tint color of the progress bar track.
d24fea86Joshua Skelton10 years ago2827*/
1f817868Vladimir Kotikov9 years ago2828trackTintColor?: string
d24fea86Joshua Skelton10 years ago2829
2830/**
1f817868Vladimir Kotikov9 years ago2831* A stretchable image to display as the progress bar.
d24fea86Joshua Skelton10 years ago2832*/
1f817868Vladimir Kotikov9 years ago2833progressImage?: ImageURISource | ImageURISource[]
d24fea86Joshua Skelton10 years ago2834
2835/**
1f817868Vladimir Kotikov9 years ago2836* A stretchable image to display behind the progress bar.
d24fea86Joshua Skelton10 years ago2837*/
1f817868Vladimir Kotikov9 years ago2838trackImage?: ImageURISource | ImageURISource[]
d24fea86Joshua Skelton10 years ago2839
1f817868Vladimir Kotikov9 years ago2840ref?: Ref<ProgressViewIOSStatic & ViewStatic>
2841}
d24fea86Joshua Skelton10 years ago2842
1f817868Vladimir Kotikov9 years ago2843export interface ProgressViewIOSStatic extends NativeMethodsMixin, React.ClassicComponentClass<ProgressViewIOSProperties> {}
2844
2845export interface RefreshControlPropertiesIOS extends ViewProperties, React.Props<RefreshControlStatic> {
d24fea86Joshua Skelton10 years ago2846
2847/**
1f817868Vladimir Kotikov9 years ago2848* The color of the refresh indicator.
d24fea86Joshua Skelton10 years ago2849*/
1f817868Vladimir Kotikov9 years ago2850tintColor?: string
d24fea86Joshua Skelton10 years ago2851
1f817868Vladimir Kotikov9 years ago2852/**
2853* The title displayed under the refresh indicator.
2854*/
2855title?: string
d24fea86Joshua Skelton10 years ago2856
1f817868Vladimir Kotikov9 years ago2857/**
2858* Title color.
2859*/
2860titleColor?: string
d24fea86Joshua Skelton10 years ago2861
1f817868Vladimir Kotikov9 years ago2862ref?: Ref<RefreshControlStatic & ViewStatic>
d24fea86Joshua Skelton10 years ago2863}
2864
1f817868Vladimir Kotikov9 years ago2865export interface RefreshControlPropertiesAndroid extends ViewProperties, React.Props<RefreshControlStatic> {
d24fea86Joshua Skelton10 years ago2866
2867/**
1f817868Vladimir Kotikov9 years ago2868* The colors (at least one) that will be used to draw the refresh indicator.
d24fea86Joshua Skelton10 years ago2869*/
1f817868Vladimir Kotikov9 years ago2870colors?: string[]
d24fea86Joshua Skelton10 years ago2871
2872/**
1f817868Vladimir Kotikov9 years ago2873* Whether the pull to refresh functionality is enabled.
d24fea86Joshua Skelton10 years ago2874*/
1f817868Vladimir Kotikov9 years ago2875enabled?: boolean
d24fea86Joshua Skelton10 years ago2876
2877/**
1f817868Vladimir Kotikov9 years ago2878* The background color of the refresh indicator.
d24fea86Joshua Skelton10 years ago2879*/
1f817868Vladimir Kotikov9 years ago2880progressBackgroundColor?: string
d24fea86Joshua Skelton10 years ago2881
2882/**
1f817868Vladimir Kotikov9 years ago2883* Size of the refresh indicator, see RefreshControl.SIZE.
d24fea86Joshua Skelton10 years ago2884*/
1f817868Vladimir Kotikov9 years ago2885size?: number
d24fea86Joshua Skelton10 years ago2886
2887/**
1f817868Vladimir Kotikov9 years ago2888* Progress view top offset
2889* @platform android
d24fea86Joshua Skelton10 years ago2890*/
1f817868Vladimir Kotikov9 years ago2891progressViewOffset?: number
d24fea86Joshua Skelton10 years ago2892
1f817868Vladimir Kotikov9 years ago2893ref?: Ref<RefreshControlStatic & ViewStatic>
d24fea86Joshua Skelton10 years ago2894}
2895
1f817868Vladimir Kotikov9 years ago2896export interface RefreshControlProperties extends RefreshControlPropertiesIOS, RefreshControlPropertiesAndroid, React.Props<RefreshControl> {
d24fea86Joshua Skelton10 years ago2897
2898/**
1f817868Vladimir Kotikov9 years ago2899* Called when the view starts refreshing.
d24fea86Joshua Skelton10 years ago2900*/
1f817868Vladimir Kotikov9 years ago2901onRefresh?: () => void
2902
2903/**
2904* Whether the view should be indicating an active refresh.
2905*/
2906refreshing: boolean
2907
2908ref?: Ref<RefreshControlStatic>
d24fea86Joshua Skelton10 years ago2909}
2910
2911/**
1f817868Vladimir Kotikov9 years ago2912* 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 ago2915*
1f817868Vladimir Kotikov9 years ago2916* ### 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 ago2955*/
1f817868Vladimir Kotikov9 years ago2956export interface RefreshControlStatic extends NativeMethodsMixin, React.ClassicComponentClass<RefreshControlProperties> {
2957SIZE: Object // Undocumented
d24fea86Joshua Skelton10 years ago2958}
2959
1f817868Vladimir Kotikov9 years ago2960export interface RecyclerViewBackedScrollViewProperties extends ScrollViewProperties, React.Props<RecyclerViewBackedScrollViewStatic> {
2961ref?: Ref<RecyclerViewBackedScrollViewProperties & ScrollViewProperties>
d24fea86Joshua Skelton10 years ago2962}
2963
2964/**
1f817868Vladimir Kotikov9 years ago2965* Wrapper around android native recycler view.
d24fea86Joshua Skelton10 years ago2966*
1f817868Vladimir Kotikov9 years ago2967* 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 ago2972*
1f817868Vladimir Kotikov9 years ago2973* 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 ago2977*/
1f817868Vladimir Kotikov9 years ago2978export interface RecyclerViewBackedScrollViewStatic extends ScrollResponderMixin, React.ClassicComponentClass<RecyclerViewBackedScrollViewProperties> {
d24fea86Joshua Skelton10 years ago2979
1f817868Vladimir Kotikov9 years ago2980/**
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*/
2991scrollTo(
2992y?: number | { x?: number, y?: number, animated?: boolean },
2993x?: number,
2994animated?: boolean
2995): void;
d24fea86Joshua Skelton10 years ago2996
1f817868Vladimir Kotikov9 years ago2997/**
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*/
3003getScrollResponder(): JSX.Element;
d24fea86Joshua Skelton10 years ago3004}
3005
1f817868Vladimir Kotikov9 years ago3006export interface SliderPropertiesIOS extends ViewProperties, React.Props<SliderStatic> {
d24fea86Joshua Skelton10 years ago3007
1f817868Vladimir Kotikov9 years ago3008/**
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*/
3012maximumTrackImage?: ImageURISource
d24fea86Joshua Skelton10 years ago3013
1f817868Vladimir Kotikov9 years ago3014/**
3015* The color used for the track to the right of the button.
3016* Overrides the default blue gradient image.
3017*/
3018maximumTrackTintColor?: string
d24fea86Joshua Skelton10 years ago3019
1f817868Vladimir Kotikov9 years ago3020/**
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*/
3024minimumTrackImage?: ImageURISource
d24fea86Joshua Skelton10 years ago3025
1f817868Vladimir Kotikov9 years ago3026/**
3027* The color used for the track to the left of the button.
3028* Overrides the default blue gradient image.
3029*/
3030minimumTrackTintColor?: string
d24fea86Joshua Skelton10 years ago3031
1f817868Vladimir Kotikov9 years ago3032/**
3033* Sets an image for the thumb. Only static images are supported.
3034*/
3035thumbImage?: ImageURISource
d24fea86Joshua Skelton10 years ago3036
1f817868Vladimir Kotikov9 years ago3037/**
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*/
3042trackImage?: ImageURISource
d24fea86Joshua Skelton10 years ago3043
1f817868Vladimir Kotikov9 years ago3044ref?: Ref<SliderStatic>
d24fea86Joshua Skelton10 years ago3045}
3046
1f817868Vladimir Kotikov9 years ago3047export interface SliderProperties extends SliderPropertiesIOS, React.Props<SliderStatic> {
d24fea86Joshua Skelton10 years ago3048
3049/**
1f817868Vladimir Kotikov9 years ago3050* If true the user won't be able to move the slider.
3051* Default value is false.
d24fea86Joshua Skelton10 years ago3052*/
1f817868Vladimir Kotikov9 years ago3053disabled?: boolean
3054
d24fea86Joshua Skelton10 years ago3055/**
1f817868Vladimir Kotikov9 years ago3056* Initial maximum value of the slider. Default value is 1.
d24fea86Joshua Skelton10 years ago3057*/
1f817868Vladimir Kotikov9 years ago3058maximumValue?: number
d24fea86Joshua Skelton10 years ago3059
3060/**
1f817868Vladimir Kotikov9 years ago3061* Initial minimum value of the slider. Default value is 0.
d24fea86Joshua Skelton10 years ago3062*/
1f817868Vladimir Kotikov9 years ago3063minimumValue?: number
d24fea86Joshua Skelton10 years ago3064
3065/**
1f817868Vladimir Kotikov9 years ago3066* Callback called when the user finishes changing the value (e.g. when the slider is released).
3067* @param value
d24fea86Joshua Skelton10 years ago3068*/
1f817868Vladimir Kotikov9 years ago3069onSlidingComplete?: (value: number) => void
d24fea86Joshua Skelton10 years ago3070
3071/**
1f817868Vladimir Kotikov9 years ago3072* Callback continuously called while the user is dragging the slider.
3073* @param value
d24fea86Joshua Skelton10 years ago3074*/
1f817868Vladimir Kotikov9 years ago3075onValueChange?: (value: number) => void
d24fea86Joshua Skelton10 years ago3076
3077/**
1f817868Vladimir Kotikov9 years ago3078* Step value of the slider. The value should be between 0 and (maximumValue - minimumValue). Default value is 0.
d24fea86Joshua Skelton10 years ago3079*/
1f817868Vladimir Kotikov9 years ago3080step?: number
d24fea86Joshua Skelton10 years ago3081
3082/**
1f817868Vladimir Kotikov9 years ago3083* Used to style and layout the Slider. See StyleSheet.js and ViewStylePropTypes.js for more info.
d24fea86Joshua Skelton10 years ago3084*/
1f817868Vladimir Kotikov9 years ago3085style?: ViewStyle
d24fea86Joshua Skelton10 years ago3086
3087/**
1f817868Vladimir Kotikov9 years ago3088* Used to locate this view in UI automation tests.
d24fea86Joshua Skelton10 years ago3089*/
1f817868Vladimir Kotikov9 years ago3090testID?: string
d24fea86Joshua Skelton10 years ago3091
3092/**
1f817868Vladimir Kotikov9 years ago3093* 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 ago3098*/
1f817868Vladimir Kotikov9 years ago3099value?: number
d24fea86Joshua Skelton10 years ago3100}
3101
3102/**
1f817868Vladimir Kotikov9 years ago3103* A component used to select a single value from a range of values.
d24fea86Joshua Skelton10 years ago3104*/
1f817868Vladimir Kotikov9 years ago3105export interface SliderStatic extends NativeMethodsMixin, React.ClassicComponentClass<SliderProperties> {}
d24fea86Joshua Skelton10 years ago3106
1f817868Vladimir Kotikov9 years ago3107/**
3108* https://facebook.github.io/react-native/docs/switchios.html#props
3109*/
3110export interface SwitchIOSProperties extends ViewProperties, React.Props<SwitchIOSStatic> {
d24fea86Joshua Skelton10 years ago3111
3112/**
1f817868Vladimir Kotikov9 years ago3113* If true the user won't be able to toggle the switch. Default value is false.
d24fea86Joshua Skelton10 years ago3114*/
1f817868Vladimir Kotikov9 years ago3115disabled?: boolean
d24fea86Joshua Skelton10 years ago3116
3117/**
1f817868Vladimir Kotikov9 years ago3118* Background color when the switch is turned on.
d24fea86Joshua Skelton10 years ago3119*/
1f817868Vladimir Kotikov9 years ago3120onTintColor?: string
d24fea86Joshua Skelton10 years ago3121
3122/**
1f817868Vladimir Kotikov9 years ago3123* Callback that is called when the user toggles the switch.
d24fea86Joshua Skelton10 years ago3124*/
1f817868Vladimir Kotikov9 years ago3125onValueChange?: ( value: boolean ) => void
d24fea86Joshua Skelton10 years ago3126
3127/**
1f817868Vladimir Kotikov9 years ago3128* Background color for the switch round button.
d24fea86Joshua Skelton10 years ago3129*/
1f817868Vladimir Kotikov9 years ago3130thumbTintColor?: string
d24fea86Joshua Skelton10 years ago3131
3132/**
1f817868Vladimir Kotikov9 years ago3133* Background color when the switch is turned off.
d24fea86Joshua Skelton10 years ago3134*/
1f817868Vladimir Kotikov9 years ago3135tintColor?: string
d24fea86Joshua Skelton10 years ago3136
3137/**
1f817868Vladimir Kotikov9 years ago3138* The value of the switch, if true the switch will be turned on. Default value is false.
d24fea86Joshua Skelton10 years ago3139*/
1f817868Vladimir Kotikov9 years ago3140value?: boolean
d24fea86Joshua Skelton10 years ago3141
1f817868Vladimir Kotikov9 years ago3142ref?: Ref<SwitchIOSStatic>
3143}
d24fea86Joshua Skelton10 years ago3144
1f817868Vladimir Kotikov9 years ago3145/**
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*/
3154export interface SwitchIOSStatic extends React.ComponentClass<SwitchIOSProperties> {
d24fea86Joshua Skelton10 years ago3155
1f817868Vladimir Kotikov9 years ago3156}
d24fea86Joshua Skelton10 years ago3157
1f817868Vladimir Kotikov9 years ago3158export type ImageResizeMode = "contain" | "cover" | "stretch" | "center" | "repeat"
3159
3160/**
3161* @see ImageResizeMode.js
3162*/
3163export interface ImageResizeModeStatic {
d24fea86Joshua Skelton10 years ago3164/**
1f817868Vladimir Kotikov9 years ago3165* contain - The image will be resized such that it will be completely
3166* visible, contained within the frame of the View.
d24fea86Joshua Skelton10 years ago3167*/
1f817868Vladimir Kotikov9 years ago3168contain: ImageResizeMode
d24fea86Joshua Skelton10 years ago3169/**
1f817868Vladimir Kotikov9 years ago3170* 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 ago3172*/
1f817868Vladimir Kotikov9 years ago3173cover: ImageResizeMode
d24fea86Joshua Skelton10 years ago3174/**
1f817868Vladimir Kotikov9 years ago3175* 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 ago3178*/
1f817868Vladimir Kotikov9 years ago3179stretch: ImageResizeMode
d24fea86Joshua Skelton10 years ago3180/**
1f817868Vladimir Kotikov9 years ago3181* 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 ago3184*/
1f817868Vladimir Kotikov9 years ago3185center: ImageResizeMode,
d24fea86Joshua Skelton10 years ago3186
3187/**
1f817868Vladimir Kotikov9 years ago3188* 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 ago3190*/
1f817868Vladimir Kotikov9 years ago3191repeat: ImageResizeMode,
d24fea86Joshua Skelton10 years ago3192}
3193
1f817868Vladimir Kotikov9 years ago3194export interface ShadowStyleIOS {
3195shadowColor?: string
3196shadowOffset?: {width: number, height: number}
3197shadowOpacity?: number
3198shadowRadius?: number
d24fea86Joshua Skelton10 years ago3199}
3200
3201/**
1f817868Vladimir Kotikov9 years ago3202* Image style
3203* @see https://facebook.github.io/react-native/docs/image.html#style
d24fea86Joshua Skelton10 years ago3204*/
1f817868Vladimir Kotikov9 years ago3205export interface ImageStyle extends FlexStyle, TransformsStyle, ShadowStyleIOS {
3206resizeMode?: React.ImageResizeMode
3207backfaceVisibility?: "visible" | "hidden"
3208borderBottomLeftRadius?: number
3209borderBottomRightRadius?: number
3210backgroundColor?: string
3211borderColor?: string
3212borderWidth?: number
3213borderRadius?: number
3214borderTopLeftRadius?: number
3215borderTopRightRadius?: number
3216overflow?: "visible" | "hidden"
3217overlayColor?: string
3218tintColor?: string
3219opacity?: number
d24fea86Joshua Skelton10 years ago3220}
3221
1f817868Vladimir Kotikov9 years ago3222export interface ImagePropertiesIOS {
d24fea86Joshua Skelton10 years ago3223/**
1f817868Vladimir Kotikov9 years ago3224* The text that's read by the screen reader when the user interacts with the image.
d24fea86Joshua Skelton10 years ago3225*/
1f817868Vladimir Kotikov9 years ago3226accessibilityLabel?: string;
d24fea86Joshua Skelton10 years ago3227
3228/**
1f817868Vladimir Kotikov9 years ago3229* When true, indicates the image is an accessibility element.
d24fea86Joshua Skelton10 years ago3230*/
1f817868Vladimir Kotikov9 years ago3231accessible?: boolean;
d24fea86Joshua Skelton10 years ago3232
3233/**
1f817868Vladimir Kotikov9 years ago3234* blurRadius: the blur radius of the blur filter added to the image
3235* @platform ios
3236*/
3237blurRadius?: number,
d24fea86Joshua Skelton10 years ago3238
3239/**
1f817868Vladimir Kotikov9 years ago3240* 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 ago3244*/
1f817868Vladimir Kotikov9 years ago3245capInsets?: Insets
d24fea86Joshua Skelton10 years ago3246
3247/**
1f817868Vladimir Kotikov9 years ago3248* A static image to display while downloading the final image off the network.
d24fea86Joshua Skelton10 years ago3249*/
1f817868Vladimir Kotikov9 years ago3250defaultSource?: ImageURISource | number
d24fea86Joshua Skelton10 years ago3251
3252/**
1f817868Vladimir Kotikov9 years ago3253* Invoked on load error with {nativeEvent: {error}}
d24fea86Joshua Skelton10 years ago3254*/
1f817868Vladimir Kotikov9 years ago3255onError?: ( error: {nativeEvent: any} ) => void
d24fea86Joshua Skelton10 years ago3256
3257/**
1f817868Vladimir Kotikov9 years ago3258* Invoked on download progress with {nativeEvent: {loaded, total}}
d24fea86Joshua Skelton10 years ago3259*/
1f817868Vladimir Kotikov9 years ago3260onProgress?: ()=> void
d24fea86Joshua Skelton10 years ago3261
3262/**
1f817868Vladimir Kotikov9 years ago3263* 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 ago3267*/
1f817868Vladimir Kotikov9 years ago3268onPartialLoad?: () => void,
d24fea86Joshua Skelton10 years ago3269}
3270
1f817868Vladimir Kotikov9 years ago3271/*
3272* @see https://github.com/facebook/react-native/blob/master/Libraries/Image/ImageSourcePropType.js
d24fea86Joshua Skelton10 years ago3273*/
1f817868Vladimir Kotikov9 years ago3274interface ImageURISource {
d24fea86Joshua Skelton10 years ago3275/**
1f817868Vladimir Kotikov9 years ago3276* `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 ago3280*/
1f817868Vladimir Kotikov9 years ago3281uri?: string,
d24fea86Joshua Skelton10 years ago3282/**
1f817868Vladimir Kotikov9 years ago3283* `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 ago3286*/
1f817868Vladimir Kotikov9 years ago3287bundle?: string,
d24fea86Joshua Skelton10 years ago3288/**
1f817868Vladimir Kotikov9 years ago3289* `method` is the HTTP Method to use. Defaults to GET if not specified.
d24fea86Joshua Skelton10 years ago3290*/
1f817868Vladimir Kotikov9 years ago3291method?: string,
d24fea86Joshua Skelton10 years ago3292/**
1f817868Vladimir Kotikov9 years ago3293* `headers` is an object representing the HTTP headers to send along with the
3294* request for a remote image.
d24fea86Joshua Skelton10 years ago3295*/
1f817868Vladimir Kotikov9 years ago3296headers?: {[key: string]: string},
d24fea86Joshua Skelton10 years ago3297/**
1f817868Vladimir Kotikov9 years ago3298* `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 ago3301*/
1f817868Vladimir Kotikov9 years ago3302body?: string,
d24fea86Joshua Skelton10 years ago3303/**
1f817868Vladimir Kotikov9 years ago3304* `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 ago3306*/
1f817868Vladimir Kotikov9 years ago3307width?: number,
3308height?: number,
d24fea86Joshua Skelton10 years ago3309/**
1f817868Vladimir Kotikov9 years ago3310* `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 ago3312*/
1f817868Vladimir Kotikov9 years ago3313scale?: number,
d24fea86Joshua Skelton10 years ago3314}
3315
3316/**
1f817868Vladimir Kotikov9 years ago3317* @see https://facebook.github.io/react-native/docs/image.html
d24fea86Joshua Skelton10 years ago3318*/
1f817868Vladimir Kotikov9 years ago3319export interface ImageProperties extends ImagePropertiesIOS, React.Props<Image> {
3320fadeDuration?: number
d24fea86Joshua Skelton10 years ago3321/**
1f817868Vladimir Kotikov9 years ago3322* onLayout function
3323*
3324* Invoked on mount and layout changes with
3325*
3326* {nativeEvent: { layout: {x, y, width, height}}}.
d24fea86Joshua Skelton10 years ago3327*/
1f817868Vladimir Kotikov9 years ago3328onLayout?: ( event: LayoutChangeEvent ) => void;
d24fea86Joshua Skelton10 years ago3329
3330/**
1f817868Vladimir Kotikov9 years ago3331* Invoked when load completes successfully
d24fea86Joshua Skelton10 years ago3332*/
1f817868Vladimir Kotikov9 years ago3333onLoad?: () => void
d24fea86Joshua Skelton10 years ago3334
3335/**
1f817868Vladimir Kotikov9 years ago3336* Invoked when load either succeeds or fails
d24fea86Joshua Skelton10 years ago3337*/
1f817868Vladimir Kotikov9 years ago3338onLoadEnd?: () => void
d24fea86Joshua Skelton10 years ago3339
1f817868Vladimir Kotikov9 years ago3340/**
3341* Invoked on load start
3342*/
3343onLoadStart?: () => void
d24fea86Joshua Skelton10 years ago3344
1f817868Vladimir Kotikov9 years ago3345progressiveRenderingEnabled?: boolean
d24fea86Joshua Skelton10 years ago3346
3347/**
1f817868Vladimir Kotikov9 years ago3348* 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 ago3365*/
1f817868Vladimir Kotikov9 years ago3366resizeMode?: 'cover' |'contain' |'stretch' |'center'
3367
d24fea86Joshua Skelton10 years ago3368/**
1f817868Vladimir Kotikov9 years ago3369* 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 ago3386*/
1f817868Vladimir Kotikov9 years ago3387resizeMethod?: 'auto' | 'resize' | 'scale'
d24fea86Joshua Skelton10 years ago3388
3389/**
1f817868Vladimir Kotikov9 years ago3390* `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 ago3396*/
1f817868Vladimir Kotikov9 years ago3397// source: {uri: string} | number | {uri: string, width: number, height: number}[];
3398
3399source: ImageURISource | ImageURISource[]
d24fea86Joshua Skelton10 years ago3400
3401/**
1f817868Vladimir Kotikov9 years ago3402* 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 ago3405*/
1f817868Vladimir Kotikov9 years ago3406loadingIndicatorSource?: ImageURISource;
3407
d24fea86Joshua Skelton10 years ago3408/**
1f817868Vladimir Kotikov9 years ago3409*
3410* Style
d24fea86Joshua Skelton10 years ago3411*/
1f817868Vladimir Kotikov9 years ago3412style?: ImageStyle;
d24fea86Joshua Skelton10 years ago3413
3414/**
1f817868Vladimir Kotikov9 years ago3415* A unique identifier for this element to be used in UI Automation testing scripts.
d24fea86Joshua Skelton10 years ago3416*/
1f817868Vladimir Kotikov9 years ago3417testID?: string;
3418
3419}
3420
3421export interface ImageStatic extends React.NativeMethodsMixin, React.ComponentClass<ImageProperties> {
3422resizeMode: ImageResizeMode
3423getSize(uri: string, success: (width: number, height: number) => void, failure: (error: any) => void): any
3424prefetch(url: string): any
3425abortPrefetch?(requestId: number): void
3426queryCache?(urls: string[]): Promise<Map<string, 'memory' | 'disk'>>
3427}
3428
3429/**
3430* @see https://facebook.github.io/react-native/docs/listview.html#props
3431*/
3432export interface ListViewProperties extends ScrollViewProperties, React.Props<ListViewStatic> {
d24fea86Joshua Skelton10 years ago3433
3434/**
1f817868Vladimir Kotikov9 years ago3435* An instance of [ListView.DataSource](docs/listviewdatasource.html) to use
d24fea86Joshua Skelton10 years ago3436*/
1f817868Vladimir Kotikov9 years ago3437dataSource: ListViewDataSource
d24fea86Joshua Skelton10 years ago3438
3439/**
1f817868Vladimir Kotikov9 years ago3440* 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 ago3445*/
1f817868Vladimir Kotikov9 years ago3446enableEmptySections?: boolean
d24fea86Joshua Skelton10 years ago3447
3448/**
1f817868Vladimir Kotikov9 years ago3449* 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 ago3452*/
1f817868Vladimir Kotikov9 years ago3453initialListSize?: number
d24fea86Joshua Skelton10 years ago3454
3455/**
1f817868Vladimir Kotikov9 years ago3456* (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 ago3463*/
1f817868Vladimir Kotikov9 years ago3464onChangeVisibleRows?: ( visibleRows: Array<{[sectionId: string]: {[rowID: string]: boolean}}>, changedRows: Array<{[sectionId: string]: {[rowID: string]: boolean}}> ) => void
d24fea86Joshua Skelton10 years ago3465
3466/**
1f817868Vladimir Kotikov9 years ago3467* 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 ago3470*/
1f817868Vladimir Kotikov9 years ago3471onEndReached?: () => void
d24fea86Joshua Skelton10 years ago3472
3473/**
1f817868Vladimir Kotikov9 years ago3474* Threshold in pixels for onEndReached.
d24fea86Joshua Skelton10 years ago3475*/
1f817868Vladimir Kotikov9 years ago3476onEndReachedThreshold?: number
d24fea86Joshua Skelton10 years ago3477
3478/**
1f817868Vladimir Kotikov9 years ago3479* Number of rows to render per event loop.
d24fea86Joshua Skelton10 years ago3480*/
1f817868Vladimir Kotikov9 years ago3481pageSize?: number
d24fea86Joshua Skelton10 years ago3482
3483/**
1f817868Vladimir Kotikov9 years ago3484* 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 ago3487*/
1f817868Vladimir Kotikov9 years ago3488removeClippedSubviews?: boolean
d24fea86Joshua Skelton10 years ago3489
3490/**
1f817868Vladimir Kotikov9 years ago3491* () => 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 ago3497*/
1f817868Vladimir Kotikov9 years ago3498renderFooter?: () => React.ReactElement<any>
d24fea86Joshua Skelton10 years ago3499
3500/**
1f817868Vladimir Kotikov9 years ago3501* () => 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 ago3507*/
1f817868Vladimir Kotikov9 years ago3508renderHeader?: () => React.ReactElement<any>
d24fea86Joshua Skelton10 years ago3509
3510/**
1f817868Vladimir Kotikov9 years ago3511* (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 ago3516*/
1f817868Vladimir Kotikov9 years ago3517renderRow: ( rowData: any, sectionID: string | number, rowID: string | number, highlightRow?: boolean ) => React.ReactElement<any>
3518
d24fea86Joshua Skelton10 years ago3519
3520/**
1f817868Vladimir Kotikov9 years ago3521* 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 ago3523*/
1f817868Vladimir Kotikov9 years ago3524renderScrollComponent?: ( props: ScrollViewProperties ) => React.ReactElement<ScrollViewProperties>
d24fea86Joshua Skelton10 years ago3525
3526/**
1f817868Vladimir Kotikov9 years ago3527* (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 ago3534*/
1f817868Vladimir Kotikov9 years ago3535renderSectionHeader?: ( sectionData: any, sectionId: string | number ) => React.ReactElement<any>
3536
d24fea86Joshua Skelton10 years ago3537
3538/**
1f817868Vladimir Kotikov9 years ago3539* (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 ago3543*/
1f817868Vladimir Kotikov9 years ago3544renderSeparator?: ( sectionID: string | number, rowID: string | number, adjacentRowHighlighted?: boolean ) => React.ReactElement<any>
d24fea86Joshua Skelton10 years ago3545
3546/**
1f817868Vladimir Kotikov9 years ago3547* How early to start rendering rows before they come on screen, in
3548* pixels.
d24fea86Joshua Skelton10 years ago3549*/
1f817868Vladimir Kotikov9 years ago3550scrollRenderAheadDistance?: number
d24fea86Joshua Skelton10 years ago3551
3552/**
3553* An array of child indices determining which children get docked to the
1f817868Vladimir Kotikov9 years ago3554* top of the screen when scrolling. For example, passing
d24fea86Joshua Skelton10 years ago3555* `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 ago3558* @platform ios
d24fea86Joshua Skelton10 years ago3559*/
3560stickyHeaderIndices?: number[]
3561
1f817868Vladimir Kotikov9 years ago3562ref?: Ref<ListViewStatic & ScrollViewStatic & ViewStatic>
3563}
3564
3565
3566interface TimerMixin {
3567setTimeout: typeof setTimeout,
3568clearTimeout: typeof clearTimeout,
3569setInterval: typeof setInterval,
3570clearInterval: typeof clearInterval,
3571setImmediate: typeof setImmediate,
3572clearImmediate: typeof clearImmediate,
3573requestAnimationFrame: typeof requestAnimationFrame,
3574cancelAnimationFrame: typeof cancelAnimationFrame,
d24fea86Joshua Skelton10 years ago3575}
3576
1f817868Vladimir Kotikov9 years ago3577export interface ListViewStatic extends ScrollResponderMixin, TimerMixin, React.ComponentClass<ListViewProperties> {
3578DataSource: ListViewDataSource;
d24fea86Joshua Skelton10 years ago3579
3580/**
1f817868Vladimir Kotikov9 years ago3581* Exports some data, e.g. for perf investigations or analytics.
d24fea86Joshua Skelton10 years ago3582*/
1f817868Vladimir Kotikov9 years ago3583getMetrics: () => {
3584contentLength: number,
3585totalRows: number,
3586renderedRows: number,
3587visibleRows: number,
3588}
d24fea86Joshua Skelton10 years ago3589
3590/**
1f817868Vladimir Kotikov9 years ago3591* Provides a handle to the underlying scroll responder.
d24fea86Joshua Skelton10 years ago3592*/
1f817868Vladimir Kotikov9 years ago3593getScrollResponder: () => any,
d24fea86Joshua Skelton10 years ago3594
3595/**
1f817868Vladimir Kotikov9 years ago3596* Scrolls to a given x, y offset, either immediately or with a smooth animation.
3597*
3598* See `ScrollView#scrollTo`.
3599*/
3600scrollTo: ( y?: number | { x?: number, y?: number, animated?: boolean } , x?: number, animated?: boolean ) => void,
3601}
3602
3603export interface MapViewAnnotation {
3604latitude: number
3605longitude: number
3606animateDrop?: boolean
3607draggable?: boolean
3608onDragStateChange?: () => any,
3609onFocus?: () => any,
3610onBlur?: () => any,
3611title?: string
3612subtitle?: string
3613leftCalloutView?: ReactElement<any>
3614rightCalloutView?: ReactElement<any>
3615detailCalloutView?: ReactElement<any>
3616tintColor?: string
3617image?: ImageURISource
3618view?: ReactElement<any>
3619hasLeftCallout?: boolean
3620hasRightCallout?: boolean
3621onLeftCalloutPress?: () => void
3622onRightCalloutPress?: () => void
3623id?: string
3624}
3625
3626export interface MapViewRegion {
3627latitude: number
3628longitude: number
3629latitudeDelta?: number
3630longitudeDelta?: number
3631}
3632
3633export interface MapViewOverlay {
3634coordinates: ({latitude: number, longitude: number})[]
3635lineWidth?: number
3636strokeColor?: string
3637fillColor?: string
3638id?: string
3639}
3640
3641export 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*/
3648showsPointsOfInterest?: 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*/
3655followUserLocation?: boolean
3656
3657/**
3658* Map overlays
3659*/
3660overlays?: MapViewOverlay[]
3661
3662/**
3663* If false compass won't be displayed on the map.
3664* Default value is true.
3665*/
3666showsCompass?: boolean
3667
3668/**
3669* Map annotations with title/subtitle.
3670*/
3671annotations?: 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*/
3676legalLabelInsets?: 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*/
3686mapType?: 'standard' |'satellite' |'hybrid'
3687
3688/**
3689* Maximum size of area that can be displayed.
3690*/
3691maxDelta?: number
3692
3693/**
3694* Minimum size of area that can be displayed.
3695*/
3696minDelta?: number
3697
3698/**
3699* Callback that is called once, when the user taps an annotation.
3700*/
3701onAnnotationPress?: () => void
3702
3703/**
3704* Callback that is called continuously when the user is dragging the map.
3705*/
3706onRegionChange?: ( region: MapViewRegion ) => void
3707
3708/**
3709* Callback that is called once, when the user is done moving the map.
3710*/
3711onRegionChangeComplete?: ( 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*/
3720pitchEnabled?: 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*/
3726region?: 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*/
3735rotateEnabled?: 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*/
3741scrollEnabled?: 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*/
3750showsUserLocation?: boolean
3751
3752/**
3753* If false the user won't be able to pinch/zoom the map.
3754* Default value is true.
3755*/
3756zoomEnabled?: boolean
3757
3758ref?: Ref<MapViewStatic & ViewStatic>
3759}
3760
3761/**
3762* @see https://facebook.github.io/react-native/docs/mapview.html#content
3763*/
3764export interface MapViewStatic extends React.NativeMethodsMixin, React.ComponentClass<MapViewProperties> {
3765PinColors: {
3766RED: string,
3767GREEN: string,
3768PURPLE: string
3769}
3770}
3771
3772export interface ModalProperties extends React.Props<ModalStatic> {
3773
3774// Only `animated` is documented. The JS code says `animated` is
3775// deprecated and `animationType` is preferred.
3776animated?: 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*/
3784animationType?: "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*/
3789transparent?: boolean
3790/**
3791* The `visible` prop determines whether your modal is visible.
3792*/
3793visible?: 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*/
3798onRequestClose?: () => void
3799/**
3800* The `onShow` prop allows passing a function that will be called once the modal has been shown.
3801*/
3802onShow?: (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*/
3808supportedOrientations: ('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*/
3814onOrientationChange: () => void,
3815}
3816
3817export 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*/
3823interface 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*/
3830touchableHandleActivePressIn(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*/
3841touchableHandleActivePressOut(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*/
3848touchableHandlePress(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*/
3860touchableHandleLongPress(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*/
3866touchableGetPressRectOffset(): Insets
3867
3868/**
3869* Returns the number of millis to wait before triggering a highlight.
3870*/
3871touchableGetHighlightDelayMS(): number
3872
3873// These methods are undocumented but still being used by TouchableMixin internals
3874touchableGetLongPressDelayMS(): number
3875touchableGetPressOutDelayMS(): number
2060f3fbVladimir Kotikov9 years ago3876touchableGetHitSlop(): Insets
1f817868Vladimir Kotikov9 years ago3877}
3878
3879export 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*/
3887accessibilityComponentType?: 'none' | 'button' | 'radiobutton_checked' | 'radiobutton_unchecked'
3888}
3889
3890type ViewAccessibilityTraits = 'none' | 'button' | 'link' | 'header' | 'search' | 'image' | 'selected' | 'plays' | 'key' | 'text' | 'summary' | 'disabled' | 'frequentUpdates' | 'startsMedia' | 'adjustable' | 'allowsDirectInteraction' | 'pageTurn'
3891
3892export 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*/
3900accessibilityTraits?: ViewAccessibilityTraits | ViewAccessibilityTraits[]
3901
3902}
3903
3904/**
3905* @see https://facebook.github.io/react-native/docs/touchablewithoutfeedback.html#props
3906*/
3907export 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*/
3913accessible?: boolean
3914
3915/**
3916* Delay in ms, from onPressIn, before onLongPress is called.
3917*/
3918delayLongPress?: number;
3919
3920/**
3921* Delay in ms, from the start of the touch, before onPressIn is called.
3922*/
3923delayPressIn?: number;
3924
3925/**
3926* Delay in ms, from the release of the touch, before onPressOut is called.
3927*/
3928delayPressOut?: number;
3929
3930/**
3931* If true, disable all interactions for this component.
3932*/
3933disabled?: 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*/
3942hitSlop?: Insets
3943
3944/**
3945* Invoked on mount and layout changes with
3946* {nativeEvent: {layout: {x, y, width, height}}}
3947*/
3948onLayout?: ( event: LayoutChangeEvent ) => void
3949
3950onLongPress?: () => 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*/
3956onPress?: () => void;
3957
3958onPressIn?: () => void;
3959
3960onPressOut?: () => void;
3961
3962/**
3963* //FIXME: not in doc but available in examples
3964*/
3965style?: 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*/
3975pressRetentionOffset?: Insets
3976}
3977
3978
3979export 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*/
3988export interface TouchableWithoutFeedbackStatic extends TimerMixin, TouchableMixin, React.ClassicComponentClass<TouchableWithoutFeedbackProps> {}
3989
3990
3991/**
3992* @see https://facebook.github.io/react-native/docs/touchablehighlight.html#props
3993*/
3994export 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*/
3999activeOpacity?: number
4000
4001/**
4002*
4003* Called immediately after the underlay is hidden
4004*/
4005onHideUnderlay?: () => void
4006
4007/**
4008* Called immediately after the underlay is shown
4009*/
4010onShowUnderlay?: () => void
4011
4012/**
4013* @see https://facebook.github.io/react-native/docs/view.html#style
4014*/
4015style?: ViewStyle
4016
4017/**
4018* The color of the underlay that will show through when the touch is active.
4019*/
4020underlayColor?: 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*/
4036export 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*/
4042export 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*/
4047activeOpacity?: 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*/
4058export interface TouchableOpacityStatic extends TimerMixin, TouchableMixin, NativeMethodsMixin, React.ClassicComponentClass<TouchableOpacityProperties> {
4059/**
4060* Animate the touchable to a new opacity.
4061*/
4062setOpacityTo: (value: number) => void
4063}
4064
4065interface BaseBackgroundPropType {
4066type: string
4067}
4068
4069interface RippleBackgroundPropType extends BaseBackgroundPropType {
4070type: 'RippleAndroid'
4071color?: number,
4072borderless?: boolean
4073}
4074
4075interface ThemeAttributeBackgroundPropType extends BaseBackgroundPropType {
4076type: 'ThemeAttrAndroid'
4077attribute: string
4078}
4079
4080type BackgroundPropType = RippleBackgroundPropType & ThemeAttributeBackgroundPropType
4081
4082/**
4083* @see https://facebook.github.io/react-native/docs/touchableopacity.html#props
4084*/
4085export 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*/
4094background?: 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*/
4107export 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*/
4113SelectableBackground(): 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*/
4120SelectableBackgroundBorderless(): 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*/
4132Ripple( color: string, borderless?: boolean ): RippleBackgroundPropType
4133}
4134
4135export interface LeftToRightGesture {
4136// If the gesture can end and restart during one continuous touch
4137isDetachable: boolean;
4138// How far the swipe must drag to start transitioning
4139gestureDetectMovement: number;
4140// Amplitude of release velocity that is considered still
4141notMoving: number;
4142// Fraction of directional move required.
4143directionRatio: number;
4144// Velocity to transition with when the gesture release was "not moving"
4145snapVelocity: number;
4146// Region that can trigger swipe. iOS default is 30px from the left edge
4147edgeHitWidth: number;
4148// Ratio of gesture completion when non-velocity release will cause action
4149stillCompletionRatio: number;
4150fullDistance: any;
4151direction: string;
4152}
4153
4154export interface JumpGesture extends LeftToRightGesture{
4155overswipe: {
4156frictionConstant: number
4157frictionByDistance: number
4158}
4159}
4160
4161// see /NavigatorSceneConfigs.js
4162export interface BaseSceneConfig {
4163// A list of all gestures that are enabled on this scene
4164gestures?: {
4165pop?: LeftToRightGesture,
4166},
4167
4168// Rebound spring parameters when transitioning FROM this scene
4169springFriction: number;
4170springTension: number;
4171
4172// Velocity to start at when transitioning without gesture
4173defaultTransitionVelocity: number;
4174
4175// Animation interpolators for horizontal transitioning:
4176animationInterpolators: {
4177into: () => boolean,
4178out: () => boolean
4179};
4180}
4181
4182export interface JumpSceneConfig extends BaseSceneConfig {
4183gestures: {
4184jumpBack: JumpGesture
4185jumpForward: JumpGesture
4186}
4187}
4188
4189// see /NavigatorSceneConfigs.js
4190export interface SceneConfigs {
4191PushFromRight: BaseSceneConfig;
4192PushFromLeft: BaseSceneConfig;
4193FloatFromRight: BaseSceneConfig;
4194FloatFromLeft: BaseSceneConfig;
4195FloatFromBottom: BaseSceneConfig;
4196FloatFromBottomAndroid: BaseSceneConfig;
4197FadeAndroid: BaseSceneConfig;
4198HorizontalSwipeJump: BaseSceneConfig;
4199HorizontalSwipeJumpFromRight: BaseSceneConfig;
4200VerticalUpSwipeJump: BaseSceneConfig;
4201VerticalDownSwipeJump: BaseSceneConfig;
4202}
4203
4204export interface Route {
4205component?: React.ComponentClass<ViewProperties>
4206id?: string
4207title?: string
4208passProps?: Object;
4209
4210//anything else
4211[key: string]: any
4212
4213//Commonly found properties
4214backButtonTitle?: string
4215content?: string
4216message?: string;
4217index?: number
4218onRightButtonPress?: () => void
4219rightButtonTitle?: string
4220sceneConfig?: BaseSceneConfig
4221wrapperStyle?: any
4222}
4223
4224
4225/**
4226* @see https://facebook.github.io/react-native/docs/navigator.html#content
4227*/
4228export 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*/
4238configureScene?: ( 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*/
4245initialRoute?: 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*/
4251initialRouteStack?: Route[]
4252
4253/**
4254* Optionally provide a navigation bar that persists across scene transitions
4255*/
4256navigationBar?: React.ReactElement<NavigatorStatic.NavigationBarProperties>
4257
4258/**
4259* Optionally provide the navigator object from a parent Navigator
4260*/
4261navigator?: Navigator
4262
4263/**
4264* @deprecated Use navigationContext.addListener('willfocus', callback) instead.
4265*/
4266onDidFocus?: Function
4267
4268/**
4269* @deprecated Use navigationContext.addListener('willfocus', callback) instead.
4270*/
4271onWillFocus?: 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*/
4279renderScene: ( route: Route, navigator: Navigator ) => React.ReactElement<ViewProperties>
4280
4281/**
4282* Styles to apply to the container of each scene
4283*/
4284sceneStyle?: ViewStyle
4285
4286}
4287
4288/**
4289* Class that contains the info and methods for app navigation.
4290*/
4291export interface NavigationContext {
4292parent: NavigationContext;
4293top: NavigationContext;
4294currentRoute: any;
4295appendChild(childContext: NavigationContext): void;
4296addListener(eventType: string, listener: () => void, useCapture?: boolean): NativeEventSubscription;
4297emit(eventType: string, data: any, didEmitCallback?: () => void): void;
4298dispose(): void;
4299}
4300
4301interface InteractionMixin {
4302createInteractionHandle(): number
4303clearInteractionHandle(clearHandle: number): void
4304/**
4305* Schedule work for after all interactions have completed.
4306*
4307* @param {function} callback
4308*/
4309runAfterInteractions(callback: () => any): void
4310}
4311
4312interface 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*/
4326addListenerOn( 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*/
4338export interface NavigatorStatic extends TimerMixin, InteractionMixin, SubscribableMixin, React.ComponentClass<NavigatorProperties> {
4339SceneConfigs: SceneConfigs;
4340NavigationBar: NavigatorStatic.NavigationBarStatic;
4341BreadcrumbNavigationBar: NavigatorStatic.BreadcrumbNavigationBarStatic;
4342
4343navigationContext: NavigationContext;
4344
4345/**
4346* returns the current list of routes
4347*/
4348getCurrentRoutes(): Route[];
4349
4350/**
4351* Jump backward without unmounting the current scen
4352*/
4353jumpBack(): void;
4354
4355/**
4356* Jump forward to the next scene in the route stack
4357*/
4358jumpForward(): void;
4359
4360/**
4361* Transition to an existing scene without unmounting
4362*/
4363jumpTo( route: Route ): void;
4364
4365/**
4366* Navigate forward to a new scene, squashing any scenes that you could jumpForward to
4367*/
4368push( route: Route ): void;
4369
4370/**
4371* Transition back and unmount the current scene
4372*/
4373pop(): 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*/
4380popN(n: number): void
4381
4382/**
4383* Replace the current scene with a new route
4384*/
4385replace( route: Route ): void;
4386
4387/**
4388* Replace a scene as specified by an index
4389*/
4390replaceAtIndex( route: Route, index: number ): void;
4391
4392/**
4393* Replace the previous scene
4394*/
4395replacePrevious( route: Route ): void;
4396
4397/**
4398* Reset every scene with an array of routes
4399*/
4400immediatelyResetRouteStack( routes: Route[] ): void;
4401
4402/**
4403* Pop to a particular scene, as specified by its route. All scenes after it will be unmounted
4404*/
4405popToRoute( route: Route ): void;
4406
4407/**
4408* Pop to the first scene in the stack, unmounting every other scene
4409*/
4410popToTop(): void;
4411
4412/**
4413* Replace the previous scene and pop to it.
4414*/
4415replacePreviousAndPop( route: Route ): void;
4416
4417/**
4418* Navigate to a new scene and reset route stack.
4419*/
4420resetTo( route: Route ): void;
4421
4422}
4423
4424namespace NavigatorStatic {
4425
4426export interface NavState {
4427routeStack: Route[]
4428presentedIndex: number
4429}
4430
4431// @see NavigationBarStyle.ios.js
4432export interface NavigationBarStyle {
4433General: {
4434NavBarHeight: number
4435StatusBarHeight: number
4436TotalNavHeight: number
4437},
4438Interpolators: {
4439// Animating *into* the center stage from the right
4440RightToCenter: () => boolean
4441// Animating out of the center stage, to the left
4442CenterToLeft: () => boolean
4443// Both stages (animating *past* the center stage)
4444RightToLeft: () => boolean
4445},
4446Stages: {
4447Left: {
4448Title: FlexStyle
4449LeftButton: FlexStyle
4450RightButton: FlexStyle
4451},
4452Center: {
4453Title: FlexStyle
4454LeftButton: FlexStyle
4455RightButton: FlexStyle
4456},
4457Right: {
4458Title: FlexStyle
4459LeftButton: FlexStyle
4460RightButton: FlexStyle
4461},
4462}
4463}
4464
4465export interface NavigationBarRouteMapper {
4466Title: ( route: Route, nav: Navigator, index: number, navState: NavState ) => React.ReactElement<any>;
4467LeftButton: ( route: Route, nav: Navigator, index: number, navState: NavState )=> React.ReactElement<any>;
4468RightButton: ( route: Route, nav: Navigator, index: number, navState: NavState )=> React.ReactElement<any>;
4469}
4470
4471/**
4472* @see NavigatorNavigationBar.js
4473*/
4474export interface NavigationBarProperties extends React.Props<NavigationBarStatic> {
4475navigator?: Navigator
4476routeMapper?: NavigationBarRouteMapper
4477navState?: NavState
4478navigationStyles?: NavigationBarStyle
4479style?: ViewStyle
4480}
4481
4482export interface NavigationBarStatic extends React.ComponentClass<NavigationBarProperties> {
4483Styles: NavigationBarStyle
4484StylesAndroid: NavigationBarStyle;
4485StylesIOS: NavigationBarStyle;
4486
4487/**
4488* Stop transtion, immediately resets the cached state and re-render the
4489* whole view.
4490*/
4491immediatelyRefresh(): void;
4492}
4493
4494export type NavigationBar = NavigationBarStatic
4495export var NavigationBar: NavigationBarStatic
4496
4497
4498export interface BreadcrumbNavigationBarStyle {
4499//TODO &see NavigatorBreadcrumbNavigationBar.js
4500}
4501
4502export interface BreadcrumbNavigationBarRouteMapper {
4503rightContentForRoute: ( route: Route, navigator: Navigator ) => React.ReactElement<any>
4504titleContentForRoute: ( route: Route, navigator: Navigator ) => React.ReactElement<any>
4505iconForRoute: ( route: Route, navigator: Navigator ) => React.ReactElement<any>
4506//in samples...
4507separatorForRoute: ( route: Route, navigator: Navigator ) => React.ReactElement<any>
4508}
4509
4510/**
4511* @see NavigatorNavigationBar.js
4512*/
4513export interface BreadcrumbNavigationBarProperties extends React.Props<BreadcrumbNavigationBarStatic> {
4514navigator?: Navigator
4515routeMapper?: BreadcrumbNavigationBarRouteMapper
4516navState?: NavState
4517style?: ViewStyle
4518}
4519
4520export interface BreadcrumbNavigationBarStatic extends React.ComponentClass<BreadcrumbNavigationBarProperties> {
4521Styles: BreadcrumbNavigationBarStyle
4522
4523immediatelyRefresh(): void
4524}
4525
4526export type BreadcrumbNavigationBar = BreadcrumbNavigationBarStatic
4527var BreadcrumbNavigationBar: BreadcrumbNavigationBarStatic
4528
4529}
4530
4531// @see https://github.com/facebook/react-native/blob/0.34-stable\Libraries\StyleSheet\StyleSheetTypes.js
4532export namespace StyleSheet {
4533
4534type Style = ViewStyle | TextStyle | ImageStyle
4535
a8307513Vladimir Kotikov9 years ago4536interface Styles {
4537[style: string]: Style
4538}
4539
1f817868Vladimir Kotikov9 years ago4540/**
4541* Creates a StyleSheet style reference from the given object.
4542*/
a8307513Vladimir Kotikov9 years ago4543// Non-generic override is required to provide intellisense
4544// for JavaScript and non-generic method invocations
4545export 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 ago4548export function create<T>( styles: T ): T;
a8307513Vladimir Kotikov9 years ago4549export function create<T extends Styles>( styles: T ): T;
1f817868Vladimir Kotikov9 years ago4550
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 ago4590export function flatten(style?: Style | Style[]): Style
1f817868Vladimir Kotikov9 years ago4591
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*/
4609export 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*/
4616export 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*/
4630export var absoluteFillObject: {
4631position: string
4632left: number
4633right: number
4634top: number
4635bottom: number
4636}
4637}
4638
4639export type RelayProfiler = {
4640attachProfileHandler(
4641name: string,
4642handler: (name: string, state?: any) => () => void
4643): void,
4644
4645attachAggregateHandler(
4646name: string,
4647handler: (name: string, callback: () => void) => void
4648): void,
4649}
4650
4651export interface SystraceStatic {
4652setEnabled(enabled: boolean): void
4653/**
4654* beginEvent/endEvent for starting and then ending a profile within the same call stack frame
4655**/
4656beginEvent(profileName?: any, args?: any): void
4657endEvent(): 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**/
4663beginAsyncEvent(profileName?: any): any
4664endAsyncEvent(profileName?: any, cookie?: any): void
4665/**
4666* counterEvent registers the value to the profileName on the systrace timeline
4667**/
4668counterEvent(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**/
4673attachToRelayProfiler(relayProfiler: RelayProfiler): void
4674/* This is not called by default due to perf overhead but it's useful
4675if you want to find traces which spend too much time in JSON. */
4676swizzleJSON(): 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*/
4685measureMethods(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*/
4695measure(objName: string, fnName: string, func: Function): Function
4696}
4697
4698/**
4699* //FIXME: Could not find docs. Inferred from examples and jscode : ListViewDataSource.js
4700*/
4701export interface DataSourceAssetCallback {
4702rowHasChanged?: ( r1: any, r2: any ) => boolean
4703sectionHeaderHasChanged?: ( h1: any, h2: any ) => boolean
4704getRowData?: <T>( dataBlob: any, sectionID: number | string, rowID: number | string ) => T
4705getSectionHeaderData?: <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*/
4741export 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*/
4767new( 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*/
4785cloneWithRows<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*/
4798cloneWithRowsAndSections( dataBlob: Array<any> | {[key: string]: any}, sectionIdentities?: Array<string | number>, rowIdentities?: Array<Array<string | number>> ): ListViewDataSource
4799
4800getRowCount(): number
4801getRowAndSectionCount(): number
4802
4803/**
4804* Returns if the row is dirtied and needs to be rerendered
4805*/
4806rowShouldUpdate(sectionIndex: number, rowIndex: number): boolean
4807
4808/**
4809* Gets the data required to render the row.
4810*/
4811getRowData( 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 ago4817getRowIDForFlatIndex( index: number ): string
1f817868Vladimir Kotikov9 years ago4818
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 ago4823getSectionIDForFlatIndex( index: number ): string
1f817868Vladimir Kotikov9 years ago4824
4825/**
4826* Returns an array containing the number of rows in each section
4827*/
4828getSectionLengths(): Array<number>
4829
4830/**
4831* Returns if the section header is dirtied and needs to be rerendered
4832*/
4833sectionHeaderShouldUpdate( sectionIndex: number ): boolean
4834
4835/**
4836* Gets the data required to render the section header
4837*/
4838getSectionHeaderData( sectionIndex: number ): any
4839}
4840
4841/**
4842* @see https://facebook.github.io/react-native/docs/tabbarios-item.html#props
4843*/
4844export interface TabBarItemProperties extends ViewProperties, React.Props<TabBarItemStatic> {
4845
4846/**
4847* Little red bubble that sits at the top right of the icon.
4848*/
4849badge?: string | number
4850
4851/**
4852* A custom icon for the tab. It is ignored when a system icon is defined.
4853*/
4854icon?: 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*/
4860onPress?: () => void
4861
4862/**
4863* If set to true it renders the image as original,
4864* it defaults to being displayed as a template
4865*/
4866renderAsOriginal?: 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*/
4871selected?: 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*/
4877selectedIcon?: ImageURISource
4878
4879/**
4880* React style object.
4881*/
4882style?: 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*/
4890systemIcon?: "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*/
4895title?: string
4896
4897ref?: Ref<TabBarItemStatic & ViewStatic>
4898}
4899
4900export interface TabBarItemStatic extends React.ComponentClass<TabBarItemProperties> {
4901}
4902
4903/**
4904* @see https://facebook.github.io/react-native/docs/tabbarios.html#props
4905*/
4906export interface TabBarIOSProperties extends ViewProperties, React.Props<TabBarIOSStatic> {
4907
4908/**
4909* Background color of the tab bar
4910*/
4911barTintColor?: 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*/
4922itemPositioning?: 'fill' | 'center' | 'auto'
4923
4924/**
4925* Color of the currently selected tab icon
4926*/
4927tintColor?: string
4928
4929/**
4930* A Boolean value that indicates whether the tab bar is translucent
4931*/
4932translucent?: boolean
4933
4934/**
4935* Color of text on unselected tabs
4936*/
4937unselectedTintColor?: string
4938
4939ref?: Ref<TabBarIOSStatic & ViewStatic>
4940}
4941
4942export interface TabBarIOSStatic extends React.ComponentClass<TabBarIOSProperties> {
4943Item: TabBarItemStatic;
4944}
4945
4946
4947export interface PixelRatioStatic {
4948
4949/*
4950Returns the device pixel density. Some examples:
4951PixelRatio.get() === 1
4952mdpi Android devices (160 dpi)
4953PixelRatio.get() === 1.5
4954hdpi Android devices (240 dpi)
4955PixelRatio.get() === 2
4956iPhone 4, 4S
4957iPhone 5, 5c, 5s
4958iPhone 6
4959xhdpi Android devices (320 dpi)
4960PixelRatio.get() === 3
4961iPhone 6 plus
4962xxhdpi Android devices (480 dpi)
4963PixelRatio.get() === 3.5
4964Nexus 6
4965*/
4966get(): number;
4967
4968/*
4969Returns the scaling factor for font sizes. This is the ratio that is
4970used to calculate the absolute font size, so any elements that
4971heavily depend on that should use this to do calculations.
4972
4973If a font scale is not set, this returns the device pixel ratio.
4974
4975Currently this is only implemented on Android and reflects the user
4976preference set in Settings > Display > Font size,
4977on iOS it will always return the default pixel ratio.
4978*/
4979getFontScale(): number
4980
4981/**
4982* Converts a layout size (dp) to pixel size (px).
4983* Guaranteed to return an integer number.
4984* @param layoutSize
4985*/
4986getPixelSizeForLayoutSize(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*/
4996roundToNearestPixel(layoutSize: number): number
4997
4998/**
4999* No-op for iOS, but used on the web. Should not be documented. [sic]
5000*/