microsoft/vscode-react-native

Public

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

CodeCommitsIssuesPull requestsActionsInsightsSecurity
afbb24df0cdf050f504d2f9cfaebce6d2d7bbc75

Branches

Tags

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

Clone

HTTPS

Download ZIP

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

3480lines · modeblame

d24fea86Joshua Skelton10 years ago1// Type definitions for react-native 0.14
2// Project: https://github.com/facebook/react-native
3// Definitions by: Bruno Grieder <https://github.com/bgrieder>
4// Definitions: https://github.com/borisyankov/DefinitelyTyped
5
6///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
7//
8// USING: these definitions are meant to be used with the TSC compiler target set to ES6
9//
10// USAGE EXAMPLES: check the RNTSExplorer project at https://github.com/bgrieder/RNTSExplorer
11//
12// CONTRIBUTING: please open pull requests and make sure that the changes do not break RNTSExplorer (they should not)
13// Do not hesitate to open a pull request against RNTSExplorer to provide an example for a case not covered by the current App
14//
15// CREDITS: This work is based on an original work made by Bernd Paradies: https://github.com/bparadie
16//
17///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
18
19/// <reference path="../react/react.d.ts" />
20
21//so we know what is "original" React
22import React = __React;
23
24//react-native "extends" react
25declare namespace __React {
26
27
28/**
29* Represents the completion of an asynchronous operation
30* @see lib.es6.d.ts
31*/
32export interface Promise<T> {
33/**
34* Attaches callbacks for the resolution and/or rejection of the Promise.
35* @param onfulfilled The callback to execute when the Promise is resolved.
36* @param onrejected The callback to execute when the Promise is rejected.
37* @returns A Promise for the completion of which ever callback is executed.
38*/
39then<TResult>( onfulfilled?: ( value: T ) => TResult | Promise<TResult>, onrejected?: ( reason: any ) => TResult | Promise<TResult> ): Promise<TResult>;
40
41/**
42* Attaches a callback for only the rejection of the Promise.
43* @param onrejected The callback to execute when the Promise is rejected.
44* @returns A Promise for the completion of the callback.
45*/
46catch( onrejected?: ( reason: any ) => T | Promise<T> ): Promise<T>;
47
48
49// not in lib.es6.d.ts but called by react-native
50done( callback?: ( value: T ) => void ): void;
51}
52
53export interface PromiseConstructor {
54/**
55* A reference to the prototype.
56*/
57prototype: Promise<any>;
58
59/**
60* Creates a new Promise.
61* @param init A callback used to initialize the promise. This callback is passed two arguments:
62* a resolve callback used resolve the promise with a value or the result of another promise,
63* and a reject callback used to reject the promise with a provided reason or error.
64*/
65new <T>( init: ( resolve: ( value?: T | Promise<T> ) => void, reject: ( reason?: any ) => void ) => void ): Promise<T>;
66
67<T>( init: ( resolve: ( value?: T | Promise<T> ) => void, reject: ( reason?: any ) => void ) => void ): Promise<T>;
68
69/**
70* Creates a Promise that is resolved with an array of results when all of the provided Promises
71* resolve, or rejected when any Promise is rejected.
72* @param values An array of Promises.
73* @returns A new Promise.
74*/
75all<T>( values: (T | Promise<T>)[] ): Promise<T[]>;
76
77/**
78* Creates a Promise that is resolved with an array of results when all of the provided Promises
79* resolve, or rejected when any Promise is rejected.
80* @param values An array of values.
81* @returns A new Promise.
82*/
83all( values: Promise<void>[] ): Promise<void>;
84
85/**
86* Creates a Promise that is resolved or rejected when any of the provided Promises are resolved
87* or rejected.
88* @param values An array of Promises.
89* @returns A new Promise.
90*/
91race<T>( values: (T | Promise<T>)[] ): Promise<T>;
92
93/**
94* Creates a new rejected promise for the provided reason.
95* @param reason The reason the promise was rejected.
96* @returns A new rejected Promise.
97*/
98reject( reason: any ): Promise<void>;
99
100/**
101* Creates a new rejected promise for the provided reason.
102* @param reason The reason the promise was rejected.
103* @returns A new rejected Promise.
104*/
105reject<T>( reason: any ): Promise<T>;
106
107/**
108* Creates a new resolved promise for the provided value.
109* @param value A promise.
110* @returns A promise whose internal state matches the provided promise.
111*/
112resolve<T>( value: T | Promise<T> ): Promise<T>;
113
114/**
115* Creates a new resolved promise .
116* @returns A resolved promise.
117*/
118resolve(): Promise<void>;
119}
120
121// @see lib.es6.d.ts
122export var Promise: PromiseConstructor;
123
124//TODO: BGR: Replace with ComponentClass ?
125// node_modules/react-tools/src/classic/class/ReactClass.js
126export interface ReactClass<D, P, S> {
127// TODO:
128}
129
130// see react-jsx.d.ts
131export function createElement<P>( type: React.ReactType,
132props?: P,
133...children: React.ReactNode[] ): React.ReactElement<P>;
134
135
136export type Runnable = ( appParameters: any ) => void;
137
138
139// Similar to React.SyntheticEvent except for nativeEvent
140interface NativeSyntheticEvent<T> {
141bubbles: boolean
142cancelable: boolean
143currentTarget: EventTarget
144defaultPrevented: boolean
145eventPhase: number
146isTrusted: boolean
147nativeEvent: T
148preventDefault(): void
149stopPropagation(): void
150target: EventTarget
151timeStamp: Date
152type: string
153}
154
155export interface NativeTouchEvent {
156/**
157* Array of all touch events that have changed since the last event
158*/
159changedTouches: NativeTouchEvent[]
160
161/**
162* The ID of the touch
163*/
164identifier: string
165
166/**
167* The X position of the touch, relative to the element
168*/
169locationX: number
170
171/**
172* The Y position of the touch, relative to the element
173*/
174locationY: number
175
176/**
177* The X position of the touch, relative to the screen
178*/
179pageX: number
180
181/**
182* The Y position of the touch, relative to the screen
183*/
184pageY: number
185
186/**
187* The node id of the element receiving the touch event
188*/
189target: string
190
191/**
192* A time identifier for the touch, useful for velocity calculation
193*/
194timestamp: number
195
196/**
197* Array of all current touches on the screen
198*/
199touches : NativeTouchEvent[]
200}
201
202export interface GestureResponderEvent extends NativeSyntheticEvent<NativeTouchEvent> {
203}
204
205
206export interface PointProperties {
207x: number
208y: number
209}
210
211export interface Insets {
212top?: number
213left?: number
214bottom?: number
215right?: number
216}
217
218/**
219* //FIXME: need to find documentation on which compoenent is a native (i.e. non composite component)
220*/
221export interface NativeComponent {
222setNativeProps: ( props: Object ) => void
223}
224
225/**
226* //FIXME: need to find documentation on which component is a TTouchable and can implement that interface
227* @see React.DOMAtributes
228*/
229export interface Touchable {
230onTouchStart?: ( event: GestureResponderEvent ) => void
231onTouchMove?: ( event: GestureResponderEvent ) => void
232onTouchEnd?: ( event: GestureResponderEvent ) => void
233onTouchCancel?: ( event: GestureResponderEvent ) => void
234onTouchEndCapture?: ( event: GestureResponderEvent ) => void
235}
236
237export type AppConfig = {
238appKey: string;
239component: ReactClass<any, any, any>;
240run?: Runnable;
241}
242
243// https://github.com/facebook/react-native/blob/master/Libraries/AppRegistry/AppRegistry.js
244export class AppRegistry {
245static registerConfig( config: AppConfig[] ): void;
246
247static registerComponent( appKey: string, getComponentFunc: () => React.ComponentClass<any> ): string;
248
249static registerRunnable( appKey: string, func: Runnable ): string;
250
251static runApplication( appKey: string, appParameters: any ): void;
252}
253
254export interface LayoutAnimationTypes {
255spring: string
256linear: string
257easeInEaseOut: string
258easeIn: string
259easeOut: string
260}
261
262export interface LayoutAnimationProperties {
263opacity: string
264scaleXY: string
265}
266
267export interface LayoutAnimationAnim {
268duration?: number
269delay?: number
270springDamping?: number
271initialVelocity?: number
272type?: string //LayoutAnimationTypes
273property?: string //LayoutAnimationProperties
274}
275
276export interface LayoutAnimationConfig {
277duration: number
278create?: LayoutAnimationAnim
279update?: LayoutAnimationAnim
280delete?: LayoutAnimationAnim
281}
282
283export interface LayoutAnimationStatic {
284
285configureNext: ( config: LayoutAnimationConfig, onAnimationDidEnd?: () => void, onError?: ( error?: any ) => void ) => void
286create: ( duration: number, type?: string, creationProp?: string ) => LayoutAnimationConfig
287Types: LayoutAnimationTypes
288Properties: LayoutAnimationProperties
289configChecker: ( conf: {config: LayoutAnimationConfig}, name: string, next: string ) => void
290Presets : {
291easeInEaseOut: LayoutAnimationConfig
292linear:LayoutAnimationConfig
293spring: LayoutAnimationConfig
294}
295}
296
297
298/**
299* Flex Prop Types
300* @see https://facebook.github.io/react-native/docs/flexbox.html#proptypes
301* @see LayoutPropTypes.js
302*/
303export interface FlexStyle {
304
305alignItems?: string; //enum('flex-start', 'flex-end', 'center', 'stretch')
306alignSelf?: string// enum('auto', 'flex-start', 'flex-end', 'center', 'stretch')
307borderBottomWidth?: number
308borderLeftWidth?: number
309borderRightWidth?: number
310borderTopWidth?: number
311borderWidth?: number
312bottom?: number
313flex?: number
314flexDirection?: string // enum('row', 'column')
315flexWrap?: string // enum('wrap', 'nowrap')
316height?: number
317justifyContent?: string // enum('flex-start', 'flex-end', 'center', 'space-between', 'space-around')
318left?: number
319margin?: number
320marginBottom?: number
321marginHorizontal?: number
322marginLeft?: number
323marginRight?: number
324marginTop?: number
325marginVertical?: number
326padding?: number
327paddingBottom?: number
328paddingHorizontal?: number
329paddingLeft?: number
330paddingRight?: number
331paddingTop?: number
332paddingVertical?: number
333position?: string // enum('absolute', 'relative')
334right?: number
335top?: number
336width?: number
337}
338
339
340export interface TransformsStyle {
341
342transform?: [{perspective: number}, {rotate: string}, {rotateX: string}, {rotateY: string}, {rotateZ: string}, {scale: number}, {scaleX: number}, {scaleY: number}, {translateX: number}, {translateY: number}, {skewX: string}, {skewY: string}]
343transformMatrix?: Array<number>
344rotation?: number
345scaleX?: number
346scaleY?: number
347translateX?: number
348translateY?: number
349}
350
351
352export interface StyleSheetProperties {
353// TODO:
354}
355
356export interface LayoutRectangle {
357x: number;
358y: number;
359width: number;
360height: number;
361}
362
363// @see TextProperties.onLayout
364export interface LayoutChangeEvent {
365nativeEvent: {
366layout: LayoutRectangle
367}
368}
369
370// @see https://facebook.github.io/react-native/docs/text.html#style
371export interface TextStyle extends ViewStyle {
372color?: string
373fontFamily?: string
374fontSize?: number
375fontStyle?: string // 'normal' | 'italic';
376fontWeight?: string // enum("normal", 'bold', '100', '200', '300', '400', '500', '600', '700', '800', '900')
377letterSpacing?: number
378lineHeight?: number
379textAlign?: string // enum("auto", 'left', 'right', 'center')
380textDecorationLine?: string // enum("none", 'underline', 'line-through', 'underline line-through')
381textDecorationStyle?: string // enum("solid", 'double', 'dotted', 'dashed')
382textDecorationColor?: string
383writingDirection?: string; //enum("auto", 'ltr', 'rtl')
384//containerBackgroundColor?: string
385}
386
387export interface TextPropertiesIOS {
388
389/**
390* When true, no visual change is made when text is pressed down.
391* By default, a gray oval highlights the text on press down.
392*/
393suppressHighlighting?: boolean
394}
395
396// https://facebook.github.io/react-native/docs/text.html#props
397export interface TextProperties extends React.Props<TextProperties> {
398
399/**
400* Specifies should fonts scale to respect Text Size accessibility setting on iOS.
401*/
402allowFontScaling?: boolean
403
404/**
405* Used to truncate the text with an elipsis after computing the text layout, including line wrapping, such that the total number of lines does not exceed this number.
406*/
407numberOfLines?: number
408
409/**
410* Invoked on mount and layout changes with
411*
412* {nativeEvent: { layout: {x, y, width, height}}}.
413*/
414onLayout?: ( event: LayoutChangeEvent ) => void
415
416/**
417* This function is called on press.
418* Text intrinsically supports press handling with a default highlight state (which can be disabled with suppressHighlighting).
419*/
420onPress?: () => void
421
422/**
423* @see https://facebook.github.io/react-native/docs/text.html#style
424*/
425style?: TextStyle
426
427/**
428* Used to locate this view in end-to-end tests.
429*/
430testID?: string
431}
432
433/**
434* A React component for displaying text which supports nesting, styling, and touch handling.
435*/
436export interface TextStatic extends React.ComponentClass<TextProperties> {
437
438}
439
440
441/**
442* IOS Specific properties for TextInput
443* @see https://facebook.github.io/react-native/docs/textinput.html#props
444*/
445export interface TextInputIOSProperties {
446
447/**
448* If true, the text field will blur when submitted.
449* The default value is true.
450*/
451blurOnSubmit?: boolean
452
453/**
454* enum('never', 'while-editing', 'unless-editing', 'always')
455* When the clear button should appear on the right side of the text view
456*/
457clearButtonMode?: string
458
459/**
460* If true, clears the text field automatically when editing begins
461*/
462clearTextOnFocus?: boolean
463
464/**
465* If true, the keyboard disables the return key when there is no text and automatically enables it when there is text.
466* The default value is false.
467*/
468enablesReturnKeyAutomatically?: boolean
469
470/**
471* Callback that is called when a key is pressed.
472* Pressed key value is passed as an argument to the callback handler.
473* Fires before onChange callbacks.
474*/
475onKeyPress?: () => void
476
477/**
478* enum('default', 'go', 'google', 'join', 'next', 'route', 'search', 'send', 'yahoo', 'done', 'emergency-call')
479* Determines how the return key should look.
480*/
481returnKeyType?: string
482
483/**
484* If true, all text will automatically be selected on focus
485*/
486selectTextOnFocus?: boolean
487
488/**
489* //FIXME: requires typing
490* See DocumentSelectionState.js, some state that is responsible for maintaining selection information for a document
491*/
492selectionState?: any
493
494
495}
496
497/**
498* Android Specific properties for TextInput
499* @see https://facebook.github.io/react-native/docs/textinput.html#props
500*/
501export interface TextInputAndroidProperties {
502
503/**
504* Sets the number of lines for a TextInput.
505* Use it with multiline set to true to be able to fill the lines.
506*/
507numberOfLines?: number
508
509/**
510* enum('start', 'center', 'end')
511* Set the position of the cursor from where editing will begin.
512*/
513textAlign?: string
514
515/**
516* enum('top', 'center', 'bottom')
517* Aligns text vertically within the TextInput.
518*/
519textAlignVertical?: string
520
521/**
522* The color of the textInput underline.
523*/
524underlineColorAndroid?: string
525}
526
527
528/**
529* @see https://facebook.github.io/react-native/docs/textinput.html#props
530*/
531export interface TextInputProperties extends TextInputIOSProperties, TextInputAndroidProperties, React.Props<TextInputStatic> {
532
533/**
534* Can tell TextInput to automatically capitalize certain characters.
535* characters: all characters,
536* words: first letter of each word
537* sentences: first letter of each sentence (default)
538* none: don't auto capitalize anything
539*
540* https://facebook.github.io/react-native/docs/textinput.html#autocapitalize
541*/
542autoCapitalize?: string
543
544/**
545* If false, disables auto-correct.
546* The default value is true.
547*/
548autoCorrect?: boolean
549
550/**
551* If true, focuses the input on componentDidMount.
552* The default value is false.
553*/
554autoFocus?: boolean
555
556/**
557* Provides an initial value that will change when the user starts typing.
558* Useful for simple use-cases where you don't want to deal with listening to events
559* and updating the value prop to keep the controlled state in sync.
560*/
561defaultValue?: string
562
563/**
564* If false, text is not editable. The default value is true.
565*/
566editable?: boolean
567
568/**
569* enum("default", 'numeric', 'email-address', "ascii-capable", 'numbers-and-punctuation', 'url', 'number-pad', 'phone-pad', 'name-phone-pad', 'decimal-pad', 'twitter', 'web-search')
570* Determines which keyboard to open, e.g.numeric.
571* The following values work across platforms: - default - numeric - email-address
572*/
573keyboardType?: string
574
575/**
576* Limits the maximum number of characters that can be entered.
577* Use this instead of implementing the logic in JS to avoid flicker.
578*/
579maxLength?: number
580
581/**
582* If true, the text input can be multiple lines. The default value is false.
583*/
584multiline?: boolean
585
586/**
587* Callback that is called when the text input is blurred
588*/
589onBlur?: () => void
590
591/**
592* Callback that is called when the text input's text changes.
593*/
594onChange?: ( event: {nativeEvent: {text: string}} ) => void
595
596/**
597* Callback that is called when the text input's text changes.
598* Changed text is passed as an argument to the callback handler.
599*/
600onChangeText?: ( text: string ) => void
601
602/**
603* Callback that is called when text input ends.
604*/
605onEndEditing?: ( event: {nativeEvent: {text: string}} ) => void
606
607/**
608* Callback that is called when the text input is focused
609*/
610onFocus?: () => void
611
612/**
613* Invoked on mount and layout changes with {x, y, width, height}.
614*/
615onLayout?: ( event: {nativeEvent: {x: number, y: number, width: number, height: number}} ) => void
616
617/**
618* Callback that is called when the text input's submit button is pressed.
619*/
620onSubmitEditing?: ( event: {nativeEvent: {text: string}} ) => void
621
622/**
623* //FIXME: Not part of the doc but found in examples
624*/
625password?: boolean
626
627/**
628* The string that will be rendered before text input has been entered
629*/
630placeholder?: string
631
632/**
633* The text color of the placeholder string
634*/
635placeholderTextColor?: string
636
637/**
638* If true, the text input obscures the text entered so that sensitive text like passwords stay secure.
639* The default value is false.
640*/
641secureTextEntry?: boolean
642
643/**
644* Styles
645*/
646style?: TextStyle
647
648/**
649* Used to locate this view in end-to-end tests
650*/
651testID?: string
652
653/**
654* The value to show for the text input. TextInput is a controlled component,
655* which means the native value will be forced to match this value prop if provided.
656* 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.
657* In addition to simply setting the same value, either set editable={false},
658* or set/update maxLength to prevent unwanted edits without flicker.
659*/
660value?: string
661}
662
663export interface TextInputStatic extends NativeComponent, React.ComponentClass<TextInputProperties> {
664blur: () => void
665focus: () => void
666}
667
668
669/**
670* Gesture recognition on mobile devices is much more complicated than web.
671* A touch can go through several phases as the app determines what the user's intention is.
672* For example, the app needs to determine if the touch is scrolling, sliding on a widget, or tapping.
673* This can even change during the duration of a touch. There can also be multiple simultaneous touches.
674*
675* The touch responder system is needed to allow components to negotiate these touch interactions
676* without any additional knowledge about their parent or child components.
677* This system is implemented in ResponderEventPlugin.js, which contains further details and documentation.
678*
679* Best Practices
680* Users can feel huge differences in the usability of web apps vs. native, and this is one of the big causes.
681* Every action should have the following attributes:
682* Feedback/highlighting- show the user what is handling their touch, and what will happen when they release the gesture
683* Cancel-ability- when making an action, the user should be able to abort it mid-touch by dragging their finger away
684*
685* These features make users more comfortable while using an app,
686* because it allows people to experiment and interact without fear of making mistakes.
687*
688* TouchableHighlight and Touchable*
689* The responder system can be complicated to use.
690* So we have provided an abstract Touchable implementation for things that should be "tappable".
691* This uses the responder system and allows you to easily configure tap interactions declaratively.
692* Use TouchableHighlight anywhere where you would use a button or link on web.
693*/
694export interface GestureResponderHandlers {
695
696/**
697* A view can become the touch responder by implementing the correct negotiation methods.
698* There are two methods to ask the view if it wants to become responder:
699*/
700
701/**
702* Does this view want to become responder on the start of a touch?
703*/
704onStartShouldSetResponder?: ( event: GestureResponderEvent ) => boolean
705
706/**
707* Called for every touch move on the View when it is not the responder: does this view want to "claim" touch responsiveness?
708*/
709onMoveShouldSetResponder?: ( event: GestureResponderEvent ) => boolean
710
711/**
712* If the View returns true and attempts to become the responder, one of the following will happen:
713*/
714
715/**
716* The View is now responding for touch events.
717* This is the time to highlight and show the user what is happening
718*/
719onResponderGrant?: ( event: GestureResponderEvent ) => void
720
721/**
722* Something else is the responder right now and will not release it
723*/
724onResponderReject?: ( event: GestureResponderEvent ) => void
725
726/**
727* If the view is responding, the following handlers can be called:
728*/
729
730/**
731* The user is moving their finger
732*/
733onResponderMove?: ( event: GestureResponderEvent ) => void
734
735/**
736* Fired at the end of the touch, ie "touchUp"
737*/
738onResponderRelease?: ( event: GestureResponderEvent ) => void
739
740/**
741* Something else wants to become responder.
742* Should this view release the responder? Returning true allows release
743*/
744onResponderTerminationRequest?: ( event: GestureResponderEvent ) => boolean
745
746/**
747* The responder has been taken from the View.
748* Might be taken by other views after a call to onResponderTerminationRequest,
749* or might be taken by the OS without asking (happens with control center/ notification center on iOS)
750*/
751onResponderTerminate?: ( event: GestureResponderEvent ) => void
752
753/**
754* onStartShouldSetResponder and onMoveShouldSetResponder are called with a bubbling pattern,
755* where the deepest node is called first.
756* That means that the deepest component will become responder when multiple Views return true for *ShouldSetResponder handlers.
757* This is desirable in most cases, because it makes sure all controls and buttons are usable.
758*
759* However, sometimes a parent will want to make sure that it becomes responder.
760* This can be handled by using the capture phase.
761* Before the responder system bubbles up from the deepest component,
762* it will do a capture phase, firing on*ShouldSetResponderCapture.
763* So if a parent View wants to prevent the child from becoming responder on a touch start,
764* it should have a onStartShouldSetResponderCapture handler which returns true.
765*/
766onStartShouldSetResponderCapture?: ( event: GestureResponderEvent ) => boolean
767
768/**
769* onStartShouldSetResponder and onMoveShouldSetResponder are called with a bubbling pattern,
770* where the deepest node is called first.
771* That means that the deepest component will become responder when multiple Views return true for *ShouldSetResponder handlers.
772* This is desirable in most cases, because it makes sure all controls and buttons are usable.
773*
774* However, sometimes a parent will want to make sure that it becomes responder.
775* This can be handled by using the capture phase.
776* Before the responder system bubbles up from the deepest component,
777* it will do a capture phase, firing on*ShouldSetResponderCapture.
778* So if a parent View wants to prevent the child from becoming responder on a touch start,
779* it should have a onStartShouldSetResponderCapture handler which returns true.
780*/
781onMoveShouldSetResponderCapture?: () => void;
782
783}
784
785// @see https://facebook.github.io/react-native/docs/view.html#style
786export interface ViewStyle extends FlexStyle, TransformsStyle {
787backgroundColor?: string;
788borderBottomColor?: string;
789borderBottomLeftRadius?: number;
790borderBottomRightRadius?: number;
791borderColor?: string;
792borderLeftColor?: string;
793borderRadius?: number;
794borderRightColor?: string;
795borderTopColor?: string;
796borderTopLeftRadius?: number;
797borderTopRightRadius?: number;
798opacity?: number;
799overflow?: string; // enum('visible', 'hidden')
800shadowColor?: string;
801shadowOffset?: {width: number, height: number};
802shadowOpacity?: number;
803shadowRadius?: number;
804}
805
806
807export interface ViewPropertiesIOS {
808
809/**
810* Provides additional traits to screen reader.
811* By default no traits are provided unless specified otherwise in element
812*
813* @enum('none', 'button', 'link', 'header', 'search', 'image', 'selected', 'plays', 'key', 'text','summary', 'disabled', 'frequentUpdates', 'startsMedia', 'adjustable', 'allowsDirectInteraction', 'pageTurn')
814*/
815accessibilityTraits?: string | string[];
816
817/**
818* Whether this view should be rendered as a bitmap before compositing.
819*
820* On iOS, this is useful for animations and interactions that do not modify this component's dimensions nor its children;
821* for example, when translating the position of a static view, rasterization allows the renderer to reuse a cached bitmap of a static view
822* and quickly composite it during each frame.
823*
824* Rasterization incurs an off-screen drawing pass and the bitmap consumes memory.
825* Test and measure when using this property.
826*/
827shouldRasterizeIOS?: boolean
828}
829
830export interface ViewPropertiesAndroid {
831
832/**
833* Indicates to accessibility services to treat UI component like a native one.
834* Works for Android only.
835*
836* @enum('none', 'button', 'radiobutton_checked', 'radiobutton_unchecked' )
837*/
838accessibilityComponentType?: string
839
840
841/**
842* Indicates to accessibility services whether the user should be notified when this view changes.
843* Works for Android API >= 19 only.
844* See http://developer.android.com/reference/android/view/View.html#attr_android:accessibilityLiveRegion for references.
845*/
846accessibilityLiveRegion?: string
847
848/**
849* Views that are only used to layout their children or otherwise don't draw anything
850* may be automatically removed from the native hierarchy as an optimization.
851* Set this property to false to disable this optimization and ensure that this View exists in the native view hierarchy.
852*/
853collapsable?: boolean
854
855
856/**
857* Controls how view is important for accessibility which is if it fires accessibility events
858* and if it is reported to accessibility services that query the screen.
859* Works for Android only. See http://developer.android.com/reference/android/R.attr.html#importantForAccessibility for references.
860*
861* Possible values:
862* 'auto' - The system determines whether the view is important for accessibility - default (recommended).
863* 'yes' - The view is important for accessibility.
864* 'no' - The view is not important for accessibility.
865* 'no-hide-descendants' - The view is not important for accessibility, nor are any of its descendant views.
866*/
867importantForAccessibility?: string
868
869
870/**
871* Whether this view needs to rendered offscreen and composited with an alpha in order to preserve 100% correct colors and blending behavior.
872* The default (false) falls back to drawing the component and its children
873* 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.
874* This default may be noticeable and undesired in the case where the View you are setting an opacity on
875* has multiple overlapping elements (e.g. multiple overlapping Views, or text and a background).
876*
877* Rendering offscreen to preserve correct alpha behavior is extremely expensive
878* and hard to debug for non-native developers, which is why it is not turned on by default.
879* If you do need to enable this property for an animation,
880* consider combining it with renderToHardwareTextureAndroid if the view contents are static (i.e. it doesn't need to be redrawn each frame).
881* If that property is enabled, this View will be rendered off-screen once,
882* 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.
883*/
884needsOffscreenAlphaCompositing?: boolean
885
886
887/**
888* Whether this view should render itself (and all of its children) into a single hardware texture on the GPU.
889*
890* On Android, this is useful for animations and interactions that only modify opacity, rotation, translation, and/or scale:
891* 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
892* 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.
893*/
894renderToHardwareTextureAndroid?: boolean;
895
896}
897
898/**
899* @see https://facebook.github.io/react-native/docs/view.html#props
900*/
901export interface ViewProperties extends ViewPropertiesAndroid, ViewPropertiesIOS, GestureResponderHandlers, Touchable, React.Props<ViewStatic> {
902
903/**
904* 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.
905*/
906accessibilityLabel?: string;
907
908/**
909* When true, indicates that the view is an accessibility element.
910* By default, all the touchable elements are accessible.
911*/
912accessible?: boolean;
913
914/**
915* When `accessible` is true, the system will try to invoke this function when the user performs accessibility tap gesture.
916*/
917onAcccessibilityTap?: () => void;
918
919/**
920* Invoked on mount and layout changes with
921*
922* {nativeEvent: { layout: {x, y, width, height}}}.
923*/
924onLayout?: ( event: LayoutChangeEvent ) => void;
925
926/**
927* When accessible is true, the system will invoke this function when the user performs the magic tap gesture.
928*/
929onMagicTap?: () => void;
930
931/**
932*
933* 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:
934*
935* .box-none {
936* pointer-events: none;
937* }
938* .box-none * {
939* pointer-events: all;
940* }
941*
942* box-only is the equivalent of
943*
944* .box-only {
945* pointer-events: all;
946* }
947* .box-only * {
948* pointer-events: none;
949* }
950*
951* But since pointerEvents does not affect layout/appearance, and we are already deviating from the spec by adding additional modes,
952* 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.
953*/
954pointerEvents?: string;
955
956/**
957*
958* This is a special performance property exposed by RCTView and is useful for scrolling content when there are many subviews,
959* 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.
960* The subviews must also have overflow: hidden, as should the containing view (or one of its superviews).
961*/
962removeClippedSubviews?: boolean
963
964style?: ViewStyle;
965
966/**
967* Used to locate this view in end-to-end tests.
968*/
969testID?: string;
970}
971
972/**
973* The most fundamental component for building UI, View is a container that supports layout with flexbox, style, some touch handling,
974* and accessibility controls, and is designed to be nested inside other views and to have 0 to many children of any type.
975* View maps directly to the native view equivalent on whatever platform React is running on,
976* whether that is a UIView, <div>, android.view, etc.
977*/
978export interface ViewStatic extends NativeComponent, React.ComponentClass<ViewProperties> {
979
980}
981
982/**
983* //FIXME: No documentation extracted from code comment on WebView.ios.js
984*/
985export interface NavState {
986
987url?: string
988title?: string
989loading?: boolean
990canGoBack?: boolean
991canGoForward?: boolean;
992
993[key: string]: any
994}
995
996export interface WebViewPropertiesAndroid {
997
998/**
999* Used for android only, JS is enabled by default for WebView on iOS
1000*/
1001javaScriptEnabledAndroid?: boolean
1002}
1003
1004export interface WebViewPropertiesIOS {
1005
1006/**
1007* Used for iOS only, sets whether the webpage scales to fit the view and the user can change the scale
1008*/
1009scalesPageToFit?: boolean
1010}
1011
1012/**
1013* @see https://facebook.github.io/react-native/docs/webview.html#props
1014*/
1015export interface WebViewProperties extends WebViewPropertiesAndroid, WebViewPropertiesIOS, React.Props<WebViewStatic> {
1016
1017automaticallyAdjustContentInsets?: boolean
1018
1019bounces?: boolean
1020
1021contentInset?: Insets
1022
1023html?: string
1024
1025/**
1026* Sets the JS to be injected when the webpage loads.
1027*/
1028injectedJavaScript?: string
1029
1030onNavigationStateChange?: ( event: NavState ) => void
1031
1032/**
1033* Allows custom handling of any webview requests by a JS handler.
1034* Return true or false from this method to continue loading the request.
1035*/
1036onShouldStartLoadWithRequest?: () => boolean
1037
1038/**
1039* view to show if there's an error
1040*/
1041renderError?: () => ViewStatic
1042
1043/**
1044* loading indicator to show
1045*/
1046renderLoading?: () => ViewStatic
1047
1048scrollEnabled?: boolean
1049
1050startInLoadingState?: boolean
1051
1052style?: ViewStyle
1053
1054url: string
1055}
1056
1057
1058export interface WebViewStatic extends React.ComponentClass<WebViewProperties> {
1059
1060goBack: () => void
1061goForward: () => void
1062reload: () => void
1063}
1064
1065
1066/**
1067* @see
1068*/
1069export interface SegmentedControlIOSProperties {
1070/// TODO
1071}
1072
1073
1074export interface NavigatorIOSProperties extends React.Props<NavigatorIOSStatic> {
1075
1076/**
1077* NavigatorIOS uses "route" objects to identify child views, their props, and navigation bar configuration.
1078* "push" and all the other navigation operations expect routes to be like this
1079*/
1080initialRoute?: Route
1081
1082/**
1083* The default wrapper style for components in the navigator.
1084* A common use case is to set the backgroundColor for every page
1085*/
1086itemWrapperStyle?: ViewStyle
1087
1088/**
1089* A Boolean value that indicates whether the navigation bar is hidden
1090*/
1091navigationBarHidden?: boolean
1092
1093/**
1094* A Boolean value that indicates whether to hide the 1px hairline shadow
1095*/
1096shadowHidden?: boolean
1097
1098/**
1099* The color used for buttons in the navigation bar
1100*/
1101tintColor?: string
1102
1103/**
1104* The text color of the navigation bar title
1105*/
1106titleTextColor?: string
1107
1108/**
1109* A Boolean value that indicates whether the navigation bar is translucent
1110*/
1111translucent?: boolean
1112
1113/**
1114* NOT IN THE DOC BUT IN THE EXAMPLES
1115*/
1116style?: ViewStyle
1117}
1118
1119/**
1120* A navigator is an object of navigation functions that a view can call.
1121* It is passed as a prop to any component rendered by NavigatorIOS.
1122*
1123* Navigator functions are also available on the NavigatorIOS component:
1124*
1125* @see https://facebook.github.io/react-native/docs/navigatorios.html#navigator
1126*/
1127export interface NavigationIOS {
1128/**
1129* Navigate forward to a new route
1130*/
1131push: ( route: Route ) => void
1132
1133/**
1134* Go back one page
1135*/
1136pop: () => void
1137
1138/**
1139* Go back N pages at once. When N=1, behavior matches pop()
1140*/
1141popN: ( n: number ) => void
1142
1143/**
1144* Replace the route for the current page and immediately load the view for the new route
1145*/
1146replace: ( route: Route ) => void
1147
1148/**
1149* Replace the route/view for the previous page
1150*/
1151replacePrevious: ( route: Route ) => void
1152
1153/**
1154* Replaces the previous route/view and transitions back to it
1155*/
1156replacePreviousAndPop: ( route: Route ) => void
1157
1158/**
1159* Replaces the top item and popToTop
1160*/
1161resetTo: ( route: Route ) => void
1162
1163/**
1164* Go back to the item for a particular route object
1165*/
1166popToRoute( route: Route ): void
1167
1168/**
1169* Go back to the top item
1170*/
1171popToTop(): void
1172}
1173
1174export interface NavigatorIOSStatic extends NavigationIOS, React.ComponentClass<NavigatorIOSProperties> {
1175}
1176
1177
1178/**
1179* @see https://facebook.github.io/react-native/docs/activityindicatorios.html#props
1180*/
1181export interface ActivityIndicatorIOSProperties extends React.Props<ActivityIndicatorIOSStatic> {
1182
1183/**
1184* Whether to show the indicator (true, the default) or hide it (false).
1185*/
1186animating?: boolean
1187
1188/**
1189* The foreground color of the spinner (default is gray).
1190*/
1191color?: string
1192
1193/**
1194* Whether the indicator should hide when not animating (true by default).
1195*/
1196hidesWhenStopped?: boolean
1197
1198/**
1199* Invoked on mount and layout changes with
1200*/
1201onLayout?: ( event: {nativeEvent: { layout: {x: number, y: number , width: number, height: number}}} ) => void
1202
1203/**
1204* Size of the indicator.
1205* Small has a height of 20, large has a height of 36.
1206*
1207* enum('small', 'large')
1208*/
1209size?: string
1210
1211style?: ViewStyle
1212}
1213
1214export interface ActivityIndicatorIOSStatic extends React.ComponentClass<ActivityIndicatorIOSProperties> {
1215}
1216
1217
1218export interface DatePickerIOSProperties extends React.Props<DatePickerIOSStatic> {
1219
1220/**
1221* The currently selected date.
1222*/
1223date?: Date
1224
1225
1226/**
1227* Maximum date.
1228* Restricts the range of possible date/time values.
1229*/
1230maximumDate?: Date
1231
1232/**
1233* Maximum date.
1234* Restricts the range of possible date/time values.
1235*/
1236minimumDate?: Date
1237
1238/**
1239* enum(1, 2, 3, 4, 5, 6, 10, 12, 15, 20, 30)
1240* The interval at which minutes can be selected.
1241*/
1242minuteInterval?: number
1243
1244/**
1245* enum('date', 'time', 'datetime')
1246* The date picker mode.
1247*/
1248mode?: string
1249
1250/**
1251* Date change handler.
1252* This is called when the user changes the date or time in the UI.
1253* The first and only argument is a Date object representing the new date and time.
1254*/
1255onDateChange?: ( newDate: Date ) => void
1256
1257/**
1258* Timezone offset in minutes.
1259* By default, the date picker will use the device's timezone. With this parameter, it is possible to force a certain timezone offset.
1260* For instance, to show times in Pacific Standard Time, pass -7 * 60.
1261*/
1262timeZoneOffsetInMinutes?: number
1263
1264}
1265
1266export interface DatePickerIOSStatic extends React.ComponentClass<DatePickerIOSProperties> {
1267}
1268
1269
1270/**
1271* @see PickerIOS.ios.js
1272*/
1273export interface PickerIOSItemProperties extends React.Props<PickerIOSItemStatic> {
1274value?: string | number
1275label?: string
1276}
1277
1278/**
1279* @see PickerIOS.ios.js
1280*/
1281export interface PickerIOSItemStatic extends React.ComponentClass<PickerIOSItemProperties> {
1282}
1283
1284
1285/**
1286* @see https://facebook.github.io/react-native/docs/pickerios.html
1287* @see PickerIOS.ios.js
1288*/
1289export interface PickerIOSProperties extends React.Props<PickerIOSStatic> {
1290
1291onValueChange?: ( value: string | number ) => void
1292
1293selectedValue?: string | number
1294
1295style?: ViewStyle
1296}
1297
1298/**
1299* @see https://facebook.github.io/react-native/docs/pickerios.html
1300* @see PickerIOS.ios.js
1301*/
1302export interface PickerIOSStatic extends React.ComponentClass<PickerIOSProperties> {
1303
1304Item: PickerIOSItemStatic
1305}
1306
1307
1308/**
1309* @see https://facebook.github.io/react-native/docs/sliderios.html
1310*/
1311export interface SliderIOSProperties extends React.Props<SliderIOSStatic> {
1312
1313/**
1314* If true the user won't be able to move the slider. Default value is false.
1315*/
1316disabled?: boolean
1317
1318/**
1319* Initial maximum value of the slider. Default value is 1.
1320*/
1321maximumValue?: number
1322
1323/**
1324* The color used for the track to the right of the button. Overrides the default blue gradient image.
1325*/
1326maximumTrackTintColor?: string
1327
1328/**
1329* Initial minimum value of the slider. Default value is 0.
1330*/
1331minimumValue?: number
1332
1333/**
1334* The color used for the track to the left of the button. Overrides the default blue gradient image.
1335*/
1336minimumTrackTintColor?: string
1337
1338/**
1339* Callback called when the user finishes changing the value (e.g. when the slider is released).
1340*/
1341onSlidingComplete?: () => void
1342
1343/**
1344* Callback continuously called while the user is dragging the slider.
1345*/
1346onValueChange?: ( value: number ) => void
1347
1348/**
1349* Step value of the slider.
1350* The value should be between 0 and (maximumValue - minimumValue).
1351* Default value is 0.
1352*/
1353step?: number
1354
1355/**
1356* Used to style and layout the Slider.
1357* @see StyleSheet.js and ViewStylePropTypes.js for more info.
1358*/
1359style?: ViewStyle
1360
1361/**
1362* Initial value of the slider.
1363* The value should be between minimumValue and maximumValue, which default to 0 and 1 respectively.
1364* Default value is 0.
1365*
1366* This is not a controlled component, e.g. if you don't update the value, the component won't be reset to its inital value.
1367*/
1368value?: number
1369}
1370
1371export interface SliderIOSStatic extends React.ComponentClass<SliderIOSProperties> {
1372
1373}
1374
1375/**
1376* //FIXME: no dcumentation, inferred
1377* @see SwitchIOS.ios.js
1378*/
1379export interface SwitchIOSStyle extends ViewStyle {
1380height?: number
1381width?: number
1382}
1383
1384
1385/**
1386* https://facebook.github.io/react-native/docs/switchios.html#props
1387*/
1388export interface SwitchIOSProperties extends React.Props<SwitchIOSStatic> {
1389
1390/**
1391* If true the user won't be able to toggle the switch. Default value is false.
1392*/
1393disabled?: boolean
1394
1395/**
1396* Background color when the switch is turned on.
1397*/
1398onTintColor?: string
1399
1400/**
1401* Callback that is called when the user toggles the switch.
1402*/
1403onValueChange?: ( value: boolean ) => void
1404
1405/**
1406* Background color for the switch round button.
1407*/
1408thumbTintColor?: string
1409
1410/**
1411* Background color when the switch is turned off.
1412*/
1413tintColor?: string
1414
1415/**
1416* The value of the switch, if true the switch will be turned on. Default value is false.
1417*/
1418value?: boolean
1419
1420style?: SwitchIOSStyle
1421}
1422
1423/**
1424*
1425* Use SwitchIOS to render a boolean input on iOS.
1426*
1427* 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,
1428* otherwise the user's change will be reverted immediately to reflect props.value as the source of truth.
1429*
1430* @see https://facebook.github.io/react-native/docs/switchios.html
1431*/
1432export interface SwitchIOSStatic extends React.ComponentClass<SwitchIOSProperties> {
1433
1434}
1435
1436
1437/**
1438* @see ImageResizeMode.js
1439*/
1440export interface ImageResizeModeStatic {
1441/**
1442* contain - The image will be resized such that it will be completely
1443* visible, contained within the frame of the View.
1444*/
1445contain: string
1446/**
1447* cover - The image will be resized such that the entire area of the view
1448* is covered by the image, potentially clipping parts of the image.
1449*/
1450cover: string
1451/**
1452* stretch - The image will be stretched to fill the entire frame of the
1453* view without clipping. This may change the aspect ratio of the image,
1454* distoring it. Only supported on iOS.
1455*/
1456stretch: string
1457}
1458
1459/**
1460* Image style
1461* @see https://facebook.github.io/react-native/docs/image.html#style
1462*/
1463export interface ImageStyle extends FlexStyle, TransformsStyle {
1464resizeMode?: string //Object.keys(ImageResizeMode)
1465backgroundColor?: string
1466borderColor?: string
1467borderWidth?: number
1468borderRadius?: number
1469overflow?: string // enum('visible', 'hidden')
1470tintColor?: string
1471opacity?: number
1472}
1473
1474export interface ImagePropertiesIOS {
1475/**
1476* The text that's read by the screen reader when the user interacts with the image.
1477*/
1478accessibilityLabel?: string;
1479
1480/**
1481* When true, indicates the image is an accessibility element.
1482*/
1483accessible?: boolean;
1484
1485/**
1486* When the image is resized, the corners of the size specified by capInsets will stay a fixed size,
1487* but the center content and borders of the image will be stretched.
1488* This is useful for creating resizable rounded buttons, shadows, and other resizable assets.
1489* More info on Apple documentation
1490*/
1491capInsets?: Insets
1492
1493/**
1494* A static image to display while downloading the final image off the network.
1495*/
1496defaultSource?: {uri: string}
1497
1498/**
1499* Invoked on load error with {nativeEvent: {error}}
1500*/
1501onError?: ( error: {nativeEvent: any} ) => void
1502
1503/**
1504* Invoked when load completes successfully
1505*/
1506onLoad?: () => void
1507
1508/**
1509* Invoked when load either succeeds or fails
1510*/
1511onLoadEnd?: () => void
1512
1513/**
1514* Invoked on load start
1515*/
1516onLoadStart?: () => void
1517
1518/**
1519* Invoked on download progress with {nativeEvent: {loaded, total}}
1520*/
1521onProgress?: ()=> void
1522}
1523
1524/**
1525* @see https://facebook.github.io/react-native/docs/image.html
1526*/
1527export interface ImageProperties extends ImagePropertiesIOS, React.Props<Image> {
1528/**
1529* onLayout function
1530*
1531* Invoked on mount and layout changes with
1532*
1533* {nativeEvent: { layout: {x, y, width, height}}}.
1534*/
1535onLayout?: ( event: LayoutChangeEvent ) => void;
1536
1537
1538/**
1539* Determines how to resize the image when the frame doesn't match the raw image dimensions.
1540*
1541* enum('cover', 'contain', 'stretch')
1542*/
1543resizeMode?: string;
1544
1545/**
1546* uri is a string representing the resource identifier for the image,
1547* which could be an http address, a local file path,
1548* or the name of a static image resource (which should be wrapped in the require('image!name') function).
1549*/
1550source: {uri: string} | string;
1551
1552/**
1553*
1554* Style
1555*/
1556style?: ImageStyle;
1557
1558/**
1559* A unique identifier for this element to be used in UI Automation testing scripts.
1560*/
1561testID?: string;
1562
1563}
1564
1565export interface ImageStatic extends React.ComponentClass<ImageProperties> {
1566uri: string;
1567resizeMode: ImageResizeModeStatic
1568}
1569
1570
1571/**
1572* @see https://facebook.github.io/react-native/docs/listview.html#props
1573*/
1574export interface ListViewProperties extends ScrollViewProperties, React.Props<ListViewStatic> {
1575
1576dataSource?: ListViewDataSource
1577
1578/**
1579* How many rows to render on initial component mount. Use this to make
1580* it so that the first screen worth of data apears at one time instead of
1581* over the course of multiple frames.
1582*/
1583initialListSize?: number
1584
1585/**
1586* (visibleRows, changedRows) => void
1587*
1588* Called when the set of visible rows changes. `visibleRows` maps
1589* { sectionID: { rowID: true }} for all the visible rows, and
1590* `changedRows` maps { sectionID: { rowID: true | false }} for the rows
1591* that have changed their visibility, with true indicating visible, and
1592* false indicating the view has moved out of view.
1593*/
1594onChangeVisibleRows?: ( visibleRows: Array<{[sectionId: string]: {[rowID: string]: boolean}}>, changedRows: Array<{[sectionId: string]: {[rowID: string]: boolean}}> ) => void
1595
1596/**
1597* Called when all rows have been rendered and the list has been scrolled
1598* to within onEndReachedThreshold of the bottom. The native scroll
1599* event is provided.
1600*/
1601onEndReached?: () => void
1602
1603/**
1604* Threshold in pixels for onEndReached.
1605*/
1606onEndReachedThreshold?: number
1607
1608/**
1609* Number of rows to render per event loop.
1610*/
1611pageSize?: number
1612
1613/**
1614* An experimental performance optimization for improving scroll perf of
1615* large lists, used in conjunction with overflow: 'hidden' on the row
1616* containers. Use at your own risk.
1617*/
1618removeClippedSubviews?: boolean
1619
1620/**
1621* () => renderable
1622*
1623* The header and footer are always rendered (if these props are provided)
1624* on every render pass. If they are expensive to re-render, wrap them
1625* in StaticContainer or other mechanism as appropriate. Footer is always
1626* at the bottom of the list, and header at the top, on every render pass.
1627*/
1628renderFooter?: () => React.ReactElement<any>
1629
1630/**
1631* () => renderable
1632*
1633* The header and footer are always rendered (if these props are provided)
1634* on every render pass. If they are expensive to re-render, wrap them
1635* in StaticContainer or other mechanism as appropriate. Footer is always
1636* at the bottom of the list, and header at the top, on every render pass.
1637*/
1638renderHeader?: () => React.ReactElement<any>
1639
1640/**
1641* (rowData, sectionID, rowID) => renderable
1642* Takes a data entry from the data source and its ids and should return
1643* a renderable component to be rendered as the row. By default the data
1644* is exactly what was put into the data source, but it's also possible to
1645* provide custom extractors.
1646*/
1647renderRow?: ( rowData: any, sectionID: string | number, rowID: string | number, highlightRow?: boolean ) => React.ReactElement<any>
1648
1649
1650/**
1651* A function that returns the scrollable component in which the list rows are rendered.
1652* Defaults to returning a ScrollView with the given props.
1653*/
1654renderScrollComponent?: ( props: ScrollViewProperties ) => React.ReactElement<ScrollViewProperties>
1655
1656/**
1657* (sectionData, sectionID) => renderable
1658*
1659* If provided, a sticky header is rendered for this section. The sticky
1660* behavior means that it will scroll with the content at the top of the
1661* section until it reaches the top of the screen, at which point it will
1662* stick to the top until it is pushed off the screen by the next section
1663* header.
1664*/
1665renderSectionHeader?: ( sectionData: any, sectionId: string | number ) => React.ReactElement<any>
1666
1667
1668/**
1669* (sectionID, rowID, adjacentRowHighlighted) => renderable
1670* If provided, a renderable component to be rendered as the separator below each row
1671* but not the last row if there is a section header below.
1672* Take a sectionID and rowID of the row above and whether its adjacent row is highlighted.
1673*/
1674renderSeparator?: ( sectionID: string | number, rowID: string | number, adjacentRowHighlighted?: boolean ) => React.ReactElement<any>
1675
1676/**
1677* How early to start rendering rows before they come on screen, in
1678* pixels.
1679*/
1680scrollRenderAheadDistance?: number
1681}
1682
1683export interface ListViewStatic extends React.ComponentClass<ListViewProperties> {
1684DataSource: ListViewDataSource;
1685}
1686
1687
1688export interface MapViewAnnotation {
1689latitude?: number
1690longitude?: number
1691animateDrop?: boolean
1692title?: string
1693subtitle?: string
1694hasLeftCallout?: boolean
1695hasRightCallout?: boolean
1696onLeftCalloutPress?: () => void
1697onRightCalloutPress?: () => void
1698id?: string
1699}
1700
1701export interface MapViewRegion {
1702latitude: number
1703longitude: number
1704latitudeDelta: number
1705longitudeDelta: number
1706}
1707
1708export interface MapViewPropertiesIOS {
1709
1710/**
1711* If false points of interest won't be displayed on the map.
1712* Default value is true.
1713*/
1714showsPointsOfInterest?: boolean
1715}
1716
1717export interface MapViewProperties extends MapViewPropertiesIOS, Touchable, React.Props<MapViewStatic> {
1718
1719/**
1720* Map annotations with title/subtitle.
1721*/
1722annotations?: MapViewAnnotation[]
1723
1724/**
1725* Insets for the map's legal label, originally at bottom left of the map. See EdgeInsetsPropType.js for more information.
1726*/
1727legalLabelInsets?: Insets
1728
1729/**
1730* The map type to be displayed.
1731* standard: standard road map (default)
1732* satellite: satellite view
1733* hybrid: satellite view with roads and points of interest overlayed
1734*
1735* enum('standard', 'satellite', 'hybrid')
1736*/
1737mapType?: string
1738
1739/**
1740* Maximum size of area that can be displayed.
1741*/
1742maxDelta?: number
1743
1744/**
1745* Minimum size of area that can be displayed.
1746*/
1747minDelta?: number
1748
1749/**
1750* Callback that is called once, when the user taps an annotation.
1751*/
1752onAnnotationPress?: () => void
1753
1754/**
1755* Callback that is called continuously when the user is dragging the map.
1756*/
1757onRegionChange?: ( region: MapViewRegion ) => void
1758
1759/**
1760* Callback that is called once, when the user is done moving the map.
1761*/
1762onRegionChangeComplete?: ( region: MapViewRegion ) => void
1763
1764/**
1765* When this property is set to true and a valid camera is associated with the map,
1766* the camera’s pitch angle is used to tilt the plane of the map.
1767*
1768* When this property is set to false, the camera’s pitch angle is ignored and
1769* the map is always displayed as if the user is looking straight down onto it.
1770*/
1771pitchEnabled?: boolean
1772
1773/**
1774* The region to be displayed by the map.
1775* The region is defined by the center coordinates and the span of coordinates to display.
1776*/
1777region?: MapViewRegion
1778
1779/**
1780* When this property is set to true and a valid camera is associated with the map,
1781* the camera’s heading angle is used to rotate the plane of the map around its center point.
1782*
1783* When this property is set to false, the camera’s heading angle is ignored and the map is always oriented
1784* so that true north is situated at the top of the map view
1785*/
1786rotateEnabled?: boolean
1787
1788/**
1789* If false the user won't be able to change the map region being displayed.
1790* Default value is true.
1791*/
1792scrollEnabled?: boolean
1793
1794/**
1795* If true the app will ask for the user's location and focus on it.
1796* Default value is false.
1797*
1798* NOTE: You need to add NSLocationWhenInUseUsageDescription key in Info.plist to enable geolocation,
1799* otherwise it is going to fail silently!
1800*/
1801showsUserLocation?: boolean
1802
1803/**
1804* Used to style and layout the MapView.
1805* See StyleSheet.js and ViewStylePropTypes.js for more info.
1806*/
1807style?: ViewStyle
1808
1809/**
1810* If false the user won't be able to pinch/zoom the map.
1811* Default value is true.
1812*/
1813zoomEnabled?: boolean
1814}
1815
1816/**
1817* @see https://facebook.github.io/react-native/docs/mapview.html#content
1818*/
1819export interface MapViewStatic extends React.ComponentClass<MapViewProperties> {
1820}
1821
1822
1823export interface TouchableWithoutFeedbackAndroidProperties {
1824
1825/**
1826* Indicates to accessibility services to treat UI component like a native one.
1827* Works for Android only.
1828*
1829* @enum('none', 'button', 'radiobutton_checked', 'radiobutton_unchecked' )
1830*/
1831accessibilityComponentType?: string
1832}
1833
1834export interface TouchableWithoutFeedbackIOSProperties {
1835
1836/**
1837* Provides additional traits to screen reader.
1838* By default no traits are provided unless specified otherwise in element
1839*
1840* @enum('none', 'button', 'link', 'header', 'search', 'image', 'selected', 'plays', 'key', 'text','summary', 'disabled', 'frequentUpdates', 'startsMedia', 'adjustable', 'allowsDirectInteraction', 'pageTurn')
1841*/
1842accessibilityTraits?: string | string[];
1843
1844}
1845
1846/**
1847* @see https://facebook.github.io/react-native/docs/touchablewithoutfeedback.html#props
1848*/
1849export interface TouchableWithoutFeedbackProperties extends TouchableWithoutFeedbackAndroidProperties, TouchableWithoutFeedbackIOSProperties {
1850
1851
1852/**
1853* Called when the touch is released, but not if cancelled (e.g. by a scroll that steals the responder lock).
1854*/
1855accessible?: boolean
1856
1857/**
1858* Delay in ms, from onPressIn, before onLongPress is called.
1859*/
1860delayLongPress?: number;
1861
1862/**
1863* Delay in ms, from the start of the touch, before onPressIn is called.
1864*/
1865delayPressIn?: number;
1866
1867/**
1868* Delay in ms, from the release of the touch, before onPressOut is called.
1869*/
1870delayPressOut?: number;
1871
1872/**
1873* Invoked on mount and layout changes with
1874* {nativeEvent: {layout: {x, y, width, height}}}
1875*/
1876onLayout?: ( event: LayoutChangeEvent ) => void
1877
1878onLongPress?: () => void;
1879
1880/**
1881* Called when the touch is released,
1882* but not if cancelled (e.g. by a scroll that steals the responder lock).
1883*/
1884onPress?: () => void;
1885
1886onPressIn?: () => void;
1887
1888onPressOut?: () => void;
1889
1890/**
1891* //FIXME: not in doc but available in exmaples
1892*/
1893style?: ViewStyle
1894}
1895
1896
1897export interface TouchableWithoutFeedbackProps extends TouchableWithoutFeedbackProperties, React.Props<TouchableWithoutFeedbackStatic> {
1898
1899}
1900
1901/**
1902* Do not use unless you have a very good reason.
1903* All the elements that respond to press should have a visual feedback when touched.
1904* This is one of the primary reason a "web" app doesn't feel "native".
1905*
1906* @see https://facebook.github.io/react-native/docs/touchablewithoutfeedback.html
1907*/
1908export interface TouchableWithoutFeedbackStatic extends React.ComponentClass<TouchableWithoutFeedbackProps> {
1909
1910}
1911
1912
1913/**
1914* @see https://facebook.github.io/react-native/docs/touchablehighlight.html#props
1915*/
1916export interface TouchableHighlightProperties extends TouchableWithoutFeedbackProperties, React.Props<TouchableHighlightStatic> {
1917
1918/**
1919* Determines what the opacity of the wrapped view should be when touch is active.
1920*/
1921activeOpacity?: number
1922
1923/**
1924*
1925* Called immediately after the underlay is hidden
1926*/
1927onHideUnderlay?: () => void
1928
1929/**
1930* Called immediately after the underlay is shown
1931*/
1932onShowUnderlay?: () => void
1933
1934/**
1935* @see https://facebook.github.io/react-native/docs/view.html#style
1936*/
1937style?: ViewStyle
1938
1939
1940/**
1941* The color of the underlay that will show through when the touch is active.
1942*/
1943underlayColor?: string
1944}
1945
1946/**
1947* A wrapper for making views respond properly to touches.
1948* On press down, the opacity of the wrapped view is decreased,
1949* which allows the underlay color to show through, darkening or tinting the view.
1950* The underlay comes from adding a view to the view hierarchy,
1951* which can sometimes cause unwanted visual artifacts if not used correctly,
1952* for example if the backgroundColor of the wrapped view isn't explicitly set to an opaque color.
1953*
1954* NOTE: TouchableHighlight supports only one child
1955* If you wish to have several child components, wrap them in a View.
1956*
1957* @see https://facebook.github.io/react-native/docs/touchablehighlight.html
1958*/
1959export interface TouchableHighlightStatic extends React.ComponentClass<TouchableHighlightProperties> {
1960}
1961
1962
1963/**
1964* @see https://facebook.github.io/react-native/docs/touchableopacity.html#props
1965*/
1966export interface TouchableOpacityProperties extends TouchableWithoutFeedbackProperties, React.Props<TouchableOpacityStatic> {
1967/**
1968* Determines what the opacity of the wrapped view should be when touch is active.
1969* Defaults to 0.2
1970*/
1971activeOpacity?: number
1972}
1973
1974/**
1975* A wrapper for making views respond properly to touches.
1976* On press down, the opacity of the wrapped view is decreased, dimming it.
1977* This is done without actually changing the view hierarchy,
1978* and in general is easy to add to an app without weird side-effects.
1979*
1980* @see https://facebook.github.io/react-native/docs/touchableopacity.html
1981*/
1982export interface TouchableOpacityStatic extends React.ComponentClass<TouchableOpacityProperties> {
1983}
1984
1985
1986/**
1987* @see https://facebook.github.io/react-native/docs/touchableopacity.html#props
1988*/
1989export interface TouchableNativeFeedbackProperties extends TouchableWithoutFeedbackProperties, React.Props<TouchableNativeFeedbackStatic> {
1990/**
1991* Determines the type of background drawable that's going to be used to display feedback.
1992* It takes an object with type property and extra data depending on the type.
1993* It's recommended to use one of the following static methods to generate that dictionary:
1994* 1) TouchableNativeFeedback.SelectableBackground() - will create object that represents android theme's default background for selectable elements (?android:attr/selectableItemBackground)
1995* 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+
1996* 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+
1997*/
1998background?: any
1999}
2000
2001/**
2002* A wrapper for making views respond properly to touches (Android only).
2003* On Android this component uses native state drawable to display touch feedback.
2004* At the moment it only supports having a single View instance as a child node,
2005* as it's implemented by replacing that View with another instance of RCTView node with some additional properties set.
2006*
2007* Background drawable of native feedback touchable can be customized with background property.
2008*
2009* @see https://facebook.github.io/react-native/docs/touchablenativefeedback.html#content
2010*/
2011export interface TouchableNativeFeedbackStatic extends React.ComponentClass<TouchableNativeFeedbackProperties> {
2012SelectableBackground: () => TouchableNativeFeedbackStatic
2013SelectableBackgroundBorderless: () => TouchableNativeFeedbackStatic
2014Ripple: ( color: string, borderless?: boolean ) => TouchableNativeFeedbackStatic
2015}
2016
2017
2018export interface LeftToRightGesture {
2019//TODO:
2020}
2021
2022export interface AnimationInterpolator {
2023//TODO:
2024}
2025
2026// see /NavigatorSceneConfigs.js
2027export interface SceneConfig {
2028// A list of all gestures that are enabled on this scene
2029gestures: {
2030pop: LeftToRightGesture,
2031},
2032
2033// Rebound spring parameters when transitioning FROM this scene
2034springFriction: number;
2035springTension: number;
2036
2037// Velocity to start at when transitioning without gesture
2038defaultTransitionVelocity: number;
2039
2040// Animation interpolators for horizontal transitioning:
2041animationInterpolators: {
2042into: AnimationInterpolator,
2043out: AnimationInterpolator
2044};
2045
2046}
2047
2048// see /NavigatorSceneConfigs.js
2049export interface SceneConfigs {
2050FloatFromBottom: SceneConfig;
2051FloatFromRight: SceneConfig;
2052PushFromRight: SceneConfig;
2053FloatFromLeft: SceneConfig;
2054HorizontalSwipeJump: SceneConfig;
2055}
2056
2057export interface Route {
2058component?: ComponentClass<ViewProperties>
2059id?: string
2060title?: string
2061passProps?: Object;
2062
2063//anything else
2064[key: string]: any
2065
2066//Commonly found properties
2067backButtonTitle?: string
2068content?: string
2069message?: string;
2070index?: number
2071onRightButtonPress?: () => void
2072rightButtonTitle?: string
2073sceneConfig?: SceneConfig
2074wrapperStyle?: any
2075}
2076
2077
2078/**
2079* @see https://facebook.github.io/react-native/docs/navigator.html#content
2080*/
2081export interface NavigatorProperties extends React.Props<Navigator> {
2082/**
2083* Optional function that allows configuration about scene animations and gestures.
2084* Will be invoked with the route and should return a scene configuration object
2085* @param route
2086*/
2087configureScene?: ( route: Route ) => SceneConfig
2088/**
2089* Specify a route to start on.
2090* A route is an object that the navigator will use to identify each scene to render.
2091* initialRoute must be a route in the initialRouteStack if both props are provided.
2092* The initialRoute will default to the last item in the initialRouteStack.
2093*/
2094initialRoute?: Route
2095/**
2096* Provide a set of routes to initially mount.
2097* Required if no initialRoute is provided.
2098* Otherwise, it will default to an array containing only the initialRoute
2099*/
2100initialRouteStack?: Route[]
2101
2102/**
2103* Optionally provide a navigation bar that persists across scene transitions
2104*/
2105navigationBar?: React.ReactElement<NavigatorStatic.NavigationBarProperties>
2106
2107/**
2108* Optionally provide the navigator object from a parent Navigator
2109*/
2110navigator?: Navigator
2111
2112/**
2113* @deprecated Use navigationContext.addListener('willfocus', callback) instead.
2114*/
2115onDidFocus?: Function
2116
2117/**
2118* @deprecated Use navigationContext.addListener('willfocus', callback) instead.
2119*/
2120onWillFocus?: Function
2121
2122/**
2123* Required function which renders the scene for a given route.
2124* Will be invoked with the route and the navigator object
2125* @param route
2126* @param navigator
2127*/
2128renderScene?: ( route: Route, navigator: Navigator ) => React.ReactElement<ViewProperties>
2129
2130/**
2131* Styles to apply to the container of each scene
2132*/
2133sceneStyle?: ViewStyle
2134
2135/**
2136* //FIXME: not found in doc but found in examples
2137*/
2138debugOverlay?: boolean
2139
2140}
2141
2142/**
2143* Use Navigator to transition between different scenes in your app.
2144* To accomplish this, provide route objects to the navigator to identify each scene,
2145* and also a renderScene function that the navigator can use to render the scene for a given route.
2146*
2147* To change the animation or gesture properties of the scene, provide a configureScene prop to get the config object for a given route.
2148* See Navigator.SceneConfigs for default animations and more info on scene config options.
2149* @see https://facebook.github.io/react-native/docs/navigator.html
2150*/
2151export interface NavigatorStatic extends React.ComponentClass<NavigatorProperties> {
2152SceneConfigs: SceneConfigs;
2153NavigationBar: NavigatorStatic.NavigationBarStatic;
2154BreadcrumbNavigationBar: NavigatorStatic.BreadcrumbNavigationBarStatic
2155
2156getContext( self: any ): NavigatorStatic;
2157
2158/**
2159* returns the current list of routes
2160*/
2161getCurrentRoutes(): Route[];
2162
2163/**
2164* Jump backward without unmounting the current scen
2165*/
2166jumpBack(): void;
2167
2168/**
2169* Jump forward to the next scene in the route stack
2170*/
2171jumpForward(): void;
2172
2173/**
2174* Transition to an existing scene without unmounting
2175*/
2176jumpTo( route: Route ): void;
2177
2178/**
2179* Navigate forward to a new scene, squashing any scenes that you could jumpForward to
2180*/
2181push( route: Route ): void;
2182
2183/**
2184* Transition back and unmount the current scene
2185*/
2186pop(): void;
2187
2188/**
2189* Replace the current scene with a new route
2190*/
2191replace( route: Route ): void;
2192
2193/**
2194* Replace a scene as specified by an index
2195*/
2196replaceAtIndex( route: Route, index: number ): void;
2197
2198/**
2199* Replace the previous scene
2200*/
2201replacePrevious( route: Route ): void;
2202
2203/**
2204* Reset every scene with an array of routes
2205*/
2206immediatelyResetRouteStack( routes: Route[] ): void;
2207
2208/**
2209* Pop to a particular scene, as specified by its route. All scenes after it will be unmounted
2210*/
2211popToRoute( route: Route ): void;
2212
2213/**
2214* Pop to the first scene in the stack, unmounting every other scene
2215*/
2216popToTop(): void;
2217
2218}
2219
2220namespace NavigatorStatic {
2221
2222
2223export interface NavState {
2224routeStack: Route[]
2225idStack: number[]
2226presentedIndex: number
2227}
2228
2229export interface NavigationBarStyle {
2230//TODO @see NavigationBarStyle.ios.js
2231}
2232
2233
2234export interface NavigationBarRouteMapper {
2235Title: ( route: Route, nav: Navigator, index: number, navState: NavState ) => React.ReactElement<any>;
2236LeftButton: ( route: Route, nav: Navigator, index: number, navState: NavState )=> React.ReactElement<any>;
2237RightButton: ( route: Route, nav: Navigator, index: number, navState: NavState )=> React.ReactElement<any>;
2238}
2239
2240/**
2241* @see NavigatorNavigationBar.js
2242*/
2243export interface NavigationBarProperties extends React.Props<NavigationBarStatic> {
2244navigator?: Navigator
2245routeMapper?: NavigationBarRouteMapper
2246navState?: NavState
2247style?: ViewStyle
2248}
2249
2250export interface NavigationBarStatic extends React.ComponentClass<NavigationBarProperties> {
2251Styles: NavigationBarStyle
2252
2253}
2254
2255export type NavigationBar = NavigationBarStatic
2256export var NavigationBar: NavigationBarStatic
2257
2258
2259export interface BreadcrumbNavigationBarStyle {
2260//TODO &see NavigatorBreadcrumbNavigationBar.js
2261}
2262
2263export interface BreadcrumbNavigationBarRouteMapper {
2264rightContentForRoute: ( route: Route, navigator: Navigator ) => React.ReactElement<any>
2265titleContentForRoute: ( route: Route, navigator: Navigator ) => React.ReactElement<any>
2266iconForRoute: ( route: Route, navigator: Navigator ) => React.ReactElement<any>
2267//in samples...
2268separatorForRoute: ( route: Route, navigator: Navigator ) => React.ReactElement<any>
2269}
2270
2271/**
2272* @see NavigatorNavigationBar.js
2273*/
2274export interface BreadcrumbNavigationBarProperties extends React.Props<BreadcrumbNavigationBarStatic> {
2275navigator?: Navigator
2276routeMapper?: BreadcrumbNavigationBarRouteMapper
2277navState?: NavState
2278style?: ViewStyle
2279}
2280
2281export interface BreadcrumbNavigationBarStatic extends React.ComponentClass<BreadcrumbNavigationBarProperties> {
2282Styles: BreadcrumbNavigationBarStyle
2283}
2284
2285export type BreadcrumbNavigationBar = BreadcrumbNavigationBarStatic
2286var BreadcrumbNavigationBar: BreadcrumbNavigationBarStatic
2287
2288}
2289
2290
2291export interface StyleSheetStatic extends React.ComponentClass<StyleSheetProperties> {
2292create<T>( styles: T ): T;
2293}
2294
2295/**
2296* //FIXME: Could not find docs. Inferred from examples and jscode : ListViewDataSource.js
2297*/
2298export interface DataSourceAssetCallback {
2299rowHasChanged?: ( r1: any, r2: any ) => boolean
2300sectionHeaderHasChanged?: ( h1: any, h2: any ) => boolean
2301getRowData?: <T>( dataBlob: any, sectionID: number | string, rowID: number | string ) => T
2302getSectionHeaderData?: <T>( dataBlob: any, sectionID: number | string ) => T
2303}
2304
2305/**
2306* //FIXME: Could not find docs. Inferred from examples and js code: ListViewDataSource.js
2307*/
2308export interface ListViewDataSource {
2309new( onAsset: DataSourceAssetCallback ): ListViewDataSource;
2310/**
2311* Clones this `ListViewDataSource` with the specified `dataBlob` and
2312* `rowIdentities`. The `dataBlob` is just an aribitrary blob of data. At
2313* construction an extractor to get the interesting informatoin was defined
2314* (or the default was used).
2315*
2316* The `rowIdentities` is is a 2D array of identifiers for rows.
2317* ie. [['a1', 'a2'], ['b1', 'b2', 'b3'], ...]. If not provided, it's
2318* assumed that the keys of the section data are the row identities.
2319*
2320* Note: This function does NOT clone the data in this data source. It simply
2321* passes the functions defined at construction to a new data source with
2322* the data specified. If you wish to maintain the existing data you must
2323* handle merging of old and new data separately and then pass that into
2324* this function as the `dataBlob`.
2325*/
2326cloneWithRows<T>( dataBlob: Array<any> | {[key: string ]: any}, rowIdentities?: Array<string | number> ): ListViewDataSource
2327
2328/**
2329* This performs the same function as the `cloneWithRows` function but here
2330* you also specify what your `sectionIdentities` are. If you don't care
2331* about sections you should safely be able to use `cloneWithRows`.
2332*
2333* `sectionIdentities` is an array of identifiers for sections.
2334* ie. ['s1', 's2', ...]. If not provided, it's assumed that the
2335* keys of dataBlob are the section identities.
2336*
2337* Note: this returns a new object!
2338*/
2339cloneWithRowsAndSections( dataBlob: Array<any> | {[key: string]: any}, sectionIdentities?: Array<string | number>, rowIdentities?: Array<Array<string | number>> ): ListViewDataSource
2340
2341getRowCount(): number
2342
2343/**
2344* Gets the data required to render the row.
2345*/
2346getRowData( sectionIndex: number, rowIndex: number ): any
2347
2348/**
2349* Gets the rowID at index provided if the dataSource arrays were flattened,
2350* or null of out of range indexes.
2351*/
2352getRowIDForFlatIndex( index: number ): string
2353
2354/**
2355* Gets the sectionID at index provided if the dataSource arrays were flattened,
2356* or null for out of range indexes.
2357*/
2358getSectionIDForFlatIndex( index: number ): string
2359
2360/**
2361* Returns an array containing the number of rows in each section
2362*/
2363getSectionLengths(): Array<number>
2364
2365/**
2366* Returns if the section header is dirtied and needs to be rerendered
2367*/
2368sectionHeaderShouldUpdate( sectionIndex: number ): boolean
2369
2370/**
2371* Gets the data required to render the section header
2372*/
2373getSectionHeaderData( sectionIndex: number ): any
2374}
2375
2376
2377/**
2378* @see https://facebook.github.io/react-native/docs/tabbarios-item.html#props
2379*/
2380export interface TabBarItemProperties extends React.Props<TabBarItemStatic> {
2381
2382/**
2383* Little red bubble that sits at the top right of the icon.
2384*/
2385badge?: string | number
2386
2387/**
2388* A custom icon for the tab. It is ignored when a system icon is defined.
2389*/
2390icon?: {uri: string} | string
2391
2392/**
2393* Callback when this tab is being selected,
2394* you should change the state of your component to set selected={true}.
2395*/
2396onPress?: () => void
2397
2398/**
2399* It specifies whether the children are visible or not. If you see a blank content, you probably forgot to add a selected one.
2400*/
2401selected?: boolean
2402
2403/**
2404* A custom icon when the tab is selected.
2405* It is ignored when a system icon is defined. If left empty, the icon will be tinted in blue.
2406*/
2407selectedIcon?: {uri: string} | string;
2408
2409/**
2410* React style object.
2411*/
2412style?: ViewStyle
2413
2414/**
2415* Items comes with a few predefined system icons.
2416* Note that if you are using them, the title and selectedIcon will be overriden with the system ones.
2417*
2418* enum('bookmarks', 'contacts', 'downloads', 'favorites', 'featured', 'history', 'more', 'most-recent', 'most-viewed', 'recents', 'search', 'top-rated')
2419*/
2420systemIcon: string
2421
2422/**
2423* Text that appears under the icon. It is ignored when a system icon is defined.
2424*/
2425title?: string
2426
2427}
2428
2429export interface TabBarItemStatic extends React.ComponentClass<TabBarItemProperties> {
2430}
2431
2432/**
2433* @see https://facebook.github.io/react-native/docs/tabbarios.html#props
2434*/
2435export interface TabBarIOSProperties extends React.Props<TabBarIOSStatic> {
2436
2437/**
2438* Background color of the tab bar
2439*/
2440barTintColor?: string
2441
2442style?: ViewStyle
2443
2444/**
2445* Color of the currently selected tab icon
2446*/
2447tintColor?: string
2448
2449/**
2450* A Boolean value that indicates whether the tab bar is translucent
2451*/
2452translucent?: boolean
2453}
2454
2455export interface TabBarIOSStatic extends React.ComponentClass<TabBarIOSProperties> {
2456Item: TabBarItemStatic;
2457}
2458
2459
2460export interface PixelRatioStatic {
2461get(): number;
2462}
2463
2464export interface DeviceEventSubscriptionStatic {
2465remove(): void;
2466}
2467
2468export interface DeviceEventEmitterStatic {
2469addListener<T>( type: string, onReceived: ( data: T ) => void ): DeviceEventSubscription;
2470}
2471
2472// Used by Dimensions below
2473export interface ScaledSize {
2474width: number;
2475height: number;
2476scale: number;
2477}
2478
2479
2480export interface InteractionManagerStatic {
2481runAfterInteractions( fn: () => void ): void;
2482}
2483
2484
2485export interface ScrollViewStyle extends FlexStyle, TransformsStyle {
2486
2487backfaceVisibility?:string //enum('visible', 'hidden')
2488backgroundColor?: string
2489borderColor?: string
2490borderTopColor?: string
2491borderRightColor?: string
2492borderBottomColor?: string
2493borderLeftColor?: string
2494borderRadius?: number
2495borderTopLeftRadius?: number
2496borderTopRightRadius?: number
2497borderBottomLeftRadius?: number
2498borderBottomRightRadius?: number
2499borderStyle?: string //enum('solid', 'dotted', 'dashed')
2500borderWidth?: number
2501borderTopWidth?: number
2502borderRightWidth?: number
2503borderBottomWidth?: number
2504borderLeftWidth?: number
2505opacity?: number
2506overflow?: string //enum('visible', 'hidden')
2507shadowColor?: string
2508shadowOffset?: {width: number; height: number}
2509shadowOpacity?: number
2510shadowRadius?: number
2511}
2512
2513
2514export interface ScrollViewIOSProperties {
2515
2516/**
2517* When true the scroll view bounces horizontally when it reaches the end
2518* even if the content is smaller than the scroll view itself. The default
2519* value is true when `horizontal={true}` and false otherwise.
2520*/
2521alwaysBounceHorizontal?: boolean
2522/**
2523* When true the scroll view bounces vertically when it reaches the end
2524* even if the content is smaller than the scroll view itself. The default
2525* value is false when `horizontal={true}` and true otherwise.
2526*/
2527alwaysBounceVertical?: boolean
2528
2529/**
2530* Controls whether iOS should automatically adjust the content inset for scroll views that are placed behind a navigation bar or tab bar/ toolbar.
2531* The default value is true.
2532*/
2533automaticallyAdjustContentInsets?: boolean // true
2534
2535/**
2536* When true the scroll view bounces when it reaches the end of the
2537* content if the content is larger then the scroll view along the axis of
2538* the scroll direction. When false it disables all bouncing even if
2539* the `alwaysBounce*` props are true. The default value is true.
2540*/
2541bounces?: boolean
2542/**
2543* When true gestures can drive zoom past min/max and the zoom will animate
2544* to the min/max value at gesture end otherwise the zoom will not exceed
2545* the limits.
2546*/
2547bouncesZoom?: boolean
2548
2549/**
2550* When false once tracking starts won't try to drag if the touch moves.
2551* The default value is true.
2552*/
2553canCancelContentTouches?: boolean
2554
2555/**
2556* When true the scroll view automatically centers the content when the
2557* content is smaller than the scroll view bounds; when the content is
2558* larger than the scroll view this property has no effect. The default
2559* value is false.
2560*/
2561centerContent?: boolean
2562
2563
2564/**
2565* The amount by which the scroll view content is inset from the edges of the scroll view.
2566* Defaults to {0, 0, 0, 0}.
2567*/
2568contentInset?: Insets // zeros
2569
2570/**
2571* Used to manually set the starting scroll offset.
2572* The default value is {x: 0, y: 0}
2573*/
2574contentOffset?: PointProperties // zeros
2575
2576/**
2577* A floating-point number that determines how quickly the scroll view
2578* decelerates after the user lifts their finger. Reasonable choices include
2579* - Normal: 0.998 (the default)
2580* - Fast: 0.9
2581*/
2582decelerationRate?: number
2583
2584/**
2585* When true the ScrollView will try to lock to only vertical or horizontal
2586* scrolling while dragging. The default value is false.
2587*/
2588directionalLockEnabled?: boolean
2589
2590/**
2591* The maximum allowed zoom scale. The default value is 1.0.
2592*/
2593maximumZoomScale?: number
2594
2595/**
2596* The minimum allowed zoom scale. The default value is 1.0.
2597*/
2598minimumZoomScale?: number
2599
2600/**
2601* Called when a scrolling animation ends.
2602*/
2603onScrollAnimationEnd?: () => void
2604
2605/**
2606* When true the scroll view stops on multiples of the scroll view's size
2607* when scrolling. This can be used for horizontal pagination. The default
2608* value is false.
2609*/
2610pagingEnabled?: boolean
2611
2612/**
2613* When false, the content does not scroll. The default value is true
2614*/
2615scrollEnabled?: boolean // true
2616
2617/**
2618* This controls how often the scroll event will be fired while scrolling (in events per seconds).
2619* A higher number yields better accuracy for code that is tracking the scroll position,
2620* but can lead to scroll performance problems due to the volume of information being send over the bridge.
2621* The default value is zero, which means the scroll event will be sent only once each time the view is scrolled.
2622*/
2623scrollEventThrottle?: number // null
2624
2625/**
2626* The amount by which the scroll view indicators are inset from the edges of the scroll view.
2627* This should normally be set to the same value as the contentInset.
2628* Defaults to {0, 0, 0, 0}.
2629*/
2630scrollIndicatorInsets?: Insets //zeroes
2631
2632/**
2633* When true the scroll view scrolls to top when the status bar is tapped.
2634* The default value is true.
2635*/
2636scrollsToTop?: boolean
2637
2638/**
2639* When snapToInterval is set, snapToAlignment will define the relationship of the the snapping to the scroll view.
2640* - start (the default) will align the snap at the left (horizontal) or top (vertical)
2641* - center will align the snap in the center
2642* - end will align the snap at the right (horizontal) or bottom (vertical)
2643*/
2644snapToAlignment?: string
2645
2646/**
2647* When set, causes the scroll view to stop at multiples of the value of snapToInterval.
2648* This can be used for paginating through children that have lengths smaller than the scroll view.
2649* Used in combination with snapToAlignment.
2650*/
2651snapToInterval?: number
2652
2653/**
2654* An array of child indices determining which children get docked to the
2655* top of the screen when scrolling. For example passing
2656* `stickyHeaderIndices={[0]}` will cause the first child to be fixed to the
2657* top of the scroll view. This property is not supported in conjunction
2658* with `horizontal={true}`.
2659*/
2660stickyHeaderIndices?: number[]
2661
2662/**
2663* The current scale of the scroll view content. The default value is 1.0.
2664*/
2665zoomScale?: number
2666}
2667
2668export interface ScrollViewProperties extends ScrollViewIOSProperties, Touchable {
2669
2670/**
2671* These styles will be applied to the scroll view content container which
2672* wraps all of the child views. Example:
2673*
2674* return (
2675* <ScrollView contentContainerStyle={styles.contentContainer}>
2676* </ScrollView>
2677* );
2678* ...
2679* var styles = StyleSheet.create({
2680* contentContainer: {
2681* paddingVertical: 20
2682* }
2683* });
2684*/
2685contentContainerStyle?: ViewStyle
2686
2687/**
2688* When true the scroll view's children are arranged horizontally in a row
2689* instead of vertically in a column. The default value is false.
2690*/
2691horizontal?: boolean
2692
2693/**
2694* Determines whether the keyboard gets dismissed in response to a drag.
2695* - 'none' (the default) drags do not dismiss the keyboard.
2696* - 'onDrag' the keyboard is dismissed when a drag begins.
2697* - 'interactive' the keyboard is dismissed interactively with the drag
2698* and moves in synchrony with the touch; dragging upwards cancels the
2699* dismissal.
2700*/
2701keyboardDismissMode?: string
2702
2703/**
2704* When false tapping outside of the focused text input when the keyboard
2705* is up dismisses the keyboard. When true the scroll view will not catch
2706* taps and the keyboard will not dismiss automatically. The default value
2707* is false.
2708*/
2709keyboardShouldPersistTaps?: boolean
2710
2711/**
2712* Fires at most once per frame during scrolling.
2713* The frequency of the events can be contolled using the scrollEventThrottle prop.
2714*/
2715onScroll?: (event?: { nativeEvent: NativeScrollEvent }) => void
2716
2717/**
2718* Experimental: When true offscreen child views (whose `overflow` value is
2719* `hidden`) are removed from their native backing superview when offscreen.
2720* This canimprove scrolling performance on long lists. The default value is
2721* false.
2722*/
2723removeClippedSubviews?: boolean
2724
2725/**
2726* When true, shows a horizontal scroll indicator.
2727*/
2728showsHorizontalScrollIndicator?: boolean
2729
2730/**
2731* When true, shows a vertical scroll indicator.
2732*/
2733showsVerticalScrollIndicator?: boolean
2734
2735/**
2736* Style
2737*/
2738style?: ScrollViewStyle
2739}
2740
2741export interface ScrollViewProps extends ScrollViewProperties, React.Props<ScrollViewStatic> {
2742
2743}
2744
2745interface ScrollViewStatic extends React.ComponentClass<ScrollViewProps> {
2746
2747}
2748
2749
2750export interface NativeScrollRectangle {
2751left: number;
2752top: number;
2753bottom: number;
2754right: number;
2755}
2756
2757export interface NativeScrollPoint {
2758x: number;
2759y: number;
2760}
2761
2762export interface NativeScrollSize {
2763height: number;
2764width: number;
2765}
2766
2767export interface NativeScrollEvent {
2768contentInset: NativeScrollRectangle;
2769contentOffset: NativeScrollPoint;
2770contentSize: NativeScrollSize;
2771layoutMeasurement: NativeScrollSize;
2772zoomScale: number;
2773}
2774
2775
2776//////////////////////////////////////////////////////////////////////////
2777//
2778// A P I s
2779//
2780//////////////////////////////////////////////////////////////////////////
2781
2782/**
2783* //FIXME: no documentation - inferred from RCTACtionSheetManager.m
2784*/
2785export interface ActionSheetIOSOptions {
2786title?: string
2787options?: string[]
2788cancelButtonIndex?: number
2789destructiveButtonIndex?: number
2790}
2791
2792/**
2793* //FIXME: no documentation - inferred from RCTACtionSheetManager.m
2794*/
2795export interface ShareActionSheetIOSOptions {
2796message?: string
2797url?: string
2798}
2799
2800/**
2801* @see https://facebook.github.io/react-native/docs/actionsheetios.html#content
2802* //FIXME: no documentation - inferred from RCTACtionSheetManager.m
2803*/
2804export interface ActionSheetIOSStatic {
2805showActionSheetWithOptions: ( options: ActionSheetIOSOptions, callback: ( buttonIndex: number ) => void ) => void
2806showShareActionSheetWithOptions: ( options: ShareActionSheetIOSOptions, failureCallback: ( error: Error ) => void, successCallback: ( success: boolean, method: string ) => void ) => void
2807}
2808
2809
2810/**
2811* //FIXME: No documentation - inferred from RCTAdSupport.m
2812*/
2813export interface AdSupportIOSStatic {
2814getAdvertisingId: ( onSuccess: ( deviceId: string ) => void, onFailure: ( err: Error ) => void ) => void
2815getAdvertisingTrackingEnabled: ( onSuccess: ( hasTracking: boolean ) => void, onFailure: ( err: Error ) => void ) => void
2816}
2817
2818interface AlertIOSButton {
2819text: string
2820onPress?: () => void
2821}
2822
2823/**
2824* Launches an alert dialog with the specified title and message.
2825*
2826* Optionally provide a list of buttons.
2827* Tapping any button will fire the respective onPress callback and dismiss the alert.
2828* By default, the only button will be an 'OK' button
2829*
2830* The last button in the list will be considered the 'Primary' button and it will appear bold.
2831*
2832* @see https://facebook.github.io/react-native/docs/alertios.html#content
2833*/
2834export interface AlertIOSStatic {
2835alert: ( title: string, message?: string, buttons?: Array<AlertIOSButton>, type?: string ) => void
2836prompt: ( title: string, value?: string, buttons?: Array<AlertIOSButton>, callback?: ( value?: string ) => void ) => void
2837}
2838
2839
2840/**
2841* AppStateIOS can tell you if the app is in the foreground or background,
2842* and notify you when the state changes.
2843*
2844* AppStateIOS is frequently used to determine the intent and proper behavior
2845* when handling push notifications.
2846*
2847* iOS App States
2848* active - The app is running in the foreground
2849* background - The app is running in the background. The user is either in another app or on the home screen
2850* inactive - This is a transition state that currently never happens for typical React Native apps.
2851*
2852* For more information, see Apple's documentation: https://developer.apple.com/library/ios/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/TheAppLifeCycle/TheAppLifeCycle.html
2853*
2854* @see https://facebook.github.io/react-native/docs/appstateios.html#content
2855*/
2856export interface AppStateIOSStatic {
2857currentState: string
2858addEventListener( type: string, listener: ( state: string ) => void ): void
2859removeEventListener( type: string, listener: ( state: string ) => void ): void
2860}
2861
2862/**
2863* AsyncStorage is a simple, asynchronous, persistent, key-value storage system that is global to the app.
2864* It should be used instead of LocalStorage.
2865*
2866* It is recommended that you use an abstraction on top of AsyncStorage
2867* instead of AsyncStorage directly for anything more than light usage since it operates globally.
2868*
2869* @see https://facebook.github.io/react-native/docs/asyncstorage.html#content
2870*/
2871export interface AsyncStorageStatic {
2872
2873/**
2874* Fetches key and passes the result to callback, along with an Error if there is any.
2875*/
2876getItem( key: string, callback?: ( error?: Error, result?: string ) => void ): Promise<string>
2877
2878/**
2879* Sets value for key and calls callback on completion, along with an Error if there is any
2880*/
2881setItem( key: string, value: string, callback?: ( error?: Error ) => void ): Promise<string>
2882
2883removeItem( key: string, callback?: ( error?: Error ) => void ): Promise<string>
2884
2885/**
2886* Merges existing value with input value, assuming they are stringified json. Returns a Promise object.
2887* Not supported by all native implementation
2888*/
2889mergeItem( key: string, value: string, callback?: ( error?: Error ) => void ): Promise<string>
2890
2891/**
2892* Erases all AsyncStorage for all clients, libraries, etc. You probably don't want to call this.
2893* Use removeItem or multiRemove to clear only your own keys instead.
2894*/
2895clear( callback?: ( error?: Error ) => void ): Promise<string>
2896
2897/**
2898* Gets all keys known to the app, for all callers, libraries, etc
2899*/
2900getAllKeys( callback?: ( error?: Error, keys?: string[] ) => void ): Promise<string>
2901
2902/**
2903* multiGet invokes callback with an array of key-value pair arrays that matches the input format of multiSet
2904*/
2905multiGet( keys: string[], callback?: ( errors?: Error[], result?: string[][] ) => void ): Promise<string>
2906
2907/**
2908* multiSet and multiMerge take arrays of key-value array pairs that match the output of multiGet,
2909*
2910* multiSet([['k1', 'val1'], ['k2', 'val2']], cb);
2911*/
2912multiSet( keyValuePairs: string[][], callback?: ( errors?: Error[] ) => void ): Promise<string>
2913
2914/**
2915* Delete all the keys in the keys array.
2916*/
2917multiRemove( keys: string[], callback?: ( errors?: Error[] ) => void ): Promise<string>
2918
2919/**
2920* Merges existing values with input values, assuming they are stringified json.
2921* Returns a Promise object.
2922*
2923* Not supported by all native implementations.
2924*/
2925multiMerge( keyValuePairs: string[][], callback?: ( errors?: Error[] ) => void ): Promise<string>
2926}
2927
2928
2929export interface CameraRollFetchParams {
2930first: number;
2931after?: string;
2932groupTypes: string; // 'Album','All','Event','Faces','Library','PhotoStream','SavedPhotos'
2933groupName?: string
2934assetType?: string
2935}
2936
2937export interface CameraRollNodeInfo {
2938image: Image;
2939group_name: string;
2940timestamp: number;
2941location: any;
2942}
2943
2944export interface CameraRollEdgeInfo {
2945node: CameraRollNodeInfo;
2946}
2947
2948export interface CameraRollAssetInfo {
2949edges: CameraRollEdgeInfo[];
2950page_info: {
2951has_next_page: boolean;
2952end_cursor: string;
2953};
2954}
2955
2956/**
2957* CameraRoll provides access to the local camera roll / gallery.
2958*/
2959export interface CameraRollStatic {
2960
2961GroupTypesOptions: string[] //'Album','All','Event','Faces','Library','PhotoStream','SavedPhotos'
2962
2963/**
2964* Saves the image to the camera roll / gallery.
2965*
2966* The CameraRoll API is not yet implemented for Android.
2967*
2968* @tag On Android, this is a local URI, such as "file:///sdcard/img.png".
2969* On iOS, the tag can be one of the following:
2970* local URI
2971* assets-library tag
2972* a tag not maching any of the above, which means the image data will be stored in memory (and consume memory as long as the process is alive)
2973*
2974* @param successCallback Invoked with the value of tag on success.
2975* @param errorCallback Invoked with error message on error.
2976*/
2977saveImageWithTag( tag: string, successCallback: ( tag?: string ) => void, errorCallback: ( error: Error ) => void ): void
2978
2979/**
2980* Invokes callback with photo identifier objects from the local camera roll of the device matching shape defined by getPhotosReturnChecker.
2981*
2982* @param {object} params See getPhotosParamChecker.
2983* @param {function} callback Invoked with arg of shape defined by getPhotosReturnChecker on success.
2984* @param {function} errorCallback Invoked with error message on error.
2985*/
2986getPhotos( fetch: CameraRollFetchParams,
2987callback: ( assetInfo: CameraRollAssetInfo ) => void,
2988errorCallback: ( error: Error )=> void ): void;
2989}
2990
2991export interface FetchableListenable<T> {
2992fetch: () => Promise<T>
2993
2994/**
2995* eventName is expected to be `change`
2996* //FIXME: No doc - inferred from NetInfo.js
2997*/
2998addEventListener: ( eventName: string, listener: ( result: T ) => void ) => void
2999
3000/**
3001* eventName is expected to be `change`
3002* //FIXME: No doc - inferred from NetInfo.js
3003*/
3004removeEventListener: ( eventName: string, listener: ( result: T ) => void ) => void
3005}
3006
3007/**
3008* NetInfo exposes info about online/offline status
3009*
3010* Asynchronously determine if the device is online and on a cellular network.
3011*
3012* - `none` - device is offline
3013* - `wifi` - device is online and connected via wifi, or is the iOS simulator
3014* - `cell` - device is connected via Edge, 3G, WiMax, or LTE
3015* - `unknown` - error case and the network status is unknown
3016
3017* @see https://facebook.github.io/react-native/docs/netinfo.html#content
3018*/
3019export interface NetInfoStatic extends FetchableListenable<string> {
3020
3021/**
3022*
3023* Available on all platforms.
3024* Asynchronously fetch a boolean to determine internet connectivity.
3025*/
3026isConnected: FetchableListenable<boolean>
3027
3028//FIXME: Documentation missing
3029isConnectionMetered: any
3030}
3031
3032
3033export interface PanResponderGestureState {
3034
3035/**
3036* ID of the gestureState- persisted as long as there at least one touch on
3037*/
3038stateID: number
3039
3040/**
3041* the latest screen coordinates of the recently-moved touch
3042*/
3043moveX: number
3044
3045/**
3046* the latest screen coordinates of the recently-moved touch
3047*/
3048moveY: number
3049
3050/**
3051* the screen coordinates of the responder grant
3052*/
3053x0: number
3054
3055/**
3056* the screen coordinates of the responder grant
3057*/
3058y0: number
3059
3060/**
3061* accumulated distance of the gesture since the touch started
3062*/
3063dx: number
3064
3065/**
3066* accumulated distance of the gesture since the touch started
3067*/
3068dy: number
3069
3070/**
3071* current velocity of the gesture
3072*/
3073vx: number
3074
3075/**
3076* current velocity of the gesture
3077*/
3078vy: number
3079
3080/**
3081* Number of touches currently on screeen
3082*/
3083numberActiveTouches: number
3084
3085
3086// All `gestureState` accounts for timeStamps up until:
3087_accountsForMovesUpTo: number
3088}
3089
3090
3091/**
3092* @see documentation of GestureResponderHandlers
3093*/
3094export interface PanResponderCallbacks {
3095onMoveShouldSetPanResponder?: ( e: GestureResponderEvent, gestureState: PanResponderGestureState ) => boolean
3096onStartShouldSetPanResponder?: ( e: GestureResponderEvent, gestureState: PanResponderGestureState ) => void
3097onPanResponderGrant?: ( e: GestureResponderEvent, gestureState: PanResponderGestureState ) => void
3098onPanResponderMove?: ( e: GestureResponderEvent, gestureState: PanResponderGestureState ) => void
3099onPanResponderRelease?: ( e: GestureResponderEvent, gestureState: PanResponderGestureState ) => void
3100onPanResponderTerminate?: ( e: GestureResponderEvent, gestureState: PanResponderGestureState ) => void
3101
3102onMoveShouldSetPanResponderCapture?: ( e: GestureResponderEvent, gestureState: PanResponderGestureState ) => boolean
3103onStartShouldSetPanResponderCapture?: ( e: GestureResponderEvent, gestureState: PanResponderGestureState ) => boolean
3104onPanResponderReject?: ( e: GestureResponderEvent, gestureState: PanResponderGestureState ) => void
3105onPanResponderStart?: ( e: GestureResponderEvent, gestureState: PanResponderGestureState ) => void
3106onPanResponderEnd?: ( e: GestureResponderEvent, gestureState: PanResponderGestureState ) => void
3107onPanResponderTerminationRequest?: ( e: GestureResponderEvent, gestureState: PanResponderGestureState ) => boolean
3108}
3109
3110export interface PanResponderInstance {
3111panHandlers: GestureResponderHandlers
3112}
3113
3114/**
3115* PanResponder reconciles several touches into a single gesture.
3116* It makes single-touch gestures resilient to extra touches,
3117* and can be used to recognize simple multi-touch gestures.
3118*
3119* It provides a predictable wrapper of the responder handlers provided by the gesture responder system.
3120* For each handler, it provides a new gestureState object alongside the normal event.
3121*/
3122export interface PanResponderStatic {
3123/**
3124* @param config Enhanced versions of all of the responder callbacks
3125* that provide not only the typical `ResponderSyntheticEvent`, but also the
3126* `PanResponder` gesture state. Simply replace the word `Responder` with
3127* `PanResponder` in each of the typical `onResponder*` callbacks. For
3128* example, the `config` object would look like:
3129*
3130* - `onMoveShouldSetPanResponder: (e, gestureState) => {...}`
3131* - `onMoveShouldSetPanResponderCapture: (e, gestureState) => {...}`
3132* - `onStartShouldSetPanResponder: (e, gestureState) => {...}`
3133* - `onStartShouldSetPanResponderCapture: (e, gestureState) => {...}`
3134* - `onPanResponderReject: (e, gestureState) => {...}`
3135* - `onPanResponderGrant: (e, gestureState) => {...}`
3136* - `onPanResponderStart: (e, gestureState) => {...}`
3137* - `onPanResponderEnd: (e, gestureState) => {...}`
3138* - `onPanResponderRelease: (e, gestureState) => {...}`
3139* - `onPanResponderMove: (e, gestureState) => {...}`
3140* - `onPanResponderTerminate: (e, gestureState) => {...}`
3141* - `onPanResponderTerminationRequest: (e, gestureState) => {...}`
3142*
3143* In general, for events that have capture equivalents, we update the
3144* gestureState once in the capture phase and can use it in the bubble phase
3145* as well.
3146*
3147* Be careful with onStartShould* callbacks. They only reflect updated
3148* `gestureState` for start/end events that bubble/capture to the Node.
3149* Once the node is the responder, you can rely on every start/end event
3150* being processed by the gesture and `gestureState` being updated
3151* accordingly. (numberActiveTouches) may not be totally accurate unless you
3152* are the responder.
3153*/
3154create( config: PanResponderCallbacks ): PanResponderInstance
3155}
3156
3157export interface PushNotificationPermissions {
3158alert?: boolean
3159badge?: boolean
3160sound?: boolean
3161}
3162
3163export interface PushNotification {
3164
3165
3166/**
3167* An alias for `getAlert` to get the notification's main message string
3168*/
3169getMessage(): string | Object
3170
3171/**
3172* Gets the sound string from the `aps` object
3173*/
3174getSound(): string
3175
3176/**
3177* Gets the notification's main message from the `aps` object
3178*/
3179getAlert(): string | Object
3180
3181/**
3182* Gets the badge count number from the `aps` object
3183*/
3184getBadgeCount(): number
3185
3186/**
3187* Gets the data object on the notif
3188*/
3189getData(): Object
3190
3191}
3192
3193
3194/**
3195* Handle push notifications for your app, including permission handling and icon badge number.
3196* @see https://facebook.github.io/react-native/docs/pushnotificationios.html#content
3197*
3198* //FIXME: BGR: The documentation seems completely off compared to the actual js implementation. I could never get the example to run
3199*/
3200export interface PushNotificationIOSStatic {
3201
3202/**
3203* Sets the badge number for the app icon on the home screen
3204*/
3205setApplicationIconBadgeNumber( number: number ): void
3206
3207/**
3208* Gets the current badge number for the app icon on the home screen
3209*/
3210getApplicationIconBadgeNumber( callback: ( badge: number ) => void ): void
3211
3212/**
3213* Attaches a listener to remote notifications while the app is running in the
3214* foreground or the background.
3215*
3216* The handler will get be invoked with an instance of `PushNotificationIOS`
3217*
3218* The type MUST be 'notification'
3219*/
3220addEventListener( type: string, handler: ( notification: PushNotification ) => void ):void
3221
3222/**
3223* Requests all notification permissions from iOS, prompting the user's
3224* dialog box.
3225*/
3226requestPermissions(): void
3227
3228/**
3229* See what push permissions are currently enabled. `callback` will be
3230* invoked with a `permissions` object:
3231*
3232* - `alert` :boolean
3233* - `badge` :boolean
3234* - `sound` :boolean
3235*/
3236checkPermissions( callback: ( permissions: PushNotificationPermissions ) => void ): void
3237
3238/**
3239* Removes the event listener. Do this in `componentWillUnmount` to prevent
3240* memory leaks
3241*/
3242removeEventListener( type: string, handler: ( notification: PushNotification ) => void ): void
3243
3244/**
3245* An initial notification will be available if the app was cold-launched
3246* from a notification.
3247*
3248* The first caller of `popInitialNotification` will get the initial
3249* notification object, or `null`. Subsequent invocations will return null.
3250*/
3251popInitialNotification(): PushNotification
3252}
3253
3254
3255/**
3256* @enum('default', 'light-content')
3257*/
3258export type StatusBarStyle = string
3259
3260/**
3261* @enum('none','fade', 'slide')
3262*/
3263type StatusBarAnimation = string
3264
3265
3266/**
3267* //FIXME: No documentation is available (although this is self explanatory)
3268*
3269* @see https://facebook.github.io/react-native/docs/statusbarios.html#content
3270*/
3271export interface StatusBarIOSStatic {
3272
3273setStyle(style: StatusBarStyle, animated?: boolean): void
3274
3275setHidden(hidden: boolean, animation?: StatusBarAnimation): void
3276
3277setNetworkActivityIndicatorVisible(visible: boolean): void
3278}
3279
3280/**
3281* The Vibration API is exposed at VibrationIOS.vibrate().
3282* On iOS, calling this function will trigger a one second vibration.
3283* The vibration is asynchronous so this method will return immediately.
3284*
3285* There will be no effect on devices that do not support Vibration, eg. the iOS simulator.
3286*
3287* Vibration patterns are currently unsupported.
3288*
3289* @see https://facebook.github.io/react-native/docs/vibrationios.html#content
3290*/
3291export interface VibrationIOSStatic {
3292vibrate(): void
3293}
3294
3295//////////////////////////////////////////////////////////////////////////
3296//
3297// R E - E X P O R T S
3298//
3299//////////////////////////////////////////////////////////////////////////
3300
3301// export var AppRegistry: AppRegistryStatic;
3302
3303
3304export var ActivityIndicatorIOS: ActivityIndicatorIOSStatic
3305export type ActivityIndicatorIOS = ActivityIndicatorIOSStatic
3306
3307export var DatePickerIOS: DatePickerIOSStatic
3308export type DatePickerIOS = DatePickerIOSStatic
3309
3310export var Image: ImageStatic
3311export type Image = ImageStatic
3312
3313export var LayoutAnimation: LayoutAnimationStatic
3314export type LayoutAnimation = LayoutAnimationStatic
3315
3316export var ListView: ListViewStatic
3317export type ListView = ListViewStatic
3318
3319export var MapView: MapViewStatic
3320export type MapView = MapViewStatic
3321
3322export var Navigator: NavigatorStatic
3323export type Navigator = NavigatorStatic
3324
3325export var NavigatorIOS: NavigatorIOSStatic
3326export type NavigatorIOS = NavigatorIOSStatic
3327
3328export var PickerIOS: PickerIOSStatic
3329export type PickerIOS = PickerIOSStatic
3330
3331export var SliderIOS: SliderIOSStatic
3332export type SliderIOS = SliderIOSStatic
3333
3334export var ScrollView: ScrollViewStatic
3335export type ScrollView = ScrollViewStatic
3336
3337export var StyleSheet: StyleSheetStatic
3338export type StyleSheet = StyleSheetStatic
3339
3340export var SwitchIOS: SwitchIOSStatic
3341export type SwitchIOS = SwitchIOSStatic
3342
3343export var TabBarIOS: TabBarIOSStatic
3344export type TabBarIOS = TabBarIOSStatic
3345
3346export var Text: TextStatic
3347export type Text = TextStatic
3348
3349export var TextInput: TextInputStatic
3350export type TextInput = TextInputStatic
3351
3352export var TouchableHighlight: TouchableHighlightStatic
3353export type TouchableHighlight = TouchableHighlightStatic
3354
3355export var TouchableNativeFeedback: TouchableNativeFeedbackStatic
3356export type TouchableNativeFeedback = TouchableNativeFeedbackStatic
3357
3358export var TouchableOpacity: TouchableOpacityStatic
3359export type TouchableOpacity = TouchableOpacityStatic
3360
3361export var TouchableWithoutFeedback: TouchableWithoutFeedbackStatic
3362export type TouchableWithoutFeedback= TouchableWithoutFeedbackStatic
3363
3364export var View: ViewStatic
3365export type View = ViewStatic
3366
3367export var WebView: WebViewStatic
3368export type WebView = WebViewStatic
3369
3370
3371//////////// APIS //////////////
3372export var ActionSheetIOS: ActionSheetIOSStatic
3373export type ActionSheetIOS = ActionSheetIOSStatic
3374
3375export var AdSupportIOS: AdSupportIOSStatic
3376export type AdSupportIOS = AdSupportIOSStatic
3377
3378export var AlertIOS: AlertIOSStatic
3379export type AlertIOS = AlertIOSStatic
3380
3381export var AppStateIOS: AppStateIOSStatic
3382export type AppStateIOS = AppStateIOSStatic
3383
3384export var AsyncStorage: AsyncStorageStatic
3385export type AsyncStorage = AsyncStorageStatic
3386
3387export var CameraRoll: CameraRollStatic
3388export type CameraRoll = CameraRollStatic
3389
3390export var NetInfo: NetInfoStatic
3391export type NetInfo = NetInfoStatic
3392
3393export var PanResponder: PanResponderStatic
3394export type PanResponder = PanResponderStatic
3395
3396export var PushNotificationIOS: PushNotificationIOSStatic
3397export type PushNotificationIOS = PushNotificationIOSStatic
3398
3399export var StatusBarIOS: StatusBarIOSStatic
3400export type StatusBarIOS = StatusBarIOSStatic
3401
3402export var VibrationIOS: VibrationIOSStatic
3403export type VibrationIOS = VibrationIOSStatic
3404
3405
3406//
3407// /TODO: BGR: These are leftovers of the initial port that must be revisited
3408//
3409
3410export var SegmentedControlIOS: React.ComponentClass<SegmentedControlIOSProperties>
3411
3412export var PixelRatio: PixelRatioStatic
3413export var DeviceEventEmitter: DeviceEventEmitterStatic
3414export var DeviceEventSubscription: DeviceEventSubscriptionStatic
3415export type DeviceEventSubscription = DeviceEventSubscriptionStatic
3416export var InteractionManager: InteractionManagerStatic
3417
3418//////////////////////////////////////////////////////////////////////////
3419//
3420// Additional ( and controversial)
3421//
3422//////////////////////////////////////////////////////////////////////////
3423
3424export function __spread( target: any, ...sources: any[] ): any;
3425
3426
3427export interface GlobalStatic {
3428
3429/**
3430* Accepts a function as its only argument and calls that function before the next repaint.
3431* It is an essential building block for animations that underlies all of the JavaScript-based animation APIs.
3432* In general, you shouldn't need to call this yourself - the animation API's will manage frame updates for you.
3433* @see https://facebook.github.io/react-native/docs/animations.html#requestanimationframe
3434*/
3435requestAnimationFrame( fn: () => void ) : void;
3436
3437}
3438
3439//
3440// Add-Ons
3441//
3442namespace addons {
3443
3444//FIXME: Documentation ?
3445export interface TestModuleStatic {
3446
3447verifySnapshot: ( done: ( indicator?: any ) => void ) => void
3448markTestPassed: ( indicator: any ) => void
3449markTestCompleted: () => void
3450}
3451
3452export var TestModule: TestModuleStatic
3453export type TestModule = TestModuleStatic
3454}
3455
3456
3457}
3458
3459declare module "react-native" {
3460
3461import ReactNative = __React
3462export = ReactNative
3463}
3464
3465declare var global: __React.GlobalStatic
3466
3467declare function require( name: string ): any
3468
3469
3470//TODO: BGR: this is a left-over from the initial port. Not sure it makes any sense
3471declare module "Dimensions" {
3472import * as React from 'react-native';
3473
3474interface Dimensions {
3475get( what: string ): React.ScaledSize;
3476}
3477
3478var ExportDimensions: Dimensions;
3479export = ExportDimensions;
3480}