- };
- }
-
- // see react-jsx.d.ts
- export function createElement(type: React.ReactType,
- props?: P,
- ...children: React.ReactNode[]): React.ReactElement
;
-
-
- export type Runnable = (appParameters: any) => void;
-
-
- // Similar to React.SyntheticEvent except for nativeEvent
- interface NativeSyntheticEvent {
- bubbles: boolean
- cancelable: boolean
- currentTarget: EventTarget
- defaultPrevented: boolean
- eventPhase: number
- isTrusted: boolean
- nativeEvent: T
- preventDefault(): void
- stopPropagation(): void
- target: EventTarget
- timeStamp: Date
- type: string
- }
-
- export interface NativeTouchEvent {
- /**
- * Array of all touch events that have changed since the last event
- */
- changedTouches: NativeTouchEvent[]
-
- /**
- * The ID of the touch
- */
- identifier: string
-
- /**
- * The X position of the touch, relative to the element
- */
- locationX: number
-
- /**
- * The Y position of the touch, relative to the element
- */
- locationY: number
-
- /**
- * The X position of the touch, relative to the screen
- */
- pageX: number
-
- /**
- * The Y position of the touch, relative to the screen
- */
+export type MeasureOnSuccessCallback = (
+ x: number,
+ y: number,
+ width: number,
+ height: number,
+ pageX: number,
pageY: number
+ ) => void
- /**
- * The node id of the element receiving the touch event
- */
- target: string
+export type MeasureInWindowOnSuccessCallback = (
+ x: number,
+ y: number,
+ width: number,
+ height: number
+ ) => void
- /**
- * A time identifier for the touch, useful for velocity calculation
- */
- timestamp: number
+export type MeasureLayoutOnSuccessCallback = (
+ left: number,
+ top: number,
+ width: number,
+ height: number
+ ) => void
- /**
- * Array of all current touches on the screen
- */
- touches: NativeTouchEvent[]
- }
+/**
+ * EventSubscription represents a subscription to a particular event. It can
+ * remove its own subscription.
+ */
+interface EventSubscription {
- export interface GestureResponderEvent extends NativeSyntheticEvent {
- }
-
-
- export interface PointProperties {
- x: number
- y: number
- }
-
- export interface Insets {
- top?: number
- left?: number
- bottom?: number
- right?: number
- }
+ eventType: string;
+ key: number;
+ subscriber: EventSubscriptionVendor;
/**
- * //FIXME: need to find documentation on which component is a TTouchable and can implement that interface
- * @see React.DOMAtributes
+ * @param {EventSubscriptionVendor} subscriber the subscriber that controls
+ * this subscription.
*/
- export interface Touchable {
- onTouchStart?: (event: GestureResponderEvent) => void
- onTouchMove?: (event: GestureResponderEvent) => void
- onTouchEnd?: (event: GestureResponderEvent) => void
- onTouchCancel?: (event: GestureResponderEvent) => void
- onTouchEndCapture?: (event: GestureResponderEvent) => void
- }
+ new(subscriber: EventSubscriptionVendor): EventSubscription
- export type ComponentProvider = () => React.ComponentClass
-
- export type AppConfig = {
- appKey: string;
- component?: ComponentProvider
- run?: Runnable;
- }
-
- // https://github.com/facebook/react-native/blob/master/Libraries/AppRegistry/AppRegistry.js
/**
- * `AppRegistry` is the JS entry point to running all React Native apps. App
- * root components should register themselves with
- * `AppRegistry.registerComponent`, then the native system can load the bundle
- * for the app and then actually run the app when it's ready by invoking
- * `AppRegistry.runApplication`.
+ * Removes this subscription from the subscriber that controls it.
+ */
+ remove(): void
+}
+
+/**
+ * EventSubscriptionVendor stores a set of EventSubscriptions that are
+ * subscribed to a particular event type.
+ */
+interface EventSubscriptionVendor {
+
+ constructor(): EventSubscriptionVendor
+
+ /**
+ * Adds a subscription keyed by an event type.
*
- * To "stop" an application when a view should be destroyed, call
- * `AppRegistry.unmountApplicationComponentAtRootTag` with the tag that was
- * pass into `runApplication`. These should always be used as a pair.
+ * @param {string} eventType
+ * @param {EventSubscription} subscription
+ */
+ addSubscription(eventType: string, subscription: EventSubscription): EventSubscription
+
+ /**
+ * Removes a bulk set of the subscriptions.
*
- * `AppRegistry` should be `require`d early in the `require` sequence to make
- * sure the JS execution environment is setup before other modules are
- * `require`d.
+ * @param {?string} eventType - Optional name of the event type whose
+ * registered supscriptions to remove, if null remove all subscriptions.
*/
- export class AppRegistry {
- static registerConfig(config: AppConfig[]): void;
-
- static registerComponent( appKey: string, getComponentFunc: ComponentProvider ): string;
-
- static registerRunnable(appKey: string, func: Runnable): string;
-
- static getAppKeys(): string[];
-
- static unmountApplicationComponentAtRootTag(rootTag: number): void;
-
- static runApplication(appKey: string, appParameters: any): void;
- }
-
- export interface LayoutAnimationTypes {
- spring: string
- linear: string
- easeInEaseOut: string
- easeIn: string
- easeOut: string
- }
-
- export interface LayoutAnimationProperties {
- opacity: string
- scaleXY: string
- }
-
- export interface LayoutAnimationAnim {
- duration?: number
- delay?: number
- springDamping?: number
- initialVelocity?: number
- type?: string //LayoutAnimationTypes
- property?: string //LayoutAnimationProperties
- }
-
- export interface LayoutAnimationConfig {
- duration: number
- create?: LayoutAnimationAnim
- update?: LayoutAnimationAnim
- delete?: LayoutAnimationAnim
- }
-
- /** Automatically animates views to their new positions when the next layout happens.
- * A common way to use this API is to call LayoutAnimation.configureNext before
- * calling setState. */
- export interface LayoutAnimationStatic {
- /** Schedules an animation to happen on the next layout.
- * @param config Specifies animation properties:
- * `duration` in milliseconds
- * `create`, config for animating in new views (see Anim type)
- * `update`, config for animating views that have been updated (see Anim type)
- * @param onAnimationDidEnd Called when the animation finished. Only supported on iOS.
- */
- configureNext: ( config: LayoutAnimationConfig, onAnimationDidEnd?: () => void ) => void
- /** Helper for creating a config for configureNext. */
- create: (duration: number, type?: string, creationProp?: string) => LayoutAnimationConfig
- Types: LayoutAnimationTypes
- Properties: LayoutAnimationProperties
- configChecker: (shapeTypes: {[key: string]: any}) => any
- Presets: {
- easeInEaseOut: LayoutAnimationConfig
- linear: LayoutAnimationConfig
- spring: LayoutAnimationConfig
- }
- easeInEaseOut: (config: LayoutAnimationConfig, onAnimationDidEnd?: () => void) => void
- linear: (config: LayoutAnimationConfig, onAnimationDidEnd?: () => void) => void
- spring: (config: LayoutAnimationConfig, onAnimationDidEnd?: () => void) => void
- }
-
- export type FlexAlignType = "flex-start" | "flex-end" | "center" | "stretch";
- export type FlexJustifyType = "flex-start" | "flex-end" | "center" | "space-between" | "space-around";
- export type FlexDirection = "row" | "column" | "row-reverse" | "column-reverse";
+ removeAllSubscriptions(eventType?: string): void
/**
- * Flex Prop Types
- * @see https://facebook.github.io/react-native/docs/flexbox.html#proptypes
- * @see LayoutPropTypes.js
- */
- export interface FlexStyle {
-
- alignItems?: FlexAlignType;
- alignSelf?: "auto" | FlexAlignType;
- borderBottomWidth?: number
- borderLeftWidth?: number
- borderRightWidth?: number
- borderTopWidth?: number
- borderWidth?: number
- bottom?: number
- flex?: number
- flexGrow?: number
- flexShrink?: number
- flexBasis?: number
- flexDirection?: FlexDirection
- flexWrap?: "wrap" | "nowrap"
- height?: number
- justifyContent?: FlexJustifyType
- left?: number
- minWidth?: number
- maxWidth?: number
- minHeight?: number
- maxHeight?: number
- margin?: number
- marginBottom?: number
- marginHorizontal?: number
- marginLeft?: number
- marginRight?: number
- marginTop?: number
- marginVertical?: number
- overflow?: "visible" | "hidden" | "scroll"
- padding?: number
- paddingBottom?: number
- paddingHorizontal?: number
- paddingLeft?: number
- paddingRight?: number
- paddingTop?: number
- paddingVertical?: number
- position?: "absolute" | "relative"
- right?: number
- top?: number
- width?: number
-
- /**
- * @platform ios
- */
- zIndex?: number
- }
-
- /**
- * @see ShadowPropTypesIOS.js
- */
- export interface ShadowPropTypesIOSStatic {
- /**
- * Sets the drop shadow color
- * @platform ios
- */
- shadowColor: string
-
- /**
- * Sets the drop shadow offset
- * @platform ios
- */
- shadowOffset: { width: number, height: number }
-
- /**
- * Sets the drop shadow opacity (multiplied by the color's alpha component)
- * @platform ios
- */
- shadowOpacity: number
-
- /**
- * Sets the drop shadow blur radius
- * @platform ios
- */
- shadowRadius: number
- }
-
- type GetCurrentPositionOptions = {
- timeout: number
- maximumAge: number
- enableHighAccuracy: boolean
- distanceFilter: number
- }
-
- type WatchPositionOptions = {
- timeout: number
- maximumAge: number
- enableHighAccuracy: boolean
- distanceFilter: number
- }
-
- type GeolocationReturnType = {
- coords: {
- latitude: number
- longitude: number
- altitude?: number
- accuracy?: number
- altitudeAccuracy?: number
- heading?: number
- speed?: number
- }
- timestamp: number
- }
-
- interface PerpectiveTransform {
- perspective: number;
- }
-
- interface RotateTransform {
- rotate: string;
- }
-
- interface RotateXTransform {
- rotateX: string;
- }
-
- interface RotateYTransform {
- rotateY: string;
- }
-
- interface RotateZTransform {
- rotateZ: string;
- }
-
- interface ScaleTransform {
- scale: number;
- }
-
- interface ScaleXTransform {
- scaleX: number;
- }
-
- interface ScaleYTransform {
- scaleY: number;
- }
-
- interface TranslateXTransform {
- translateX: number;
- }
-
- interface TranslateYTransform {
- translateY: number;
- }
-
- interface SkewXTransform {
- skewX: string;
- }
-
- interface SkewYTransform {
- skewY: string;
- }
-
- export interface TransformsStyle {
-
- transform?: (PerpectiveTransform|RotateTransform|RotateXTransform|RotateYTransform|RotateZTransform|ScaleTransform|ScaleXTransform|ScaleYTransform|TranslateXTransform|TranslateYTransform|SkewXTransform|SkewYTransform)[]
- transformMatrix?: Array
- rotation?: number
- scaleX?: number
- scaleY?: number
- translateX?: number
- translateY?: number
- }
-
-
- export interface StyleSheetProperties {
- hairlineWidth: number
- flatten(style: T): T
- }
-
- export interface LayoutRectangle {
- x: number;
- y: number;
- width: number;
- height: number;
- }
-
- // @see TextProperties.onLayout
- export interface LayoutChangeEvent {
- nativeEvent: {
- layout: LayoutRectangle
- }
- }
-
- export interface TextStyleIOS extends ViewStyle {
- letterSpacing?: number
- textDecorationColor?: string
- textDecorationStyle?: "solid" | "double" | "dotted" | "dashed"
- writingDirection?: "auto" | "ltr" | "rtl"
- }
-
- export interface TextStyleAndroid extends ViewStyle {
- textAlignVertical?: "auto" | "top" | "bottom" | "center"
- includeFontPadding?: boolean
- }
-
- // @see https://facebook.github.io/react-native/docs/text.html#style
- export interface TextStyle extends TextStyleIOS, TextStyleAndroid, ViewStyle {
- color?: string
- fontFamily?: string
- fontSize?: number
- fontStyle?: "normal" | "italic"
- /**
- * Specifies font weight. The values 'normal' and 'bold' are supported
- * for most fonts. Not all fonts have a variant for each of the numeric
- * values, in that case the closest one is chosen.
- */
- fontWeight?: "normal" | "bold" | "100" | "200" | "300" | "400" | "500" | "600" | "700" | "800" | "900"
- letterSpacing?: number
- lineHeight?: number
- /**
- * Specifies text alignment.
- * The value 'justify' is only supported on iOS.
- */
- textAlign?: "auto" | "left" | "right" | "center"
- textDecorationLine?: "none" | "underline" | "line-through" | "underline line-through"
- textDecorationStyle?: "solid" | "double" | "dotted" | "dashed"
- textDecorationColor?: string
- textShadowColor?: string
- textShadowOffset?: { width: number, height: number }
- textShadowRadius?: number
- testID?: string
- }
-
- export interface TextPropertiesIOS {
- /**
- * Specifies whether fonts should scale to respect Text Size accessibility setting on iOS. The
- * default is `true`.
- */
- allowFontScaling?: boolean
-
- /**
- * Specifies whether font should be scaled down automatically to fit given style constraints.
- */
- adjustsFontSizeToFit?: boolean
-
- /**
- * Specifies smallest possible scale a font can reach when adjustsFontSizeToFit is enabled. (values 0.01-1.0).
- */
- minimumFontScale?: number
-
- /**
- * When `true`, no visual change is made when text is pressed down. By
- * default, a gray oval highlights the text on press down.
- */
- suppressHighlighting?: boolean
- }
-
- export interface TextPropertiesAndroid {
- /**
- * Lets the user select text, to use the native copy and paste functionality.
- */
- selectable?: boolean
- }
-
- // https://facebook.github.io/react-native/docs/text.html#props
- export interface TextProperties extends TextPropertiesIOS, TextPropertiesAndroid, React.Props {
-
- /**
- * When set to `true`, indicates that the view is an accessibility element. The default value
- * for a `Text` element is `true`.
- *
- * See the
- * [Accessibility guide](/react-native/docs/accessibility.html#accessible-ios-android)
- * for more information.
- */
- accessible?: boolean
-
- /**
- * This can be one of the following values:
- *
- * - `head` - The line is displayed so that the end fits in the container and the missing text
- * at the beginning of the line is indicated by an ellipsis glyph. e.g., "...wxyz"
- * - `middle` - The line is displayed so that the beginning and end fit in the container and the
- * missing text in the middle is indicated by an ellipsis glyph. "ab...yz"
- * - `tail` - The line is displayed so that the beginning fits in the container and the
- * missing text at the end of the line is indicated by an ellipsis glyph. e.g., "abcd..."
- * - `clip` - Lines are not drawn past the edge of the text container.
- *
- * The default is `tail`.
- *
- * `numberOfLines` must be set in conjunction with this prop.
- *
- * > `clip` is working only for iOS
- */
- ellipsizeMode?: 'head' | 'middle' | 'tail' | 'clip'
-
- /**
- * Line Break mode. Works only with numberOfLines.
- * clip is working only for iOS
- */
- lineBreakMode?: 'head' | 'middle' | 'tail' | 'clip'
-
- /**
- * Used to truncate the text with an ellipsis after computing the text
- * layout, including line wrapping, such that the total number of lines
- * does not exceed this number.
- *
- * This prop is commonly used with `ellipsizeMode`.
- */
- numberOfLines?: number
-
- /**
- * Invoked on mount and layout changes with
- *
- * {nativeEvent: { layout: {x, y, width, height}}}.
- */
- onLayout?: (event: LayoutChangeEvent) => void
-
- /**
- * This function is called on press.
- * Text intrinsically supports press handling with a default highlight state (which can be disabled with suppressHighlighting).
- */
- onPress?: () => void
-
- /**
- * This function is called on long press.
- * e.g., `onLongPress={this.increaseSize}>``
- */
- onLongPress?: () => void
-
- /**
- * @see https://facebook.github.io/react-native/docs/text.html#style
- */
- style?: TextStyle
-
- /**
- * Used to locate this view in end-to-end tests.
- */
- testID?: string
- }
-
- /**
- * A React component for displaying text which supports nesting, styling, and touch handling.
- */
- export interface TextStatic extends NativeMethodsMixin, React.ClassicComponentClass {
-
- }
-
- type DataDetectorTypes = 'phoneNumber' | 'link' | 'address' | 'calendarEvent' | 'none' | 'all';
-
- /**
- * DocumentSelectionState is responsible for maintaining selection information
- * for a document.
+ * Removes a specific subscription. Instead of calling this function, call
+ * `subscription.remove()` directly.
*
- * It is intended for use by AbstractTextEditor-based components for
- * identifying the appropriate start/end positions to modify the
- * DocumentContent, and for programatically setting browser selection when
- * components re-render.
+ * @param {object} subscription
*/
- export interface DocumentSelectionState extends EventEmitter {
- new(anchor: number, focus: number): DocumentSelectionState
-
- /**
- * Apply an update to the state. If either offset value has changed,
- * set the values and emit the `change` event. Otherwise no-op.
- *
- * @param {number} anchor
- * @param {number} focus
- */
- update(anchor: number, focus: number): void
-
- /**
- * Given a max text length, constrain our selection offsets to ensure
- * that the selection remains strictly within the text range.
- *
- * @param {number} maxLength
- */
- constrainLength(maxLength: number): void
-
- focus(): void
- blur(): void
- hasFocus(): boolean
- isCollapsed(): boolean
- isBackward(): boolean
-
- getAnchorOffset(): number
- getFocusOffset(): number
- getStartOffset(): number
- getEndOffset(): number
- overlaps(start: number, end: number): boolean
- }
-
+ removeSubscription(subscription: any): void
/**
- * IOS Specific properties for TextInput
- * @see https://facebook.github.io/react-native/docs/textinput.html#props
- */
- export interface TextInputIOSProperties {
-
- /**
- * enum('never', 'while-editing', 'unless-editing', 'always')
- * When the clear button should appear on the right side of the text view
- */
- clearButtonMode?: 'never' | 'while-editing' | 'unless-editing' | 'always'
-
- /**
- * If true, clears the text field automatically when editing begins
- */
- clearTextOnFocus?: boolean
-
- /**
- * Determines the types of data converted to clickable URLs in the text input.
- * Only valid if `multiline={true}` and `editable={false}`.
- * By default no data types are detected.
- *
- * You can provide one type or an array of many types.
- *
- * Possible values for `dataDetectorTypes` are:
- *
- * - `'phoneNumber'`
- * - `'link'`
- * - `'address'`
- * - `'calendarEvent'`
- * - `'none'`
- * - `'all'`
- */
- dataDetectorTypes?: DataDetectorTypes | DataDetectorTypes[]
-
- /**
- * If true, the keyboard disables the return key when there is no text and automatically enables it when there is text.
- * The default value is false.
- */
- enablesReturnKeyAutomatically?: boolean
-
- /**
- * Determines the color of the keyboard.
- */
- keyboardAppearance?: 'default' | 'light' | 'dark'
-
- /**
- * Callback that is called when a key is pressed.
- * Pressed key value is passed as an argument to the callback handler.
- * Fires before onChange callbacks.
- */
- onKeyPress?: (key: string) => void
-
- /**
- * See DocumentSelectionState.js, some state that is responsible for maintaining selection information for a document
- */
- selectionState?: DocumentSelectionState
-
-
- }
-
- /**
- * Android Specific properties for TextInput
- * @see https://facebook.github.io/react-native/docs/textinput.html#props
- */
- export interface TextInputAndroidProperties {
-
- /**
- * If defined, the provided image resource will be rendered on the left.
- */
- inlineImageLeft?: string
-
- /**
- * Padding between the inline image, if any, and the text input itself.
- */
- inlineImagePadding?: number
-
- /**
- * Sets the number of lines for a TextInput.
- * Use it with multiline set to true to be able to fill the lines.
- */
- numberOfLines?: number
-
- /**
- * Sets the return key to the label. Use it instead of `returnKeyType`.
- * @platform android
- */
- returnKeyLabel?: string
-
- /**
- * The color of the textInput underline.
- */
- underlineColorAndroid?: string
- }
-
- export type KeyboardType = "default" | "email-address" | "numeric" | "phone-pad"
- export type KeyboardTypeIOS = "ascii-capable" | "numbers-and-punctuation" | "url" | "number-pad" | "name-phone-pad" | "decimal-pad" | "twitter" | "web-search"
-
- export type ReturnKeyType = "done" | "go" | "next" | "search" | "send"
- export type ReturnKeyTypeAndroid = "none" | "previous"
- export type ReturnKeyTypeIOS = "default" | "google" | "join" | "route" | "yahoo" | "emergency-call"
-
- /**
- * @see https://facebook.github.io/react-native/docs/textinput.html#props
- */
- export interface TextInputProperties extends ViewProperties, TextInputIOSProperties, TextInputAndroidProperties, React.Props {
-
- /**
- * Can tell TextInput to automatically capitalize certain characters.
- * characters: all characters,
- * words: first letter of each word
- * sentences: first letter of each sentence (default)
- * none: don't auto capitalize anything
- *
- * https://facebook.github.io/react-native/docs/textinput.html#autocapitalize
- */
- autoCapitalize?: "none" | "sentences" | "words" | "characters"
-
- /**
- * If false, disables auto-correct.
- * The default value is true.
- */
- autoCorrect?: boolean
-
- /**
- * If true, focuses the input on componentDidMount.
- * The default value is false.
- */
- autoFocus?: boolean
-
- /**
- * If true, the text field will blur when submitted.
- * The default value is true.
- */
- blurOnSubmit?: boolean
-
- /**
- * Provides an initial value that will change when the user starts typing.
- * Useful for simple use-cases where you don't want to deal with listening to events
- * and updating the value prop to keep the controlled state in sync.
- */
- defaultValue?: string
-
- /**
- * If false, text is not editable. The default value is true.
- */
- editable?: boolean
-
- /**
- * enum("default", 'numeric', 'email-address', "ascii-capable", 'numbers-and-punctuation', 'url', 'number-pad', 'phone-pad', 'name-phone-pad', 'decimal-pad', 'twitter', 'web-search')
- * Determines which keyboard to open, e.g.numeric.
- * The following values work across platforms: - default - numeric - email-address - phone-pad
- */
- keyboardType?: KeyboardType | KeyboardTypeIOS
-
- /**
- * Limits the maximum number of characters that can be entered.
- * Use this instead of implementing the logic in JS to avoid flicker.
- */
- maxLength?: number
-
- /**
- * If true, the text input can be multiple lines. The default value is false.
- */
- multiline?: boolean
-
- /**
- * Callback that is called when the text input is blurred
- */
- onBlur?: () => void
-
- /**
- * Callback that is called when the text input's text changes.
- */
- onChange?: (event: { nativeEvent: { text: string, contentSize: { width: number, height: number }, target: number, eventCount: number } }) => void
-
- /**
- * Callback that is called when the text input's text changes.
- * Changed text is passed as an argument to the callback handler.
- */
- onChangeText?: (text: string) => void
-
- /**
- * Callback that is called when the text input's content size changes.
- * This will be called with
- * `{ nativeEvent: { contentSize: { width, height } } }`.
- *
- * Only called for multiline text inputs.
- */
- onContentSizeChange?: ( event: {nativeEvent: {contentSize: { width: number, height: number}}} ) => void
-
- /**
- * Callback that is called when text input ends.
- */
- onEndEditing?: (event: { nativeEvent: { text: string } }) => void
-
- /**
- * Callback that is called when the text input is focused
- */
- onFocus?: () => void
-
- /**
- * Callback that is called when the text input selection is changed.
- */
- onSelectionChange?: (event: { nativeEvent: { selection: { start: number, end: number }, target: number } }) => void
-
- /**
- * Callback that is called when the text input's submit button is pressed.
- */
- onSubmitEditing?: (event: { nativeEvent: { text: string } }) => void
-
- /**
- * The string that will be rendered before text input has been entered
- */
- placeholder?: string
-
- /**
- * The text color of the placeholder string
- */
- placeholderTextColor?: string
-
- /**
- * enum('default', 'go', 'google', 'join', 'next', 'route', 'search', 'send', 'yahoo', 'done', 'emergency-call')
- * Determines how the return key should look.
- */
- returnKeyType?: ReturnKeyType | ReturnKeyTypeAndroid | ReturnKeyTypeIOS
-
- /**
- * If true, the text input obscures the text entered so that sensitive text like passwords stay secure.
- * The default value is false.
- */
- secureTextEntry?: boolean
-
- /**
- * If true, all text will automatically be selected on focus
- */
- selectTextOnFocus?: boolean
-
- /**
- * The start and end of the text input's selection. Set start and end to
- * the same value to position the cursor.
- */
- selection?: { start: number, end?: number }
-
- /**
- * The highlight (and cursor on ios) color of the text input
- */
- selectionColor?: string
-
- /**
- * Styles
- */
- style?: TextStyle
-
- /**
- * Used to locate this view in end-to-end tests
- */
- testID?: string
-
- /**
- * The value to show for the text input. TextInput is a controlled component,
- * which means the native value will be forced to match this value prop if provided.
- * 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.
- * In addition to simply setting the same value, either set editable={false},
- * or set/update maxLength to prevent unwanted edits without flicker.
- */
- value?: string
-
- ref?: React.Ref
- }
-
- /**
- * This class is responsible for coordinating the "focused"
- * state for TextInputs. All calls relating to the keyboard
- * should be funneled through here
- */
- interface TextInputState {
- /**
- * Returns the ID of the currently focused text field, if one exists
- * If no text field is focused it returns null
- */
- currentlyFocusedField(): number
-
- /**
- * @param {number} TextInputID id of the text field to focus
- * Focuses the specified text field
- * noop if the text field was already focused
- */
- focusTextInput(textFieldID?: number): void
-
- /**
- * @param {number} textFieldID id of the text field to focus
- * Unfocuses the specified text field
- * noop if it wasn't focused
- */
- blurTextInput(textFieldID?: number) : void
- }
-
- /**
- * @see https://facebook.github.io/react-native/docs/textinput.html#methods
- */
- export interface TextInputStatic extends NativeMethodsMixin, TimerMixin, React.ComponentClass {
- State: TextInputState
-
- /**
- * Returns if the input is currently focused.
- */
- isFocused: () => boolean
-
- /**
- * Removes all text from the input.
- */
- clear: () => void
- }
-
- export type ToolbarAndroidAction = {
- /**
- * title: required, the title of this action
- */
- title: string
-
- /**
- * icon: the icon for this action, e.g. require('./some_icon.png')
- */
- icon?: ImageURISource
-
- /**
- * show: when to show this action as an icon or hide it in the overflow menu: always, ifRoom or never
- */
- show?: "always" | "ifRoom" | "never"
-
- /**
- * showWithText: boolean, whether to show text alongside the icon or not
- */
- showWithText?: boolean
- }
-
- export interface ToolbarAndroidProperties extends ViewProperties, React.Props {
-
- /**
- * Sets possible actions on the toolbar as part of the action menu. These are displayed as icons
- * or text on the right side of the widget. If they don't fit they are placed in an 'overflow'
- * menu.
- *
- * This property takes an array of objects, where each object has the following keys:
- *
- * * `title`: **required**, the title of this action
- * * `icon`: the icon for this action, e.g. `require('./some_icon.png')`
- * * `show`: when to show this action as an icon or hide it in the overflow menu: `always`,
- * `ifRoom` or `never`
- * * `showWithText`: boolean, whether to show text alongside the icon or not
- */
- actions?: ToolbarAndroidAction[]
-
- /**
- * Sets the content inset for the toolbar ending edge.
- * The content inset affects the valid area for Toolbar content other
- * than the navigation button and menu. Insets define the minimum
- * margin for these components and can be used to effectively align
- * Toolbar content along well-known gridlines.
- */
- contentInsetEnd?: number
-
- /**
- * Sets the content inset for the toolbar starting edge.
- * The content inset affects the valid area for Toolbar content
- * other than the navigation button and menu. Insets define the
- * minimum margin for these components and can be used to effectively
- * align Toolbar content along well-known gridlines.
- */
- contentInsetStart?: number
-
- /**
- * Sets the toolbar logo.
- */
- logo?: ImageURISource
-
- /**
- * Sets the navigation icon.
- */
- navIcon?: ImageURISource
-
- /**
- * Callback that is called when an action is selected. The only
- * argument that is passed to the callback is the position of the
- * action in the actions array.
- */
- onActionSelected?: (position: number) => void
-
- /**
- * Callback called when the icon is selected.
- */
- onIconClicked?: () => void
-
- /**
- * Sets the overflow icon.
- */
- overflowIcon?: ImageURISource
-
- /**
- * Used to set the toolbar direction to RTL.
- * In addition to this property you need to add
- * android:supportsRtl="true"
- * to your application AndroidManifest.xml and then call
- * setLayoutDirection(LayoutDirection.RTL) in your MainActivity
- * onCreate method.
- */
- rtl?: boolean
-
- /**
- * Sets the toolbar subtitle.
- */
- subtitle?: string
-
- /**
- * Sets the toolbar subtitle color.
- */
- subtitleColor?: string
-
- /**
- * Used to locate this view in end-to-end tests.
- */
- testID?: string
-
- /**
- * Sets the toolbar title.
- */
- title?: string
-
- /**
- * Sets the toolbar title color.
- */
- titleColor?: string
-
- ref?: React.Ref
- }
-
- /**
- * React component that wraps the Android-only [`Toolbar` widget][0]. A Toolbar can display a logo,
- * navigation icon (e.g. hamburger menu), a title & subtitle and a list of actions. The title and
- * subtitle are expanded so the logo and navigation icons are displayed on the left, title and
- * subtitle in the middle and the actions on the right.
+ * Returns the array of subscriptions that are currently registered for the
+ * given event type.
*
- * If the toolbar has an only child, it will be displayed between the title and actions.
+ * Note: This array can be potentially sparse as subscriptions are deleted
+ * from it when they are removed.
*
- * Although the Toolbar supports remote images for the logo, navigation and action icons, this
- * should only be used in DEV mode where `require('./some_icon.png')` translates into a packager
- * URL. In release mode you should always use a drawable resource for these icons. Using
- * `require('./some_icon.png')` will do this automatically for you, so as long as you don't
- * explicitly use e.g. `{uri: 'http://...'}`, you will be good.
+ * @param {string} eventType
+ * @returns {?array}
+ */
+ getSubscriptionsForType(eventType: string): EventSubscription[]
+}
+
+/**
+ * EmitterSubscription represents a subscription with listener and context data.
+ */
+interface EmitterSubscription extends EventSubscription {
+ emitter: EventEmitter
+ listener: () => any
+ context: any
+
+ /**
+ * @param {EventEmitter} emitter - The event emitter that registered this
+ * subscription
+ * @param {EventSubscriptionVendor} subscriber - The subscriber that controls
+ * this subscription
+ * @param {function} listener - Function to invoke when the specified event is
+ * emitted
+ * @param {*} context - Optional context object to use when invoking the
+ * listener
+ */
+ new(emitter: EventEmitter, subscriber: EventSubscriptionVendor, listener: () => any, context: any): EmitterSubscription
+
+ /**
+ * Removes this subscription from the emitter that registered it.
+ * Note: we're overriding the `remove()` method of EventSubscription here
+ * but deliberately not calling `super.remove()` as the responsibility
+ * for removing the subscription lies with the EventEmitter.
+ */
+ remove(): void
+}
+
+interface EventEmitter {
+ /**
+ * @constructor
*
- * [0]: https://developer.android.com/reference/android/support/v7/widget/Toolbar.html
+ * @param {EventSubscriptionVendor} subscriber - Optional subscriber instance
+ * to use. If omitted, a new subscriber will be created for the emitter.
*/
- export interface ToolbarAndroidStatic extends NativeMethodsMixin, React.ComponentClass {
-
- }
-
+ new(subscriber?: EventSubscriptionVendor): EventEmitter
/**
- * Gesture recognition on mobile devices is much more complicated than web.
- * A touch can go through several phases as the app determines what the user's intention is.
- * For example, the app needs to determine if the touch is scrolling, sliding on a widget, or tapping.
- * This can even change during the duration of a touch. There can also be multiple simultaneous touches.
+ * Adds a listener to be invoked when events of the specified type are
+ * emitted. An optional calling context may be provided. The data arguments
+ * emitted will be passed to the listener function.
*
- * The touch responder system is needed to allow components to negotiate these touch interactions
- * without any additional knowledge about their parent or child components.
- * This system is implemented in ResponderEventPlugin.js, which contains further details and documentation.
+ * @param {string} eventType - Name of the event to listen to
+ * @param {function} listener - Function to invoke when the specified event is
+ * emitted
+ * @param {*} context - Optional context object to use when invoking the
+ * listener
+ */
+ addListener(eventType: string, listener: (...args: any[]) => any, context: any): EmitterSubscription
+
+ /**
+ * Similar to addListener, except that the listener is removed after it is
+ * invoked once.
*
- * Best Practices
- * Users can feel huge differences in the usability of web apps vs. native, and this is one of the big causes.
- * Every action should have the following attributes:
- * Feedback/highlighting- show the user what is handling their touch, and what will happen when they release the gesture
- * Cancel-ability- when making an action, the user should be able to abort it mid-touch by dragging their finger away
+ * @param {string} eventType - Name of the event to listen to
+ * @param {function} listener - Function to invoke only once when the
+ * specified event is emitted
+ * @param {*} context - Optional context object to use when invoking the
+ * listener
+ */
+ once(eventType: string, listener: (...args: any[]) => any, context: any): EmitterSubscription
+
+ /**
+ * Removes all of the registered listeners, including those registered as
+ * listener maps.
*
- * These features make users more comfortable while using an app,
- * because it allows people to experiment and interact without fear of making mistakes.
+ * @param {?string} eventType - Optional name of the event whose registered
+ * listeners to remove
+ */
+ removeAllListeners(eventType?: string): void
+
+ /**
+ * Provides an API that can be called during an eventing cycle to remove the
+ * last listener that was invoked. This allows a developer to provide an event
+ * object that can remove the listener (or listener map) during the
+ * invocation.
*
- * TouchableHighlight and Touchable*
- * The responder system can be complicated to use.
- * So we have provided an abstract Touchable implementation for things that should be "tappable".
- * This uses the responder system and allows you to easily configure tap interactions declaratively.
- * Use TouchableHighlight anywhere where you would use a button or link on web.
- */
- export interface GestureResponderHandlers {
-
- /**
- * A view can become the touch responder by implementing the correct negotiation methods.
- * There are two methods to ask the view if it wants to become responder:
- */
-
- /**
- * Does this view want to become responder on the start of a touch?
- */
- onStartShouldSetResponder?: (event: GestureResponderEvent) => boolean
-
- /**
- * Called for every touch move on the View when it is not the responder: does this view want to "claim" touch responsiveness?
- */
- onMoveShouldSetResponder?: (event: GestureResponderEvent) => boolean
-
- /**
- * If the View returns true and attempts to become the responder, one of the following will happen:
- */
-
- onResponderEnd?: ( event: GestureResponderEvent ) => void
-
- /**
- * The View is now responding for touch events.
- * This is the time to highlight and show the user what is happening
- */
- onResponderGrant?: (event: GestureResponderEvent) => void
-
- /**
- * Something else is the responder right now and will not release it
- */
- onResponderReject?: (event: GestureResponderEvent) => void
-
- /**
- * If the view is responding, the following handlers can be called:
- */
-
- /**
- * The user is moving their finger
- */
- onResponderMove?: (event: GestureResponderEvent) => void
-
- /**
- * Fired at the end of the touch, ie "touchUp"
- */
- onResponderRelease?: (event: GestureResponderEvent) => void
-
- onResponderStart?: ( event: GestureResponderEvent ) => void
-
- /**
- * Something else wants to become responder.
- * Should this view release the responder? Returning true allows release
- */
- onResponderTerminationRequest?: (event: GestureResponderEvent) => boolean
-
- /**
- * The responder has been taken from the View.
- * Might be taken by other views after a call to onResponderTerminationRequest,
- * or might be taken by the OS without asking (happens with control center/ notification center on iOS)
- */
- onResponderTerminate?: (event: GestureResponderEvent) => void
-
- /**
- * onStartShouldSetResponder and onMoveShouldSetResponder are called with a bubbling pattern,
- * where the deepest node is called first.
- * That means that the deepest component will become responder when multiple Views return true for *ShouldSetResponder handlers.
- * This is desirable in most cases, because it makes sure all controls and buttons are usable.
- *
- * However, sometimes a parent will want to make sure that it becomes responder.
- * This can be handled by using the capture phase.
- * Before the responder system bubbles up from the deepest component,
- * it will do a capture phase, firing on*ShouldSetResponderCapture.
- * So if a parent View wants to prevent the child from becoming responder on a touch start,
- * it should have a onStartShouldSetResponderCapture handler which returns true.
- */
- onStartShouldSetResponderCapture?: (event: GestureResponderEvent) => boolean
-
- /**
- * onStartShouldSetResponder and onMoveShouldSetResponder are called with a bubbling pattern,
- * where the deepest node is called first.
- * That means that the deepest component will become responder when multiple Views return true for *ShouldSetResponder handlers.
- * This is desirable in most cases, because it makes sure all controls and buttons are usable.
- *
- * However, sometimes a parent will want to make sure that it becomes responder.
- * This can be handled by using the capture phase.
- * Before the responder system bubbles up from the deepest component,
- * it will do a capture phase, firing on*ShouldSetResponderCapture.
- * So if a parent View wants to prevent the child from becoming responder on a touch start,
- * it should have a onStartShouldSetResponderCapture handler which returns true.
- */
- onMoveShouldSetResponderCapture?: () => void;
-
- }
-
- // @see https://facebook.github.io/react-native/docs/view.html#style
- export interface ViewStyle extends FlexStyle, TransformsStyle {
- backfaceVisibility?: "visible" | "hidden"
- backgroundColor?: string;
- borderBottomColor?: string;
- borderBottomLeftRadius?: number;
- borderBottomRightRadius?: number;
- borderBottomWidth?: number;
- borderColor?: string;
- borderLeftColor?: string;
- borderRadius?: number;
- borderRightColor?: string;
- borderRightWidth?: number;
- borderStyle?: "solid" | "dotted" | "dashed"
- borderTopColor?: string;
- borderTopLeftRadius?: number;
- borderTopRightRadius?: number;
- borderTopWidth?: number
- opacity?: number;
- overflow?: "visible" | "hidden"
- shadowColor?: string;
- shadowOffset?: { width: number, height: number };
- shadowOpacity?: number;
- shadowRadius?: number;
- elevation?: number;
- testID?: string;
- }
-
-
- export interface ViewPropertiesIOS {
-
- /**
- * Provides additional traits to screen reader.
- * By default no traits are provided unless specified otherwise in element
- *
- * @enum('none', 'button', 'link', 'header', 'search', 'image', 'selected', 'plays', 'key', 'text','summary', 'disabled', 'frequentUpdates', 'startsMedia', 'adjustable', 'allowsDirectInteraction', 'pageTurn')
- */
- accessibilityTraits?: ViewAccessibilityTraits | ViewAccessibilityTraits[];
-
- /**
- * Whether this view should be rendered as a bitmap before compositing.
- *
- * On iOS, this is useful for animations and interactions that do not modify this component's dimensions nor its children;
- * for example, when translating the position of a static view, rasterization allows the renderer to reuse a cached bitmap of a static view
- * and quickly composite it during each frame.
- *
- * Rasterization incurs an off-screen drawing pass and the bitmap consumes memory.
- * Test and measure when using this property.
- */
- shouldRasterizeIOS?: boolean
- }
-
- export interface ViewPropertiesAndroid {
-
- /**
- * Indicates to accessibility services to treat UI component like a native one.
- * Works for Android only.
- *
- * @enum('none', 'button', 'radiobutton_checked', 'radiobutton_unchecked' )
- */
- accessibilityComponentType?: 'none' | 'button' | 'radiobutton_checked' | 'radiobutton_unchecked'
-
-
- /**
- * Indicates to accessibility services whether the user should be notified when this view changes.
- * Works for Android API >= 19 only.
- * See http://developer.android.com/reference/android/view/View.html#attr_android:accessibilityLiveRegion for references.
- */
- accessibilityLiveRegion?: 'none' | 'polite' | 'assertive'
-
- /**
- * Views that are only used to layout their children or otherwise don't draw anything
- * may be automatically removed from the native hierarchy as an optimization.
- * Set this property to false to disable this optimization and ensure that this View exists in the native view hierarchy.
- */
- collapsable?: boolean
-
-
- /**
- * Controls how view is important for accessibility which is if it fires accessibility events
- * and if it is reported to accessibility services that query the screen.
- * Works for Android only. See http://developer.android.com/reference/android/R.attr.html#importantForAccessibility for references.
- *
- * Possible values:
- * 'auto' - The system determines whether the view is important for accessibility - default (recommended).
- * 'yes' - The view is important for accessibility.
- * 'no' - The view is not important for accessibility.
- * 'no-hide-descendants' - The view is not important for accessibility, nor are any of its descendant views.
- */
- importantForAccessibility?: 'auto' | 'yes' | 'no' | 'no-hide-descendants'
-
-
- /**
- * Whether this view needs to rendered offscreen and composited with an alpha in order to preserve 100% correct colors and blending behavior.
- * The default (false) falls back to drawing the component and its children
- * 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.
- * This default may be noticeable and undesired in the case where the View you are setting an opacity on
- * has multiple overlapping elements (e.g. multiple overlapping Views, or text and a background).
- *
- * Rendering offscreen to preserve correct alpha behavior is extremely expensive
- * and hard to debug for non-native developers, which is why it is not turned on by default.
- * If you do need to enable this property for an animation,
- * consider combining it with renderToHardwareTextureAndroid if the view contents are static (i.e. it doesn't need to be redrawn each frame).
- * If that property is enabled, this View will be rendered off-screen once,
- * 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.
- */
- needsOffscreenAlphaCompositing?: boolean
-
-
- /**
- * Whether this view should render itself (and all of its children) into a single hardware texture on the GPU.
- *
- * On Android, this is useful for animations and interactions that only modify opacity, rotation, translation, and/or scale:
- * 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
- * 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.
- */
- renderToHardwareTextureAndroid?: boolean;
-
- }
-
- /**
- * @see https://facebook.github.io/react-native/docs/view.html#props
- */
- export interface ViewProperties extends ViewPropertiesAndroid, ViewPropertiesIOS, GestureResponderHandlers, Touchable, React.Props {
-
- /**
- * 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.
- */
- accessibilityLabel?: string;
-
- /**
- * When true, indicates that the view is an accessibility element.
- * By default, all the touchable elements are accessible.
- */
- accessible?: boolean;
-
- /**
- * This defines how far a touch event can start away from the view.
- * Typical interface guidelines recommend touch targets that are at least
- * 30 - 40 points/density-independent pixels. If a Touchable view has
- * a height of 20 the touchable height can be extended to 40 with
- * hitSlop={{top: 10, bottom: 10, left: 0, right: 0}}
- * NOTE The touch area never extends past the parent view bounds and
- * the Z-index of sibling views always takes precedence if a touch
- * hits two overlapping views.
- */
-
- hitSlop?: Insets
-
- /**
- * When `accessible` is true, the system will try to invoke this function when the user performs accessibility tap gesture.
- */
- onAcccessibilityTap?: () => void;
-
- /**
- * Invoked on mount and layout changes with
- *
- * {nativeEvent: { layout: {x, y, width, height}}}.
- */
- onLayout?: (event: LayoutChangeEvent) => void;
-
- /**
- * When accessible is true, the system will invoke this function when the user performs the magic tap gesture.
- */
- onMagicTap?: () => void;
-
- /**
- *
- * 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:
- *
- * .box-none {
- * pointer-events: none;
- * }
- * .box-none * {
- * pointer-events: all;
- * }
- *
- * box-only is the equivalent of
- *
- * .box-only {
- * pointer-events: all;
- * }
- * .box-only * {
- * pointer-events: none;
- * }
- *
- * But since pointerEvents does not affect layout/appearance, and we are already deviating from the spec by adding additional modes,
- * 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.
- */
- pointerEvents?: "box-none" | "none" | "box-only" | "auto"
-
- /**
- *
- * This is a special performance property exposed by RCTView and is useful for scrolling content when there are many subviews,
- * 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.
- * The subviews must also have overflow: hidden, as should the containing view (or one of its superviews).
- */
- removeClippedSubviews?: boolean
-
- style?: ViewStyle;
-
- /**
- * Used to locate this view in end-to-end tests.
- */
- testID?: string;
- }
-
- /**
- * The most fundamental component for building UI, View is a container that supports layout with flexbox, style, some touch handling,
- * and accessibility controls, and is designed to be nested inside other views and to have 0 to many children of any type.
- * View maps directly to the native view equivalent on whatever platform React is running on,
- * whether that is a UIView, , android.view, etc.
- */
- export interface ViewStatic extends NativeMethodsMixin, React.ClassicComponentClass
{
- AccessibilityTraits: [
- 'none',
- 'button',
- 'link',
- 'header',
- 'search',
- 'image',
- 'selected',
- 'plays',
- 'key',
- 'text',
- 'summary',
- 'disabled',
- 'frequentUpdates',
- 'startsMedia',
- 'adjustable',
- 'allowsDirectInteraction',
- 'pageTurn'
- ]
-
- AccessibilityComponentType: [
- 'none',
- 'button',
- 'radiobutton_checked',
- 'radiobutton_unchecked'
- ],
-
- /**
- * Is 3D Touch / Force Touch available (i.e. will touch events include `force`)
- * @platform ios
- */
- forceTouchAvailable: boolean,
- }
-
- /**
- * @see https://facebook.github.io/react-native/docs/viewpagerandroid.html#props
- */
-
-
- export interface ViewPagerAndroidOnPageScrollEventData {
- position: number;
- offset: number;
- }
-
- export interface ViewPagerAndroidOnPageSelectedEventData {
- position: number;
- }
-
- export interface ViewPagerAndroidProperties extends ViewProperties {
- /**
- * Index of initial page that should be selected. Use `setPage` method to
- * update the page, and `onPageSelected` to monitor page changes
- */
- initialPage?: number;
-
- /**
- * When false, the content does not scroll.
- * The default value is true.
- */
- scrollEnabled?: boolean;
-
- /**
- * Executed when transitioning between pages (ether because of animation for
- * the requested page change or when user is swiping/dragging between pages)
- * The `event.nativeEvent` object for this callback will carry following data:
- * - position - index of first page from the left that is currently visible
- * - offset - value from range [0,1) describing stage between page transitions.
- * Value x means that (1 - x) fraction of the page at "position" index is
- * visible, and x fraction of the next page is visible.
- */
- onPageScroll?: (event: NativeSyntheticEvent) => void;
-
- /**
- * This callback will be called once ViewPager finish navigating to selected page
- * (when user swipes between pages). The `event.nativeEvent` object passed to this
- * callback will have following fields:
- * - position - index of page that has been selected
- */
- onPageSelected?: (event: NativeSyntheticEvent) => void;
-
- /**
- * Function called when the page scrolling state has changed.
- * The page scrolling state can be in 3 states:
- * - idle, meaning there is no interaction with the page scroller happening at the time
- * - dragging, meaning there is currently an interaction with the page scroller
- * - settling, meaning that there was an interaction with the page scroller, and the
- * page scroller is now finishing it's closing or opening animation
- */
- onPageScrollStateChanged?: (state: "Idle" | "Dragging" | "Settling") => void
-
- /**
- * Determines whether the keyboard gets dismissed in response to a drag.
- * - 'none' (the default), drags do not dismiss the keyboard.
- * - 'on-drag', the keyboard is dismissed when a drag begins.
- */
- keyboardDismissMode?: "none" | "on-drag"
-
- /**
- * Blank space to show between pages. This is only visible while scrolling, pages are still
- * edge-to-edge.
- */
- pageMargin?: number
- }
-
- export interface ViewPagerAndroidStatic extends NativeMethodsMixin, React.ComponentClass {
- /**
- * A helper function to scroll to a specific page in the ViewPager.
- * The transition between pages will be animated.
- */
- setPage(selectedPage: number): void
-
- /**
- * A helper function to scroll to a specific page in the ViewPager.
- * The transition between pages will *not* be animated.
- */
- setPageWithoutAnimation(selectedPage: number): void
- }
-
- /**
- * It is a component to solve the common problem of views that need to move out of the way of the virtual keyboard.
- * It can automatically adjust either its position or bottom padding based on the position of the keyboard.
- */
- export interface KeyboardAvoidingViewStatic extends TimerMixin, React.ClassicComponentClass {
-
- }
-
- export interface KeyboardAvoidingViewProps extends ViewProperties, React.Props {
-
- behavior?: 'height' | 'position' | 'padding'
-
- /**
- * The style of the content container(View) when behavior is 'position'.
- */
- contentContainerStyle?: ViewStyle
-
- /**
- * This is the distance between the top of the user screen and the react native view,
- * may be non-zero in some use cases.
- */
- keyboardVerticalOffset?: number
-
- ref?: React.Ref
- }
-
- /**
- * //FIXME: No documentation extracted from code comment on WebView.ios.js
- */
- export interface NavState {
-
- url?: string
- title?: string
- loading?: boolean
- canGoBack?: boolean
- canGoForward?: boolean;
-
- [key: string]: any
- }
-
- /**
- * Passed data from WebView via window.postMessage.
- */
- export interface WebViewMessageEventData {
- /**
- * The data sent from a WebView; can only be a string.
- */
- data: string
- }
-
- export interface WebViewPropertiesAndroid {
-
- /**
- * Used for android only, JS is enabled by default for WebView on iOS
- */
- javaScriptEnabled?: boolean
-
- /**
- * Used on Android only, controls whether DOM Storage is enabled
- * or not android
- */
- domStorageEnabled?: boolean,
-
- /**
- * Sets the user-agent for the WebView.
- */
- userAgent?: string
- }
-
- export interface WebViewIOSLoadRequestEvent {
- target: number
- canGoBack: boolean
- lockIdentifier: number
- loading: boolean
- title: string
- canGoForward: boolean
- navigationType: 'other' | 'click'
- url: string
- }
-
- export interface WebViewPropertiesIOS {
-
- /**
- * Determines whether HTML5 videos play inline or use the native
- * full-screen controller. default value false
- * NOTE : "In order * for video to play inline, not only does
- * this property need to be set to true, but the video element
- * in the HTML document must also include the webkit-playsinline
- * attribute."
- */
- allowsInlineMediaPlayback?: boolean
-
- /**
- * Boolean value that determines whether the web view bounces
- * when it reaches the edge of the content. The default value is `true`.
- * @platform ios
- */
- bounces?: boolean
-
- /**
- * A floating-point number that determines how quickly the scroll
- * view decelerates after the user lifts their finger. You may also
- * use string shortcuts "normal" and "fast" which match the
- * underlying iOS settings for UIScrollViewDecelerationRateNormal
- * and UIScrollViewDecelerationRateFast respectively.
- * - normal: 0.998 - fast: 0.99 (the default for iOS WebView)
- */
- decelerationRate?: "normal" | "fast" | number
-
- /**
- * Allows custom handling of any webview requests by a JS handler.
- * Return true or false from this method to continue loading the
- * request.
- */
- onShouldStartLoadWithRequest?: (event: WebViewIOSLoadRequestEvent) => boolean
-
- /**
- * Boolean value that determines whether scrolling is enabled in the
- * `WebView`. The default value is `true`.
- */
- scrollEnabled?: boolean
- }
-
- export interface WebViewUriSource {
-
- /*
- * The URI to load in the WebView. Can be a local or remote file.
- */
- uri?: string;
-
- /*
- * The HTTP Method to use. Defaults to GET if not specified.
- * NOTE: On Android, only GET and POST are supported.
- */
- method?: string;
-
- /*
- * Additional HTTP headers to send with the request.
- * NOTE: On Android, this can only be used with GET requests.
- */
- headers?: any;
-
- /*
- * The HTTP body to send with the request. This must be a valid
- * UTF-8 string, and will be sent exactly as specified, with no
- * additional encoding (e.g. URL-escaping or base64) applied.
- * NOTE: On Android, this can only be used with POST requests.
- */
- body?: string;
- }
-
- export interface WebViewHtmlSource {
-
- /*
- * A static HTML page to display in the WebView.
- */
- html: string;
-
- /*
- * The base URL to be used for any relative links in the HTML.
- */
- baseUrl?: string;
- }
-
- /**
- * @see https://facebook.github.io/react-native/docs/webview.html#props
- */
- export interface WebViewProperties extends ViewProperties, WebViewPropertiesAndroid, WebViewPropertiesIOS, React.Props {
-
- /**
- * Controls whether to adjust the content inset for web views that are
- * placed behind a navigation bar, tab bar, or toolbar. The default value
- * is `true`.
- */
- automaticallyAdjustContentInsets?: boolean
-
- /**
- * The amount by which the web view content is inset from the edges of
- * the scroll view. Defaults to {top: 0, left: 0, bottom: 0, right: 0}.
- */
- contentInset?: Insets
-
- /**
- * @deprecated
- */
- html?: string
-
- /**
- * Set this to provide JavaScript that will be injected into the web page
- * when the view loads.
- */
- injectedJavaScript?: string
-
- /**
- * Invoked when load fails
- */
- onError?: (event: NavState) => void
-
- /**
- * Invoked when load finish
- */
- onLoad?: (event: NavState) => void
-
- /**
- * Invoked when load either succeeds or fails
- */
- onLoadEnd?: (event: NavState) => void
-
- /**
- * Invoked on load start
- */
- onLoadStart?: (event: NavState) => void
-
- /**
- * Invoked when window.postMessage is called from WebView.
- */
- onMessage?: ( event: NativeSyntheticEvent ) => void
-
- /**
- * Function that is invoked when the `WebView` loading starts or ends.
- */
- onNavigationStateChange?: ( event: NavState ) => void
-
- /**
- * Function that returns a view to show if there's an error.
- */
- renderError?: () => React.ReactElement
-
- /**
- * Function that returns a loading indicator.
- */
- renderLoading?: () => React.ReactElement
-
- /**
- * Boolean value that forces the `WebView` to show the loading view
- * on the first load.
- */
- startInLoadingState?: boolean
-
- style?: ViewStyle
-
- // Deprecated: Use the `source` prop instead.
- url?: string
-
- source?: WebViewUriSource | WebViewHtmlSource | number
-
- /**
- * Determines whether HTML5 audio & videos require the user to tap
- * before they can start playing. The default value is false.
- */
- mediaPlaybackRequiresUserAction?: boolean
-
- /**
- * sets whether the webpage scales to fit the view and the user can change the scale
- */
- scalesPageToFit?: boolean
-
- ref?: React.Ref
- }
-
-
- export interface WebViewStatic extends React.ClassicComponentClass {
-
- /**
- * Go back one page in the webview's history.
- */
- goBack: () => void
-
- /**
- * Go forward one page in the webview's history.
- */
- goForward: () => void
-
- /**
- * Post a message to the WebView in the form of a string.
- */
- postMessage: (message: string) => void
-
- /**
- * Reloads the current page.
- */
- reload: () => void
-
- /**
- * Stop loading the current page.
- */
- stopLoading(): void
-
- /**
- * Returns the native webview node.
- */
- getWebViewHandle: () => any
- }
-
-
- /**
- * @see https://facebook.github.io/react-native/docs/segmentedcontrolios.html
- * @see SegmentedControlIOS.ios.js
- */
- export interface NativeSegmentedControlIOSChangeEvent {
- value: string
- selectedSegmentIndex: number
- target: number
- }
-
- export interface SegmentedControlIOSProperties extends ViewProperties, React.Props {
-
- /**
- * If false the user won't be able to interact with the control. Default value is true.
- */
- enabled?: boolean
-
- /**
- * If true, then selecting a segment won't persist visually.
- * The onValueChange callback will still work as expected.
- */
- momentary?: boolean
-
- /**
- * Callback that is called when the user taps a segment;
- * passes the event as an argument
- * @param event
- */
- onChange?: (event: NativeSyntheticEvent) => void
-
- /**
- * Callback that is called when the user taps a segment; passes the segment's value as an argument
- * @param value
- */
- onValueChange?: (value: string) => void
-
- /**
- * The index in props.values of the segment to be (pre)selected.
- */
- selectedIndex?: number
-
- /**
- * Accent color of the control.
- */
- tintColor?: string
-
- /**
- * The labels for the control's segment buttons, in order.
- */
- values?: string[]
-
- ref?: React.Ref
- }
-
- /**
- * Use `SegmentedControlIOS` to render a UISegmentedControl iOS.
+ * If it is called when not inside of an emitting cycle it will throw.
*
- * #### Programmatically changing selected index
+ * @throws {Error} When called not during an eventing cycle
*
- * The selected index can be changed on the fly by assigning the
- * selectIndex prop to a state variable, then changing that variable.
- * Note that the state variable would need to be updated as the user
- * selects a value and changes the index, as shown in the example below.
+ * @example
+ * var subscription = emitter.addListenerMap({
+ * someEvent: function(data, event) {
+ * console.log(data);
+ * emitter.removeCurrentListener();
+ * }
+ * });
*
- * ````
- * {
- * this.setState({selectedIndex: event.nativeEvent.selectedSegmentIndex});
- * }}
- * />
- * ````
+ * emitter.emit('someEvent', 'abc'); // logs 'abc'
+ * emitter.emit('someEvent', 'def'); // does not log anything
*/
- export interface SegmentedControlIOSStatic extends NativeMethodsMixin, React.ClassicComponentClass {
-
- }
-
-
- export interface NavigatorIOSProperties extends React.Props {
- /**
- * The default background color of the navigation bar.
- */
- barTintColor?: string
-
- /**
- * NavigatorIOS uses "route" objects to identify child views, their props, and navigation bar configuration.
- * "push" and all the other navigation operations expect routes to be like this
- */
- initialRoute: Route
-
- /**
- * The default wrapper style for components in the navigator.
- * A common use case is to set the backgroundColor for every page
- */
- itemWrapperStyle?: ViewStyle
-
- /**
- * Boolean value that indicates whether the interactive pop gesture is
- * enabled. This is useful for enabling/disabling the back swipe navigation
- * gesture.
- *
- * If this prop is not provided, the default behavior is for the back swipe
- * gesture to be enabled when the navigation bar is shown and disabled when
- * the navigation bar is hidden. Once you've provided the
- * `interactivePopGestureEnabled` prop, you can never restore the default
- * behavior.
- */
- interactivePopGestureEnabled?: boolean
-
- /**
- * A Boolean value that indicates whether the navigation bar is hidden
- */
- navigationBarHidden?: boolean
-
- /**
- * A Boolean value that indicates whether to hide the 1px hairline shadow
- */
- shadowHidden?: boolean
-
- /**
- * The color used for buttons in the navigation bar
- */
- tintColor?: string
-
- /**
- * The text color of the navigation bar title
- */
- titleTextColor?: string
-
- /**
- * A Boolean value that indicates whether the navigation bar is translucent
- */
- translucent?: boolean
-
- /**
- * NOT IN THE DOC BUT IN THE EXAMPLES
- */
- style?: ViewStyle
- }
+ removeCurrentListener(): void
/**
- * A navigator is an object of navigation functions that a view can call.
- * It is passed as a prop to any component rendered by NavigatorIOS.
+ * Removes a specific subscription. Called by the `remove()` method of the
+ * subscription itself to ensure any necessary cleanup is performed.
+ */
+ removeSubscription(subscription: EmitterSubscription): void
+
+ /**
+ * Returns an array of listeners that are currently registered for the given
+ * event.
*
- * Navigator functions are also available on the NavigatorIOS component:
+ * @param {string} eventType - Name of the event to query
+ * @returns {array}
+ */
+ listeners(eventType: string): EmitterSubscription[]
+
+ /**
+ * Emits an event of the given type with the given data. All handlers of that
+ * particular type will be notified.
*
- * @see https://facebook.github.io/react-native/docs/navigatorios.html#navigator
+ * @param {string} eventType - Name of the event to emit
+ * @param {...*} Arbitrary arguments to be passed to each registered listener
+ *
+ * @example
+ * emitter.addListener('someEvent', function(message) {
+ * console.log(message);
+ * });
+ *
+ * emitter.emit('someEvent', 'abc'); // logs 'abc'
*/
- export interface NavigationIOS {
- /**
- * Navigate forward to a new route
- */
- push: (route: Route) => void
+ emit(eventType: string): void
- /**
- * Go back one page
- */
- pop: () => void
+ /**
+ * Removes the given listener for event of specific type.
+ *
+ * @param {string} eventType - Name of the event to emit
+ * @param {function} listener - Function to invoke when the specified event is
+ * emitted
+ *
+ * @example
+ * emitter.removeListener('someEvent', function(message) {
+ * console.log(message);
+ * }); // removes the listener if already registered
+ *
+ */
+ removeListener(eventType: string, listener: (...args: any[]) => any): void
+}
- /**
- * Go back N pages at once. When N=1, behavior matches pop()
- */
- popN: (n: number) => void
+/** NativeMethodsMixin provides methods to access the underlying native component directly.
+ * This can be useful in cases when you want to focus a view or measure its on-screen dimensions,
+ * for example.
+ * The methods described here are available on most of the default components provided by React Native.
+ * Note, however, that they are not available on composite components that aren't directly backed by a
+ * native view. This will generally include most components that you define in your own app.
+ * For more information, see [Direct Manipulation](http://facebook.github.io/react-native/docs/direct-manipulation.html).
+ * @see https://github.com/facebook/react-native/blob/master/Libraries/ReactIOS/NativeMethodsMixin.js
+ */
+export interface NativeMethodsMixinStatic {
+ /**
+ * Determines the location on screen, width, and height of the given view and
+ * returns the values via an async callback. If successful, the callback will
+ * be called with the following arguments:
+ *
+ * - x
+ * - y
+ * - width
+ * - height
+ * - pageX
+ * - pageY
+ *
+ * Note that these measurements are not available until after the rendering
+ * has been completed in native. If you need the measurements as soon as
+ * possible, consider using the [`onLayout`
+ * prop](docs/view.html#onlayout) instead.
+ */
+ measure(callback: MeasureOnSuccessCallback): void;
- /**
- * Replace the route for the current page and immediately load the view for the new route
- */
- replace: (route: Route) => void
+ /**
+ * Determines the location of the given view in the window and returns the
+ * values via an async callback. If the React root view is embedded in
+ * another native view, this will give you the absolute coordinates. If
+ * successful, the callback will be called with the following
+ * arguments:
+ *
+ * - x
+ * - y
+ * - width
+ * - height
+ *
+ * Note that these measurements are not available until after the rendering
+ * has been completed in native.
+ */
+ measureInWindow(callback: MeasureInWindowOnSuccessCallback): void;
- /**
- * Replace the route/view for the previous page
- */
- replacePrevious: (route: Route) => void
+ /**
+ * Like [`measure()`](#measure), but measures the view relative an ancestor,
+ * specified as `relativeToNativeNode`. This means that the returned x, y
+ * are relative to the origin x, y of the ancestor view.
+ *
+ * As always, to obtain a native node handle for a component, you can use
+ * `React.findNodeHandle(component)`.
+ */
+ measureLayout(
+ relativeToNativeNode: number,
+ onSuccess: MeasureLayoutOnSuccessCallback,
+ onFail: () => void /* currently unused */
+ ): void;
- /**
- * Replaces the previous route/view and transitions back to it
- */
- replacePreviousAndPop: (route: Route) => void
+ /**
+ * This function sends props straight to native. They will not participate in
+ * future diff process - this means that if you do not include them in the
+ * next render, they will remain active (see [Direct
+ * Manipulation](docs/direct-manipulation.html)).
+ */
+ setNativeProps(nativeProps: Object): void;
- /**
- * Replaces the top item and popToTop
- */
- resetTo: (route: Route) => void
+ /**
+ * Requests focus for the given input or view. The exact behavior triggered
+ * will depend on the platform and type of view.
+ */
+ focus(): void;
- /**
- * Go back to the item for a particular route object
- */
- popToRoute(route: Route): void
+ /**
+ * Removes focus from an input or view. This is the opposite of `focus()`.
+ */
+ blur(): void;
- /**
- * Go back to the top item
- */
- popToTop(): void
+ refs: {
+ [key: string]: React.Component
+ };
+}
+
+// see react-jsx.d.ts
+export function createElement(type: React.ReactType,
+ props?: P,
+ ...children: React.ReactNode[]): React.ReactElement
;
+
+
+export type Runnable = (appParameters: any) => void;
+
+
+// Similar to React.SyntheticEvent except for nativeEvent
+interface NativeSyntheticEvent {
+ bubbles: boolean
+ cancelable: boolean
+ currentTarget: EventTarget
+ defaultPrevented: boolean
+ eventPhase: number
+ isTrusted: boolean
+ nativeEvent: T
+ preventDefault(): void
+ stopPropagation(): void
+ target: EventTarget
+ timeStamp: Date
+ type: string
+}
+
+export interface NativeTouchEvent {
+ /**
+ * Array of all touch events that have changed since the last event
+ */
+ changedTouches: NativeTouchEvent[]
+
+ /**
+ * The ID of the touch
+ */
+ identifier: string
+
+ /**
+ * The X position of the touch, relative to the element
+ */
+ locationX: number
+
+ /**
+ * The Y position of the touch, relative to the element
+ */
+ locationY: number
+
+ /**
+ * The X position of the touch, relative to the screen
+ */
+ pageX: number
+
+ /**
+ * The Y position of the touch, relative to the screen
+ */
+ pageY: number
+
+ /**
+ * The node id of the element receiving the touch event
+ */
+ target: string
+
+ /**
+ * A time identifier for the touch, useful for velocity calculation
+ */
+ timestamp: number
+
+ /**
+ * Array of all current touches on the screen
+ */
+ touches: NativeTouchEvent[]
+}
+
+export interface GestureResponderEvent extends NativeSyntheticEvent {
+}
+
+
+export interface PointProperties {
+ x: number
+ y: number
+}
+
+export interface Insets {
+ top?: number
+ left?: number
+ bottom?: number
+ right?: number
+}
+
+/**
+ * //FIXME: need to find documentation on which component is a TTouchable and can implement that interface
+ * @see React.DOMAtributes
+ */
+export interface Touchable {
+ onTouchStart?: (event: GestureResponderEvent) => void
+ onTouchMove?: (event: GestureResponderEvent) => void
+ onTouchEnd?: (event: GestureResponderEvent) => void
+ onTouchCancel?: (event: GestureResponderEvent) => void
+ onTouchEndCapture?: (event: GestureResponderEvent) => void
+}
+
+export type ComponentProvider = () => React.ComponentClass
+
+export type AppConfig = {
+ appKey: string;
+ component?: ComponentProvider
+ run?: Runnable;
+}
+
+// https://github.com/facebook/react-native/blob/master/Libraries/AppRegistry/AppRegistry.js
+/**
+ * `AppRegistry` is the JS entry point to running all React Native apps. App
+ * root components should register themselves with
+ * `AppRegistry.registerComponent`, then the native system can load the bundle
+ * for the app and then actually run the app when it's ready by invoking
+ * `AppRegistry.runApplication`.
+ *
+ * To "stop" an application when a view should be destroyed, call
+ * `AppRegistry.unmountApplicationComponentAtRootTag` with the tag that was
+ * pass into `runApplication`. These should always be used as a pair.
+ *
+ * `AppRegistry` should be `require`d early in the `require` sequence to make
+ * sure the JS execution environment is setup before other modules are
+ * `require`d.
+ */
+export class AppRegistry {
+ static registerConfig(config: AppConfig[]): void;
+
+ static registerComponent( appKey: string, getComponentFunc: ComponentProvider ): string;
+
+ static registerRunnable(appKey: string, func: Runnable): string;
+
+ static getAppKeys(): string[];
+
+ static unmountApplicationComponentAtRootTag(rootTag: number): void;
+
+ static runApplication(appKey: string, appParameters: any): void;
+}
+
+export interface LayoutAnimationTypes {
+ spring: string
+ linear: string
+ easeInEaseOut: string
+ easeIn: string
+ easeOut: string
+}
+
+export interface LayoutAnimationProperties {
+ opacity: string
+ scaleXY: string
+}
+
+export interface LayoutAnimationAnim {
+ duration?: number
+ delay?: number
+ springDamping?: number
+ initialVelocity?: number
+ type?: string //LayoutAnimationTypes
+ property?: string //LayoutAnimationProperties
+}
+
+export interface LayoutAnimationConfig {
+ duration: number
+ create?: LayoutAnimationAnim
+ update?: LayoutAnimationAnim
+ delete?: LayoutAnimationAnim
+}
+
+/** Automatically animates views to their new positions when the next layout happens.
+ * A common way to use this API is to call LayoutAnimation.configureNext before
+ * calling setState. */
+export interface LayoutAnimationStatic {
+ /** Schedules an animation to happen on the next layout.
+ * @param config Specifies animation properties:
+ * `duration` in milliseconds
+ * `create`, config for animating in new views (see Anim type)
+ * `update`, config for animating views that have been updated (see Anim type)
+ * @param onAnimationDidEnd Called when the animation finished. Only supported on iOS.
+ */
+ configureNext: ( config: LayoutAnimationConfig, onAnimationDidEnd?: () => void ) => void
+ /** Helper for creating a config for configureNext. */
+ create: (duration: number, type?: string, creationProp?: string) => LayoutAnimationConfig
+ Types: LayoutAnimationTypes
+ Properties: LayoutAnimationProperties
+ configChecker: (shapeTypes: {[key: string]: any}) => any
+ Presets: {
+ easeInEaseOut: LayoutAnimationConfig
+ linear: LayoutAnimationConfig
+ spring: LayoutAnimationConfig
}
+ easeInEaseOut: (config: LayoutAnimationConfig, onAnimationDidEnd?: () => void) => void
+ linear: (config: LayoutAnimationConfig, onAnimationDidEnd?: () => void) => void
+ spring: (config: LayoutAnimationConfig, onAnimationDidEnd?: () => void) => void
+}
- export interface NavigatorIOSStatic extends NavigationIOS, React.ComponentClass {
+export type FlexAlignType = "flex-start" | "flex-end" | "center" | "stretch";
+export type FlexJustifyType = "flex-start" | "flex-end" | "center" | "space-between" | "space-around";
+export type FlexDirection = "row" | "column" | "row-reverse" | "column-reverse";
+
+/**
+ * Flex Prop Types
+ * @see https://facebook.github.io/react-native/docs/flexbox.html#proptypes
+ * @see LayoutPropTypes.js
+ */
+export interface FlexStyle {
+
+ alignItems?: FlexAlignType;
+ alignSelf?: "auto" | FlexAlignType;
+ borderBottomWidth?: number
+ borderLeftWidth?: number
+ borderRightWidth?: number
+ borderTopWidth?: number
+ borderWidth?: number
+ bottom?: number
+ flex?: number
+ flexGrow?: number
+ flexShrink?: number
+ flexBasis?: number
+ flexDirection?: FlexDirection
+ flexWrap?: "wrap" | "nowrap"
+ height?: number
+ justifyContent?: FlexJustifyType
+ left?: number
+ minWidth?: number
+ maxWidth?: number
+ minHeight?: number
+ maxHeight?: number
+ margin?: number
+ marginBottom?: number
+ marginHorizontal?: number
+ marginLeft?: number
+ marginRight?: number
+ marginTop?: number
+ marginVertical?: number
+ overflow?: "visible" | "hidden" | "scroll"
+ padding?: number
+ paddingBottom?: number
+ paddingHorizontal?: number
+ paddingLeft?: number
+ paddingRight?: number
+ paddingTop?: number
+ paddingVertical?: number
+ position?: "absolute" | "relative"
+ right?: number
+ top?: number
+ width?: number
+
+ /**
+ * @platform ios
+ */
+ zIndex?: number
+}
+
+/**
+ * @see ShadowPropTypesIOS.js
+ */
+export interface ShadowPropTypesIOSStatic {
+ /**
+ * Sets the drop shadow color
+ * @platform ios
+ */
+ shadowColor: string
+
+ /**
+ * Sets the drop shadow offset
+ * @platform ios
+ */
+ shadowOffset: { width: number, height: number }
+
+ /**
+ * Sets the drop shadow opacity (multiplied by the color's alpha component)
+ * @platform ios
+ */
+ shadowOpacity: number
+
+ /**
+ * Sets the drop shadow blur radius
+ * @platform ios
+ */
+ shadowRadius: number
+}
+
+type GetCurrentPositionOptions = {
+ timeout: number
+ maximumAge: number
+ enableHighAccuracy: boolean
+ distanceFilter: number
+}
+
+type WatchPositionOptions = {
+ timeout: number
+ maximumAge: number
+ enableHighAccuracy: boolean
+ distanceFilter: number
+}
+
+type GeolocationReturnType = {
+ coords: {
+ latitude: number
+ longitude: number
+ altitude?: number
+ accuracy?: number
+ altitudeAccuracy?: number
+ heading?: number
+ speed?: number
}
+ timestamp: number
+}
+
+interface PerpectiveTransform {
+ perspective: number;
+}
+
+interface RotateTransform {
+ rotate: string;
+}
+
+interface RotateXTransform {
+ rotateX: string;
+}
+
+interface RotateYTransform {
+ rotateY: string;
+}
+
+interface RotateZTransform {
+ rotateZ: string;
+}
+
+interface ScaleTransform {
+ scale: number;
+}
+
+interface ScaleXTransform {
+ scaleX: number;
+}
+
+interface ScaleYTransform {
+ scaleY: number;
+}
+
+interface TranslateXTransform {
+ translateX: number;
+}
+
+interface TranslateYTransform {
+ translateY: number;
+}
+
+interface SkewXTransform {
+ skewX: string;
+}
+
+interface SkewYTransform {
+ skewY: string;
+}
+
+export interface TransformsStyle {
+
+ transform?: (PerpectiveTransform|RotateTransform|RotateXTransform|RotateYTransform|RotateZTransform|ScaleTransform|ScaleXTransform|ScaleYTransform|TranslateXTransform|TranslateYTransform|SkewXTransform|SkewYTransform)[]
+ transformMatrix?: Array
+ rotation?: number
+ scaleX?: number
+ scaleY?: number
+ translateX?: number
+ translateY?: number
+}
+
+
+export interface StyleSheetProperties {
+ hairlineWidth: number
+ flatten(style: T): T
+}
+
+export interface LayoutRectangle {
+ x: number;
+ y: number;
+ width: number;
+ height: number;
+}
+
+// @see TextProperties.onLayout
+export interface LayoutChangeEvent {
+ nativeEvent: {
+ layout: LayoutRectangle
+ }
+}
+
+export interface TextStyleIOS extends ViewStyle {
+ letterSpacing?: number
+ textDecorationColor?: string
+ textDecorationStyle?: "solid" | "double" | "dotted" | "dashed"
+ writingDirection?: "auto" | "ltr" | "rtl"
+}
+
+export interface TextStyleAndroid extends ViewStyle {
+ textAlignVertical?: "auto" | "top" | "bottom" | "center"
+ includeFontPadding?: boolean
+}
+
+// @see https://facebook.github.io/react-native/docs/text.html#style
+export interface TextStyle extends TextStyleIOS, TextStyleAndroid, ViewStyle {
+ color?: string
+ fontFamily?: string
+ fontSize?: number
+ fontStyle?: "normal" | "italic"
+ /**
+ * Specifies font weight. The values 'normal' and 'bold' are supported
+ * for most fonts. Not all fonts have a variant for each of the numeric
+ * values, in that case the closest one is chosen.
+ */
+ fontWeight?: "normal" | "bold" | "100" | "200" | "300" | "400" | "500" | "600" | "700" | "800" | "900"
+ letterSpacing?: number
+ lineHeight?: number
+ /**
+ * Specifies text alignment.
+ * The value 'justify' is only supported on iOS.
+ */
+ textAlign?: "auto" | "left" | "right" | "center"
+ textDecorationLine?: "none" | "underline" | "line-through" | "underline line-through"
+ textDecorationStyle?: "solid" | "double" | "dotted" | "dashed"
+ textDecorationColor?: string
+ textShadowColor?: string
+ textShadowOffset?: { width: number, height: number }
+ textShadowRadius?: number
+ testID?: string
+}
+
+export interface TextPropertiesIOS {
+ /**
+ * Specifies whether fonts should scale to respect Text Size accessibility setting on iOS. The
+ * default is `true`.
+ */
+ allowFontScaling?: boolean
+
+ /**
+ * Specifies whether font should be scaled down automatically to fit given style constraints.
+ */
+ adjustsFontSizeToFit?: boolean
+
+ /**
+ * Specifies smallest possible scale a font can reach when adjustsFontSizeToFit is enabled. (values 0.01-1.0).
+ */
+ minimumFontScale?: number
+
+ /**
+ * When `true`, no visual change is made when text is pressed down. By
+ * default, a gray oval highlights the text on press down.
+ */
+ suppressHighlighting?: boolean
+}
+
+export interface TextPropertiesAndroid {
+ /**
+ * Lets the user select text, to use the native copy and paste functionality.
+ */
+ selectable?: boolean
+}
+
+// https://facebook.github.io/react-native/docs/text.html#props
+export interface TextProperties extends TextPropertiesIOS, TextPropertiesAndroid, React.Props {
+
+ /**
+ * When set to `true`, indicates that the view is an accessibility element. The default value
+ * for a `Text` element is `true`.
+ *
+ * See the
+ * [Accessibility guide](/react-native/docs/accessibility.html#accessible-ios-android)
+ * for more information.
+ */
+ accessible?: boolean
+
+ /**
+ * This can be one of the following values:
+ *
+ * - `head` - The line is displayed so that the end fits in the container and the missing text
+ * at the beginning of the line is indicated by an ellipsis glyph. e.g., "...wxyz"
+ * - `middle` - The line is displayed so that the beginning and end fit in the container and the
+ * missing text in the middle is indicated by an ellipsis glyph. "ab...yz"
+ * - `tail` - The line is displayed so that the beginning fits in the container and the
+ * missing text at the end of the line is indicated by an ellipsis glyph. e.g., "abcd..."
+ * - `clip` - Lines are not drawn past the edge of the text container.
+ *
+ * The default is `tail`.
+ *
+ * `numberOfLines` must be set in conjunction with this prop.
+ *
+ * > `clip` is working only for iOS
+ */
+ ellipsizeMode?: 'head' | 'middle' | 'tail' | 'clip'
+
+ /**
+ * Line Break mode. Works only with numberOfLines.
+ * clip is working only for iOS
+ */
+ lineBreakMode?: 'head' | 'middle' | 'tail' | 'clip'
+
+ /**
+ * Used to truncate the text with an ellipsis after computing the text
+ * layout, including line wrapping, such that the total number of lines
+ * does not exceed this number.
+ *
+ * This prop is commonly used with `ellipsizeMode`.
+ */
+ numberOfLines?: number
+
+ /**
+ * Invoked on mount and layout changes with
+ *
+ * {nativeEvent: { layout: {x, y, width, height}}}.
+ */
+ onLayout?: (event: LayoutChangeEvent) => void
+
+ /**
+ * This function is called on press.
+ * Text intrinsically supports press handling with a default highlight state (which can be disabled with suppressHighlighting).
+ */
+ onPress?: () => void
+
+ /**
+ * This function is called on long press.
+ * e.g., `onLongPress={this.increaseSize}>``
+ */
+ onLongPress?: () => void
+
+ /**
+ * @see https://facebook.github.io/react-native/docs/text.html#style
+ */
+ style?: TextStyle
+
+ /**
+ * Used to locate this view in end-to-end tests.
+ */
+ testID?: string
+}
+
+/**
+ * A React component for displaying text which supports nesting, styling, and touch handling.
+ */
+export interface TextStatic extends NativeMethodsMixin, React.ClassicComponentClass {
+
+}
+
+type DataDetectorTypes = 'phoneNumber' | 'link' | 'address' | 'calendarEvent' | 'none' | 'all';
+
+/**
+ * DocumentSelectionState is responsible for maintaining selection information
+ * for a document.
+ *
+ * It is intended for use by AbstractTextEditor-based components for
+ * identifying the appropriate start/end positions to modify the
+ * DocumentContent, and for programatically setting browser selection when
+ * components re-render.
+ */
+export interface DocumentSelectionState extends EventEmitter {
+ new(anchor: number, focus: number): DocumentSelectionState
+
+ /**
+ * Apply an update to the state. If either offset value has changed,
+ * set the values and emit the `change` event. Otherwise no-op.
+ *
+ * @param {number} anchor
+ * @param {number} focus
+ */
+ update(anchor: number, focus: number): void
+
+ /**
+ * Given a max text length, constrain our selection offsets to ensure
+ * that the selection remains strictly within the text range.
+ *
+ * @param {number} maxLength
+ */
+ constrainLength(maxLength: number): void
+
+ focus(): void
+ blur(): void
+ hasFocus(): boolean
+ isCollapsed(): boolean
+ isBackward(): boolean
+
+ getAnchorOffset(): number
+ getFocusOffset(): number
+ getStartOffset(): number
+ getEndOffset(): number
+ overlaps(start: number, end: number): boolean
+}
+
+
+/**
+ * IOS Specific properties for TextInput
+ * @see https://facebook.github.io/react-native/docs/textinput.html#props
+ */
+export interface TextInputIOSProperties {
+
+ /**
+ * enum('never', 'while-editing', 'unless-editing', 'always')
+ * When the clear button should appear on the right side of the text view
+ */
+ clearButtonMode?: 'never' | 'while-editing' | 'unless-editing' | 'always'
+
+ /**
+ * If true, clears the text field automatically when editing begins
+ */
+ clearTextOnFocus?: boolean
+
+ /**
+ * Determines the types of data converted to clickable URLs in the text input.
+ * Only valid if `multiline={true}` and `editable={false}`.
+ * By default no data types are detected.
+ *
+ * You can provide one type or an array of many types.
+ *
+ * Possible values for `dataDetectorTypes` are:
+ *
+ * - `'phoneNumber'`
+ * - `'link'`
+ * - `'address'`
+ * - `'calendarEvent'`
+ * - `'none'`
+ * - `'all'`
+ */
+ dataDetectorTypes?: DataDetectorTypes | DataDetectorTypes[]
+
+ /**
+ * If true, the keyboard disables the return key when there is no text and automatically enables it when there is text.
+ * The default value is false.
+ */
+ enablesReturnKeyAutomatically?: boolean
+
+ /**
+ * Determines the color of the keyboard.
+ */
+ keyboardAppearance?: 'default' | 'light' | 'dark'
+
+ /**
+ * Callback that is called when a key is pressed.
+ * Pressed key value is passed as an argument to the callback handler.
+ * Fires before onChange callbacks.
+ */
+ onKeyPress?: (key: string) => void
+
+ /**
+ * See DocumentSelectionState.js, some state that is responsible for maintaining selection information for a document
+ */
+ selectionState?: DocumentSelectionState
+
+
+}
+
+/**
+ * Android Specific properties for TextInput
+ * @see https://facebook.github.io/react-native/docs/textinput.html#props
+ */
+export interface TextInputAndroidProperties {
+
+ /**
+ * If defined, the provided image resource will be rendered on the left.
+ */
+ inlineImageLeft?: string
+
+ /**
+ * Padding between the inline image, if any, and the text input itself.
+ */
+ inlineImagePadding?: number
+
+ /**
+ * Sets the number of lines for a TextInput.
+ * Use it with multiline set to true to be able to fill the lines.
+ */
+ numberOfLines?: number
+
+ /**
+ * Sets the return key to the label. Use it instead of `returnKeyType`.
+ * @platform android
+ */
+ returnKeyLabel?: string
+
+ /**
+ * The color of the textInput underline.
+ */
+ underlineColorAndroid?: string
+}
+
+export type KeyboardType = "default" | "email-address" | "numeric" | "phone-pad"
+export type KeyboardTypeIOS = "ascii-capable" | "numbers-and-punctuation" | "url" | "number-pad" | "name-phone-pad" | "decimal-pad" | "twitter" | "web-search"
+
+export type ReturnKeyType = "done" | "go" | "next" | "search" | "send"
+export type ReturnKeyTypeAndroid = "none" | "previous"
+export type ReturnKeyTypeIOS = "default" | "google" | "join" | "route" | "yahoo" | "emergency-call"
+
+/**
+ * @see https://facebook.github.io/react-native/docs/textinput.html#props
+ */
+export interface TextInputProperties extends ViewProperties, TextInputIOSProperties, TextInputAndroidProperties, React.Props {
+
+ /**
+ * Can tell TextInput to automatically capitalize certain characters.
+ * characters: all characters,
+ * words: first letter of each word
+ * sentences: first letter of each sentence (default)
+ * none: don't auto capitalize anything
+ *
+ * https://facebook.github.io/react-native/docs/textinput.html#autocapitalize
+ */
+ autoCapitalize?: "none" | "sentences" | "words" | "characters"
+
+ /**
+ * If false, disables auto-correct.
+ * The default value is true.
+ */
+ autoCorrect?: boolean
+
+ /**
+ * If true, focuses the input on componentDidMount.
+ * The default value is false.
+ */
+ autoFocus?: boolean
+
+ /**
+ * If true, the text field will blur when submitted.
+ * The default value is true.
+ */
+ blurOnSubmit?: boolean
+
+ /**
+ * Provides an initial value that will change when the user starts typing.
+ * Useful for simple use-cases where you don't want to deal with listening to events
+ * and updating the value prop to keep the controlled state in sync.
+ */
+ defaultValue?: string
+
+ /**
+ * If false, text is not editable. The default value is true.
+ */
+ editable?: boolean
+
+ /**
+ * enum("default", 'numeric', 'email-address', "ascii-capable", 'numbers-and-punctuation', 'url', 'number-pad', 'phone-pad', 'name-phone-pad', 'decimal-pad', 'twitter', 'web-search')
+ * Determines which keyboard to open, e.g.numeric.
+ * The following values work across platforms: - default - numeric - email-address - phone-pad
+ */
+ keyboardType?: KeyboardType | KeyboardTypeIOS
+
+ /**
+ * Limits the maximum number of characters that can be entered.
+ * Use this instead of implementing the logic in JS to avoid flicker.
+ */
+ maxLength?: number
+
+ /**
+ * If true, the text input can be multiple lines. The default value is false.
+ */
+ multiline?: boolean
+
+ /**
+ * Callback that is called when the text input is blurred
+ */
+ onBlur?: () => void
+
+ /**
+ * Callback that is called when the text input's text changes.
+ */
+ onChange?: (event: { nativeEvent: { text: string, contentSize: { width: number, height: number }, target: number, eventCount: number } }) => void
+
+ /**
+ * Callback that is called when the text input's text changes.
+ * Changed text is passed as an argument to the callback handler.
+ */
+ onChangeText?: (text: string) => void
+
+ /**
+ * Callback that is called when the text input's content size changes.
+ * This will be called with
+ * `{ nativeEvent: { contentSize: { width, height } } }`.
+ *
+ * Only called for multiline text inputs.
+ */
+ onContentSizeChange?: ( event: {nativeEvent: {contentSize: { width: number, height: number}}} ) => void
+
+ /**
+ * Callback that is called when text input ends.
+ */
+ onEndEditing?: (event: { nativeEvent: { text: string } }) => void
+
+ /**
+ * Callback that is called when the text input is focused
+ */
+ onFocus?: () => void
+
+ /**
+ * Callback that is called when the text input selection is changed.
+ */
+ onSelectionChange?: (event: { nativeEvent: { selection: { start: number, end: number }, target: number } }) => void
+
+ /**
+ * Callback that is called when the text input's submit button is pressed.
+ */
+ onSubmitEditing?: (event: { nativeEvent: { text: string } }) => void
+
+ /**
+ * The string that will be rendered before text input has been entered
+ */
+ placeholder?: string
+
+ /**
+ * The text color of the placeholder string
+ */
+ placeholderTextColor?: string
+
+ /**
+ * enum('default', 'go', 'google', 'join', 'next', 'route', 'search', 'send', 'yahoo', 'done', 'emergency-call')
+ * Determines how the return key should look.
+ */
+ returnKeyType?: ReturnKeyType | ReturnKeyTypeAndroid | ReturnKeyTypeIOS
+
+ /**
+ * If true, the text input obscures the text entered so that sensitive text like passwords stay secure.
+ * The default value is false.
+ */
+ secureTextEntry?: boolean
+
+ /**
+ * If true, all text will automatically be selected on focus
+ */
+ selectTextOnFocus?: boolean
+
+ /**
+ * The start and end of the text input's selection. Set start and end to
+ * the same value to position the cursor.
+ */
+ selection?: { start: number, end?: number }
+
+ /**
+ * The highlight (and cursor on ios) color of the text input
+ */
+ selectionColor?: string
+
+ /**
+ * Styles
+ */
+ style?: TextStyle
+
+ /**
+ * Used to locate this view in end-to-end tests
+ */
+ testID?: string
+
+ /**
+ * The value to show for the text input. TextInput is a controlled component,
+ * which means the native value will be forced to match this value prop if provided.
+ * 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.
+ * In addition to simply setting the same value, either set editable={false},
+ * or set/update maxLength to prevent unwanted edits without flicker.
+ */
+ value?: string
+
+ ref?: React.Ref
+}
+
+/**
+ * This class is responsible for coordinating the "focused"
+ * state for TextInputs. All calls relating to the keyboard
+ * should be funneled through here
+ */
+interface TextInputState {
+ /**
+ * Returns the ID of the currently focused text field, if one exists
+ * If no text field is focused it returns null
+ */
+ currentlyFocusedField(): number
+
+ /**
+ * @param {number} TextInputID id of the text field to focus
+ * Focuses the specified text field
+ * noop if the text field was already focused
+ */
+ focusTextInput(textFieldID?: number): void
+
+ /**
+ * @param {number} textFieldID id of the text field to focus
+ * Unfocuses the specified text field
+ * noop if it wasn't focused
+ */
+ blurTextInput(textFieldID?: number) : void
+}
+
+/**
+ * @see https://facebook.github.io/react-native/docs/textinput.html#methods
+ */
+export interface TextInputStatic extends NativeMethodsMixin, TimerMixin, React.ComponentClass {
+ State: TextInputState
+
+ /**
+ * Returns if the input is currently focused.
+ */
+ isFocused: () => boolean
+
+ /**
+ * Removes all text from the input.
+ */
+ clear: () => void
+}
+
+export type ToolbarAndroidAction = {
+ /**
+ * title: required, the title of this action
+ */
+ title: string
+
+ /**
+ * icon: the icon for this action, e.g. require('./some_icon.png')
+ */
+ icon?: ImageURISource
+
+ /**
+ * show: when to show this action as an icon or hide it in the overflow menu: always, ifRoom or never
+ */
+ show?: "always" | "ifRoom" | "never"
+
+ /**
+ * showWithText: boolean, whether to show text alongside the icon or not
+ */
+ showWithText?: boolean
+}
+
+export interface ToolbarAndroidProperties extends ViewProperties, React.Props {
+
+ /**
+ * Sets possible actions on the toolbar as part of the action menu. These are displayed as icons
+ * or text on the right side of the widget. If they don't fit they are placed in an 'overflow'
+ * menu.
+ *
+ * This property takes an array of objects, where each object has the following keys:
+ *
+ * * `title`: **required**, the title of this action
+ * * `icon`: the icon for this action, e.g. `require('./some_icon.png')`
+ * * `show`: when to show this action as an icon or hide it in the overflow menu: `always`,
+ * `ifRoom` or `never`
+ * * `showWithText`: boolean, whether to show text alongside the icon or not
+ */
+ actions?: ToolbarAndroidAction[]
+
+ /**
+ * Sets the content inset for the toolbar ending edge.
+ * The content inset affects the valid area for Toolbar content other
+ * than the navigation button and menu. Insets define the minimum
+ * margin for these components and can be used to effectively align
+ * Toolbar content along well-known gridlines.
+ */
+ contentInsetEnd?: number
+
+ /**
+ * Sets the content inset for the toolbar starting edge.
+ * The content inset affects the valid area for Toolbar content
+ * other than the navigation button and menu. Insets define the
+ * minimum margin for these components and can be used to effectively
+ * align Toolbar content along well-known gridlines.
+ */
+ contentInsetStart?: number
+
+ /**
+ * Sets the toolbar logo.
+ */
+ logo?: ImageURISource
+
+ /**
+ * Sets the navigation icon.
+ */
+ navIcon?: ImageURISource
+
+ /**
+ * Callback that is called when an action is selected. The only
+ * argument that is passed to the callback is the position of the
+ * action in the actions array.
+ */
+ onActionSelected?: (position: number) => void
+
+ /**
+ * Callback called when the icon is selected.
+ */
+ onIconClicked?: () => void
+
+ /**
+ * Sets the overflow icon.
+ */
+ overflowIcon?: ImageURISource
+
+ /**
+ * Used to set the toolbar direction to RTL.
+ * In addition to this property you need to add
+ * android:supportsRtl="true"
+ * to your application AndroidManifest.xml and then call
+ * setLayoutDirection(LayoutDirection.RTL) in your MainActivity
+ * onCreate method.
+ */
+ rtl?: boolean
+
+ /**
+ * Sets the toolbar subtitle.
+ */
+ subtitle?: string
+
+ /**
+ * Sets the toolbar subtitle color.
+ */
+ subtitleColor?: string
+
+ /**
+ * Used to locate this view in end-to-end tests.
+ */
+ testID?: string
+
+ /**
+ * Sets the toolbar title.
+ */
+ title?: string
+
+ /**
+ * Sets the toolbar title color.
+ */
+ titleColor?: string
+
+ ref?: React.Ref
+}
+
+/**
+ * React component that wraps the Android-only [`Toolbar` widget][0]. A Toolbar can display a logo,
+ * navigation icon (e.g. hamburger menu), a title & subtitle and a list of actions. The title and
+ * subtitle are expanded so the logo and navigation icons are displayed on the left, title and
+ * subtitle in the middle and the actions on the right.
+ *
+ * If the toolbar has an only child, it will be displayed between the title and actions.
+ *
+ * Although the Toolbar supports remote images for the logo, navigation and action icons, this
+ * should only be used in DEV mode where `require('./some_icon.png')` translates into a packager
+ * URL. In release mode you should always use a drawable resource for these icons. Using
+ * `require('./some_icon.png')` will do this automatically for you, so as long as you don't
+ * explicitly use e.g. `{uri: 'http://...'}`, you will be good.
+ *
+ * [0]: https://developer.android.com/reference/android/support/v7/widget/Toolbar.html
+ */
+export interface ToolbarAndroidStatic extends NativeMethodsMixin, React.ComponentClass {
+
+}
+
+
+/**
+ * Gesture recognition on mobile devices is much more complicated than web.
+ * A touch can go through several phases as the app determines what the user's intention is.
+ * For example, the app needs to determine if the touch is scrolling, sliding on a widget, or tapping.
+ * This can even change during the duration of a touch. There can also be multiple simultaneous touches.
+ *
+ * The touch responder system is needed to allow components to negotiate these touch interactions
+ * without any additional knowledge about their parent or child components.
+ * This system is implemented in ResponderEventPlugin.js, which contains further details and documentation.
+ *
+ * Best Practices
+ * Users can feel huge differences in the usability of web apps vs. native, and this is one of the big causes.
+ * Every action should have the following attributes:
+ * Feedback/highlighting- show the user what is handling their touch, and what will happen when they release the gesture
+ * Cancel-ability- when making an action, the user should be able to abort it mid-touch by dragging their finger away
+ *
+ * These features make users more comfortable while using an app,
+ * because it allows people to experiment and interact without fear of making mistakes.
+ *
+ * TouchableHighlight and Touchable*
+ * The responder system can be complicated to use.
+ * So we have provided an abstract Touchable implementation for things that should be "tappable".
+ * This uses the responder system and allows you to easily configure tap interactions declaratively.
+ * Use TouchableHighlight anywhere where you would use a button or link on web.
+ */
+export interface GestureResponderHandlers {
+
+ /**
+ * A view can become the touch responder by implementing the correct negotiation methods.
+ * There are two methods to ask the view if it wants to become responder:
+ */
+
+ /**
+ * Does this view want to become responder on the start of a touch?
+ */
+ onStartShouldSetResponder?: (event: GestureResponderEvent) => boolean
+
+ /**
+ * Called for every touch move on the View when it is not the responder: does this view want to "claim" touch responsiveness?
+ */
+ onMoveShouldSetResponder?: (event: GestureResponderEvent) => boolean
+
+ /**
+ * If the View returns true and attempts to become the responder, one of the following will happen:
+ */
+
+ onResponderEnd?: ( event: GestureResponderEvent ) => void
+
+ /**
+ * The View is now responding for touch events.
+ * This is the time to highlight and show the user what is happening
+ */
+ onResponderGrant?: (event: GestureResponderEvent) => void
+
+ /**
+ * Something else is the responder right now and will not release it
+ */
+ onResponderReject?: (event: GestureResponderEvent) => void
+
+ /**
+ * If the view is responding, the following handlers can be called:
+ */
+
+ /**
+ * The user is moving their finger
+ */
+ onResponderMove?: (event: GestureResponderEvent) => void
+
+ /**
+ * Fired at the end of the touch, ie "touchUp"
+ */
+ onResponderRelease?: (event: GestureResponderEvent) => void
+
+ onResponderStart?: ( event: GestureResponderEvent ) => void
+
+ /**
+ * Something else wants to become responder.
+ * Should this view release the responder? Returning true allows release
+ */
+ onResponderTerminationRequest?: (event: GestureResponderEvent) => boolean
+
+ /**
+ * The responder has been taken from the View.
+ * Might be taken by other views after a call to onResponderTerminationRequest,
+ * or might be taken by the OS without asking (happens with control center/ notification center on iOS)
+ */
+ onResponderTerminate?: (event: GestureResponderEvent) => void
+
+ /**
+ * onStartShouldSetResponder and onMoveShouldSetResponder are called with a bubbling pattern,
+ * where the deepest node is called first.
+ * That means that the deepest component will become responder when multiple Views return true for *ShouldSetResponder handlers.
+ * This is desirable in most cases, because it makes sure all controls and buttons are usable.
+ *
+ * However, sometimes a parent will want to make sure that it becomes responder.
+ * This can be handled by using the capture phase.
+ * Before the responder system bubbles up from the deepest component,
+ * it will do a capture phase, firing on*ShouldSetResponderCapture.
+ * So if a parent View wants to prevent the child from becoming responder on a touch start,
+ * it should have a onStartShouldSetResponderCapture handler which returns true.
+ */
+ onStartShouldSetResponderCapture?: (event: GestureResponderEvent) => boolean
+
+ /**
+ * onStartShouldSetResponder and onMoveShouldSetResponder are called with a bubbling pattern,
+ * where the deepest node is called first.
+ * That means that the deepest component will become responder when multiple Views return true for *ShouldSetResponder handlers.
+ * This is desirable in most cases, because it makes sure all controls and buttons are usable.
+ *
+ * However, sometimes a parent will want to make sure that it becomes responder.
+ * This can be handled by using the capture phase.
+ * Before the responder system bubbles up from the deepest component,
+ * it will do a capture phase, firing on*ShouldSetResponderCapture.
+ * So if a parent View wants to prevent the child from becoming responder on a touch start,
+ * it should have a onStartShouldSetResponderCapture handler which returns true.
+ */
+ onMoveShouldSetResponderCapture?: () => void;
+
+}
+
+// @see https://facebook.github.io/react-native/docs/view.html#style
+export interface ViewStyle extends FlexStyle, TransformsStyle {
+ backfaceVisibility?: "visible" | "hidden"
+ backgroundColor?: string;
+ borderBottomColor?: string;
+ borderBottomLeftRadius?: number;
+ borderBottomRightRadius?: number;
+ borderBottomWidth?: number;
+ borderColor?: string;
+ borderLeftColor?: string;
+ borderRadius?: number;
+ borderRightColor?: string;
+ borderRightWidth?: number;
+ borderStyle?: "solid" | "dotted" | "dashed"
+ borderTopColor?: string;
+ borderTopLeftRadius?: number;
+ borderTopRightRadius?: number;
+ borderTopWidth?: number
+ opacity?: number;
+ overflow?: "visible" | "hidden"
+ shadowColor?: string;
+ shadowOffset?: { width: number, height: number };
+ shadowOpacity?: number;
+ shadowRadius?: number;
+ elevation?: number;
+ testID?: string;
+}
+
+
+export interface ViewPropertiesIOS {
+
+ /**
+ * Provides additional traits to screen reader.
+ * By default no traits are provided unless specified otherwise in element
+ *
+ * @enum('none', 'button', 'link', 'header', 'search', 'image', 'selected', 'plays', 'key', 'text','summary', 'disabled', 'frequentUpdates', 'startsMedia', 'adjustable', 'allowsDirectInteraction', 'pageTurn')
+ */
+ accessibilityTraits?: ViewAccessibilityTraits | ViewAccessibilityTraits[];
+
+ /**
+ * Whether this view should be rendered as a bitmap before compositing.
+ *
+ * On iOS, this is useful for animations and interactions that do not modify this component's dimensions nor its children;
+ * for example, when translating the position of a static view, rasterization allows the renderer to reuse a cached bitmap of a static view
+ * and quickly composite it during each frame.
+ *
+ * Rasterization incurs an off-screen drawing pass and the bitmap consumes memory.
+ * Test and measure when using this property.
+ */
+ shouldRasterizeIOS?: boolean
+}
+
+export interface ViewPropertiesAndroid {
+
+ /**
+ * Indicates to accessibility services to treat UI component like a native one.
+ * Works for Android only.
+ *
+ * @enum('none', 'button', 'radiobutton_checked', 'radiobutton_unchecked' )
+ */
+ accessibilityComponentType?: 'none' | 'button' | 'radiobutton_checked' | 'radiobutton_unchecked'
/**
- * @see https://facebook.github.io/react-native/docs/activityindicator.html#props
+ * Indicates to accessibility services whether the user should be notified when this view changes.
+ * Works for Android API >= 19 only.
+ * See http://developer.android.com/reference/android/view/View.html#attr_android:accessibilityLiveRegion for references.
*/
- export interface ActivityIndicatorProperties extends ViewProperties, React.Props {
+ accessibilityLiveRegion?: 'none' | 'polite' | 'assertive'
- /**
- * Whether to show the indicator (true, the default) or hide it (false).
- */
- animating?: boolean
-
- /**
- * The foreground color of the spinner (default is gray).
- */
- color?: string
-
- /**
- * Whether the indicator should hide when not animating (true by default).
- */
- hidesWhenStopped?: boolean
-
- /**
- * Size of the indicator.
- * Small has a height of 20, large has a height of 36.
- *
- * enum('small', 'large')
- */
- size?: number | 'small' | 'large'
-
- style?: ViewStyle
-
- ref?: React.Ref
- }
-
- export interface ActivityIndicatorStatic extends NativeMethodsMixin, React.ClassicComponentClass {
- }
+ /**
+ * Views that are only used to layout their children or otherwise don't draw anything
+ * may be automatically removed from the native hierarchy as an optimization.
+ * Set this property to false to disable this optimization and ensure that this View exists in the native view hierarchy.
+ */
+ collapsable?: boolean
/**
- * @see https://facebook.github.io/react-native/docs/activityindicatorios.html#props
+ * Controls how view is important for accessibility which is if it fires accessibility events
+ * and if it is reported to accessibility services that query the screen.
+ * Works for Android only. See http://developer.android.com/reference/android/R.attr.html#importantForAccessibility for references.
+ *
+ * Possible values:
+ * 'auto' - The system determines whether the view is important for accessibility - default (recommended).
+ * 'yes' - The view is important for accessibility.
+ * 'no' - The view is not important for accessibility.
+ * 'no-hide-descendants' - The view is not important for accessibility, nor are any of its descendant views.
*/
- export interface ActivityIndicatorIOSProperties extends ViewProperties, React.Props {
-
- /**
- * Whether to show the indicator (true, the default) or hide it (false).
- */
- animating?: boolean
-
- /**
- * The foreground color of the spinner (default is gray).
- */
- color?: string
-
- /**
- * Whether the indicator should hide when not animating (true by default).
- */
- hidesWhenStopped?: boolean
-
- /**
- * Invoked on mount and layout changes with
- */
- onLayout?: (event: { nativeEvent: { layout: { x: number, y: number, width: number, height: number } } }) => void
-
- /**
- * Size of the indicator.
- * Small has a height of 20, large has a height of 36.
- *
- * enum('small', 'large')
- */
- size?: 'small' | 'large'
-
- style?: ViewStyle
-
- ref?: React.Ref
- }
-
- /**
- * @Deprecated since version 0.28.0
- */
- export interface ActivityIndicatorIOSStatic extends React.ComponentClass {
- }
-
-
- export interface DatePickerIOSProperties extends ViewProperties, React.Props {
-
- /**
- * The currently selected date.
- */
- date: Date
-
-
- /**
- * Maximum date.
- * Restricts the range of possible date/time values.
- */
- maximumDate?: Date
-
- /**
- * Maximum date.
- * Restricts the range of possible date/time values.
- */
- minimumDate?: Date
-
- /**
- * enum(1, 2, 3, 4, 5, 6, 10, 12, 15, 20, 30)
- * The interval at which minutes can be selected.
- */
- minuteInterval?: number
-
- /**
- * enum('date', 'time', 'datetime')
- * The date picker mode.
- */
- mode?: "date" | "time" | "datetime"
-
- /**
- * Date change handler.
- * This is called when the user changes the date or time in the UI.
- * The first and only argument is a Date object representing the new date and time.
- */
- onDateChange: ( newDate: Date ) => void
-
- /**
- * Timezone offset in minutes.
- * By default, the date picker will use the device's timezone. With this parameter, it is possible to force a certain timezone offset.
- * For instance, to show times in Pacific Standard Time, pass -7 * 60.
- */
- timeZoneOffsetInMinutes?: number
-
- ref?: React.Ref
- }
-
- export interface DatePickerIOSStatic extends NativeMethodsMixin, React.ComponentClass {
- }
-
- export interface DrawerSlideEvent extends NativeSyntheticEvent {
- }
-
- /**
- * @see DrawerLayoutAndroid.android.js
- */
- export interface DrawerLayoutAndroidProperties extends ViewProperties, React.Props {
-
- /**
- * Specifies the background color of the drawer. The default value
- * is white. If you want to set the opacity of the drawer, use rgba.
- * Example:
- * return (
- *
- *
- *);
- */
- drawerBackgroundColor?: string;
-
- /**
- * Specifies the lock mode of the drawer. The drawer can be locked
- * in 3 states:
- *
- * - unlocked (default), meaning that the drawer will respond
- * (open/close) to touch gestures.
- *
- * - locked-closed, meaning that the drawer will stay closed and not
- * respond to gestures.
- *
- * - locked-open, meaning that the drawer will stay opened and
- * not respond to gestures. The drawer may still be opened and
- * closed programmatically (openDrawer/closeDrawer).
- */
- drawerLockMode?: "unlocked" | "locked-closed" | "locked-open";
-
- /**
- * Specifies the side of the screen from which the drawer will slide in.
- * enum(DrawerLayoutAndroid.positions.Left, DrawerLayoutAndroid.positions.Right)
- */
- drawerPosition?: number;
-
- /**
- * Specifies the width of the drawer, more precisely the width of the
- * view that be pulled in from the edge of the window.
- */
- drawerWidth?: number;
-
- /**
- * Determines whether the keyboard gets dismissed in response to a drag.
- * - 'none' (the default), drags do not dismiss the keyboard.
- * - 'on-drag', the keyboard is dismissed when a drag begins.
- */
- keyboardDismissMode?: "none" | "on-drag"
-
- /**
- * Function called whenever the navigation view has been closed.
- */
- onDrawerClose?: () => void
-
- /**
- * Function called whenever the navigation view has been opened.
- */
- onDrawerOpen?: () => void
-
- /**
- * Function called whenever there is an interaction with the navigation view.
- * @param event
- */
- onDrawerSlide?: (event: DrawerSlideEvent) => void
-
- /**
- * Function called when the drawer state has changed.
- * The drawer can be in 3 states:
- * - idle, meaning there is no interaction with the navigation
- * view happening at the time
- * - dragging, meaning there is currently an interaction with the
- * navigation view
- * - settling, meaning that there was an interaction with the
- * navigation view, and the navigation view is now finishing
- * it's closing or opening animation
- * @param event
- */
- onDrawerStateChanged?: (event: "Idle" | "Dragging" | "Settling") => void
-
- /**
- * The navigation view that will be rendered to the side of the
- * screen and can be pulled in.
- */
- renderNavigationView: () => JSX.Element
-
- /**
- * Make the drawer take the entire screen and draw the background of
- * the status bar to allow it to open over the status bar. It will
- * only have an effect on API 21+.
- */
- statusBarBackgroundColor?: string
-
- ref?: React.Ref
- }
-
- interface DrawerPosition {
- Left: number
- Right: number
- }
-
- export interface DrawerLayoutAndroidStatic extends NativeMethodsMixin, React.ClassicComponentClass {
-
- /**
- * drawer's positions.
- */
- positions: DrawerPosition
-
- /**
- * Opens the drawer.
- */
- openDrawer(): void
-
- /**
- * Closes the drawer.
- */
- closeDrawer(): void
- }
+ importantForAccessibility?: 'auto' | 'yes' | 'no' | 'no-hide-descendants'
/**
- * @see PickerIOS.ios.js
+ * Whether this view needs to rendered offscreen and composited with an alpha in order to preserve 100% correct colors and blending behavior.
+ * The default (false) falls back to drawing the component and its children
+ * 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.
+ * This default may be noticeable and undesired in the case where the View you are setting an opacity on
+ * has multiple overlapping elements (e.g. multiple overlapping Views, or text and a background).
+ *
+ * Rendering offscreen to preserve correct alpha behavior is extremely expensive
+ * and hard to debug for non-native developers, which is why it is not turned on by default.
+ * If you do need to enable this property for an animation,
+ * consider combining it with renderToHardwareTextureAndroid if the view contents are static (i.e. it doesn't need to be redrawn each frame).
+ * If that property is enabled, this View will be rendered off-screen once,
+ * 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.
*/
- export interface PickerIOSItemProperties extends React.Props {
- value?: string | number
- label?: string
- }
+ needsOffscreenAlphaCompositing?: boolean
+
/**
- * @see PickerIOS.ios.js
+ * Whether this view should render itself (and all of its children) into a single hardware texture on the GPU.
+ *
+ * On Android, this is useful for animations and interactions that only modify opacity, rotation, translation, and/or scale:
+ * 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
+ * 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.
*/
- export interface PickerIOSItemStatic extends React.ComponentClass {
- }
+ renderToHardwareTextureAndroid?: boolean;
+
+}
+
+/**
+ * @see https://facebook.github.io/react-native/docs/view.html#props
+ */
+export interface ViewProperties extends ViewPropertiesAndroid, ViewPropertiesIOS, GestureResponderHandlers, Touchable, React.Props {
/**
- * @see Picker.js
+ * 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.
*/
- export interface PickerItemProperties extends React.Props {
- label: string
- value?: any
- }
-
- export interface PickerItemStatic extends React.ComponentClass {
- }
-
- export interface PickerPropertiesIOS extends ViewProperties, React.Props {
-
- /**
- * Style to apply to each of the item labels.
- * @platform ios
- */
- itemStyle?: ViewStyle,
-
- ref?: React.Ref
- }
-
- export interface PickerPropertiesAndroid extends ViewProperties, React.Props {
-
- /**
- * If set to false, the picker will be disabled, i.e. the user will not be able to make a
- * selection.
- * @platform android
- */
- enabled?: boolean
-
- /**
- * On Android, specifies how to display the selection items when the user taps on the picker:
- *
- * - 'dialog': Show a modal dialog. This is the default.
- * - 'dropdown': Shows a dropdown anchored to the picker view
- *
- * @platform android
- */
- mode?: "dialog" | "dropdown"
-
- /**
- * Prompt string for this picker, used on Android in dialog mode as the title of the dialog.
- * @platform android
- */
- prompt?: string
-
- ref?: React.Ref
- }
+ accessibilityLabel?: string;
/**
- * @see https://facebook.github.io/react-native/docs/picker.html
- * @see Picker.js
+ * When true, indicates that the view is an accessibility element.
+ * By default, all the touchable elements are accessible.
*/
- export interface PickerProperties extends PickerPropertiesIOS, PickerPropertiesAndroid, React.Props {
-
- /**
- * Callback for when an item is selected. This is called with the
- * following parameters:
- * - itemValue: the value prop of the item that was selected
- * - itemPosition: the index of the selected item in this picker
- * @param itemValue
- * @param itemPosition
- */
- onValueChange?: (itemValue: any, itemPosition: number) => void
-
- /**
- * Value matching value of one of the items.
- * Can be a string or an integer.
- */
- selectedValue?: any
-
- style?: ViewStyle
-
- /**
- * Used to locate this view in end-to-end tests.
- */
- testId?: string
-
- ref?: React.Ref
- }
+ accessible?: boolean;
/**
- * @see https://facebook.github.io/react-native/docs/picker.html
- * @see Picker.js
- */
- export interface PickerStatic extends React.ComponentClass {
-
- /**
- * On Android, display the options in a dialog.
- */
- MODE_DIALOG: string
- /**
- * On Android, display the options in a dropdown (this is the default).
- */
- MODE_DROPDOWN: string
-
- Item?: PickerItemStatic
- }
-
- /**
- * @see https://facebook.github.io/react-native/docs/pickerios.html
- * @see PickerIOS.ios.js
- */
- export interface PickerIOSProperties extends ViewProperties, React.Props {
-
- itemStyle?: TextStyle
- onValueChange?: ( value: string | number ) => void
- selectedValue?: string | number
-
- ref?: React.Ref
- }
-
- /**
- * @see https://facebook.github.io/react-native/docs/pickerios.html
- * @see PickerIOS.ios.js
- */
- export interface PickerIOSStatic extends NativeMethodsMixin, React.ClassicComponentClass {
-
- Item: PickerIOSItemStatic
- }
-
- /**
- * @see https://facebook.github.io/react-native/docs/progressbarandroid.html
- * @see ProgressBarAndroid.android.js
- */
- export interface ProgressBarAndroidProperties extends ViewProperties, React.Props {
-
- /**
- * Style of the ProgressBar. One of:
- Horizontal
- Normal (default)
- Small
- Large
- Inverse
- SmallInverse
- LargeInverse
- */
- styleAttr?: "Horizontal" | "Normal" | "Small" | "Large" | "Inverse" | "SmallInverse" | "LargeInverse"
-
- /**
- * If the progress bar will show indeterminate progress.
- * Note that this can only be false if styleAttr is Horizontal.
- */
- indeterminate?: boolean
-
- /**
- * The progress value (between 0 and 1).
- */
- progress?: number
-
- /**
- * Color of the progress bar.
- */
- color?: string
-
- /**
- * Used to locate this view in end-to-end tests.
- */
- testID?: string
-
- ref?: React.Ref
- }
- /**
- * React component that wraps the Android-only `ProgressBar`. This component is used to indicate
- * that the app is loading or there is some activity in the app.
+ * This defines how far a touch event can start away from the view.
+ * Typical interface guidelines recommend touch targets that are at least
+ * 30 - 40 points/density-independent pixels. If a Touchable view has
+ * a height of 20 the touchable height can be extended to 40 with
+ * hitSlop={{top: 10, bottom: 10, left: 0, right: 0}}
+ * NOTE The touch area never extends past the parent view bounds and
+ * the Z-index of sibling views always takes precedence if a touch
+ * hits two overlapping views.
*/
- export interface ProgressBarAndroidStatic extends NativeMethodsMixin, React.ClassicComponentClass {
- }
+
+ hitSlop?: Insets
/**
- * @see https://facebook.github.io/react-native/docs/progressviewios.html
- * @see ProgressViewIOS.ios.js
+ * When `accessible` is true, the system will try to invoke this function when the user performs accessibility tap gesture.
*/
- export interface ProgressViewIOSProperties extends ViewProperties, React.Props {
-
- /**
- * The progress bar style.
- */
- progressViewStyle?: "default" | "bar"
-
- /**
- * The progress value (between 0 and 1).
- */
- progress?: number
-
- /**
- * The tint color of the progress bar itself.
- */
- progressTintColor?: string
-
- /**
- * The tint color of the progress bar track.
- */
- trackTintColor?: string
-
- /**
- * A stretchable image to display as the progress bar.
- */
- progressImage?: ImageURISource | ImageURISource[]
-
- /**
- * A stretchable image to display behind the progress bar.
- */
- trackImage?: ImageURISource | ImageURISource[]
-
- ref?: React.Ref
- }
- export interface ProgressViewIOSStatic extends NativeMethodsMixin, React.ClassicComponentClass {
- }
-
- export interface RefreshControlPropertiesIOS extends ViewProperties, React.Props {
-
- /**
- * The color of the refresh indicator.
- */
- tintColor?: string
-
- /**
- * The title displayed under the refresh indicator.
- */
- title?: string
-
- /**
- * Title color.
- */
- titleColor?: string
-
- ref?: React.Ref
- }
-
- export interface RefreshControlPropertiesAndroid extends ViewProperties, React.Props {
-
- /**
- * The colors (at least one) that will be used to draw the refresh indicator.
- */
- colors?: string[]
-
- /**
- * Whether the pull to refresh functionality is enabled.
- */
- enabled?: boolean
-
- /**
- * The background color of the refresh indicator.
- */
- progressBackgroundColor?: string
-
- /**
- * Size of the refresh indicator, see RefreshControl.SIZE.
- */
- size?: number
-
- /**
- * Progress view top offset
- * @platform android
- */
- progressViewOffset?: number
-
- ref?: React.Ref
- }
-
- export interface RefreshControlProperties extends RefreshControlPropertiesIOS, RefreshControlPropertiesAndroid, React.Props {
-
- /**
- * Called when the view starts refreshing.
- */
- onRefresh?: () => void
-
- /**
- * Whether the view should be indicating an active refresh.
- */
- refreshing: boolean
-
- ref?: React.Ref
- }
+ onAcccessibilityTap?: () => void;
/**
- * This component is used inside a ScrollView or ListView to add pull to refresh
- * functionality. When the ScrollView is at `scrollY: 0`, swiping down
- * triggers an `onRefresh` event.
+ * Invoked on mount and layout changes with
*
- * __Note:__ `refreshing` is a controlled prop, this is why it needs to be set to true
- * in the `onRefresh` function otherwise the refresh indicator will stop immediately.
+ * {nativeEvent: { layout: {x, y, width, height}}}.
*/
- export interface RefreshControlStatic extends NativeMethodsMixin, React.ClassicComponentClass {
- SIZE: Object // Undocumented
- }
-
- export interface RecyclerViewBackedScrollViewProperties extends ScrollViewProperties, React.Props {
- ref?: React.Ref
- }
+ onLayout?: (event: LayoutChangeEvent) => void;
/**
- * Wrapper around android native recycler view.
- *
- * It simply renders rows passed as children in a separate recycler view cells
- * similarly to how `ScrollView` is doing it. Thanks to the fact that it uses
- * native `RecyclerView` though, rows that are out of sight are going to be
- * automatically detached (similarly on how this would work with
- * `removeClippedSubviews = true` on a `ScrollView.js`).
- *
- * CAUTION: This is an experimental component and should only be used together
- * with javascript implementation of list view (see ListView.js). In order to
- * use it pass this component as `renderScrollComponent` to the list view. For
- * now only horizontal scrolling is supported.
+ * When accessible is true, the system will invoke this function when the user performs the magic tap gesture.
*/
- export interface RecyclerViewBackedScrollViewStatic extends ScrollResponderMixin, React.ClassicComponentClass {
-
- /**
- * A helper function to scroll to a specific point in the scrollview.
- * This is currently used to help focus on child textviews, but can also
- * be used to quickly scroll to any element we want to focus. Syntax:
- *
- * scrollResponderScrollTo(options: {x: number = 0; y: number = 0; animated: boolean = true})
- *
- * Note: The weird argument signature is due to the fact that, for historical reasons,
- * the function also accepts separate arguments as as alternative to the options object.
- * This is deprecated due to ambiguity (y before x), and SHOULD NOT BE USED.
- */
- scrollTo(
- y?: number | { x?: number, y?: number, animated?: boolean },
- x?: number,
- animated?: boolean
- ): void;
-
- /**
- * Returns a reference to the underlying scroll responder, which supports
- * operations like `scrollTo`. All ScrollView-like components should
- * implement this method so that they can be composed while providing access
- * to the underlying scroll responder's methods.
- */
- getScrollResponder(): JSX.Element;
- }
-
- export interface SliderPropertiesIOS extends ViewProperties, React.Props {
-
- /**
- * Assigns a maximum track image. Only static images are supported.
- * The leftmost pixel of the image will be stretched to fill the track.
- */
- maximumTrackImage?: ImageURISource
-
- /**
- * The color used for the track to the right of the button.
- * Overrides the default blue gradient image.
- */
- maximumTrackTintColor?: string
-
- /**
- * Assigns a minimum track image. Only static images are supported.
- * The rightmost pixel of the image will be stretched to fill the track.
- */
- minimumTrackImage?: ImageURISource
-
- /**
- * The color used for the track to the left of the button.
- * Overrides the default blue gradient image.
- */
- minimumTrackTintColor?: string
-
- /**
- * Sets an image for the thumb. Only static images are supported.
- */
- thumbImage?: ImageURISource
-
- /**
- * Assigns a single image for the track. Only static images
- * are supported. The center pixel of the image will be stretched
- * to fill the track.
- */
- trackImage?: ImageURISource
-
- ref?: React.Ref
- }
-
- export interface SliderProperties extends SliderPropertiesIOS, React.Props {
-
- /**
- * If true the user won't be able to move the slider.
- * Default value is false.
- */
- disabled?: boolean
-
- /**
- * Initial maximum value of the slider. Default value is 1.
- */
- maximumValue?: number
-
- /**
- * Initial minimum value of the slider. Default value is 0.
- */
- minimumValue?: number
-
- /**
- * Callback called when the user finishes changing the value (e.g. when the slider is released).
- * @param value
- */
- onSlidingComplete?: (value: number) => void
-
- /**
- * Callback continuously called while the user is dragging the slider.
- * @param value
- */
- onValueChange?: (value: number) => void
-
- /**
- * Step value of the slider. The value should be between 0 and (maximumValue - minimumValue). Default value is 0.
- */
- step?: number
-
- /**
- * Used to style and layout the Slider. See StyleSheet.js and ViewStylePropTypes.js for more info.
- */
- style?: ViewStyle
-
- /**
- * Used to locate this view in UI automation tests.
- */
- testID?: string
-
- /**
- * Initial value of the slider. The value should be between minimumValue
- * and maximumValue, which default to 0 and 1 respectively.
- * Default value is 0.
- * This is not a controlled component, you don't need to update
- * the value during dragging.
- */
- value?: number
- }
-
- /**
- * A component used to select a single value from a range of values.
- */
- export interface SliderStatic extends NativeMethodsMixin, React.ClassicComponentClass {
-
- }
-
- /**
- * https://facebook.github.io/react-native/docs/switchios.html#props
- */
- export interface SwitchIOSProperties extends ViewProperties, React.Props {
-
- /**
- * If true the user won't be able to toggle the switch. Default value is false.
- */
- disabled?: boolean
-
- /**
- * Background color when the switch is turned on.
- */
- onTintColor?: string
-
- /**
- * Callback that is called when the user toggles the switch.
- */
- onValueChange?: (value: boolean) => void
-
- /**
- * Background color for the switch round button.
- */
- thumbTintColor?: string
-
- /**
- * Background color when the switch is turned off.
- */
- tintColor?: string
-
- /**
- * The value of the switch, if true the switch will be turned on. Default value is false.
- */
- value?: boolean
-
- ref?: React.Ref
- }
+ onMagicTap?: () => void;
/**
*
- * Use SwitchIOS to render a boolean input on iOS.
+ * 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:
*
- * 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,
- * otherwise the user's change will be reverted immediately to reflect props.value as the source of truth.
+ * .box-none {
+ * pointer-events: none;
+ * }
+ * .box-none * {
+ * pointer-events: all;
+ * }
*
- * @see https://facebook.github.io/react-native/docs/switchios.html
+ * box-only is the equivalent of
+ *
+ * .box-only {
+ * pointer-events: all;
+ * }
+ * .box-only * {
+ * pointer-events: none;
+ * }
+ *
+ * But since pointerEvents does not affect layout/appearance, and we are already deviating from the spec by adding additional modes,
+ * 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.
*/
- export interface SwitchIOSStatic extends React.ComponentClass {
-
- }
-
- export type ImageResizeMode = "contain" | "cover" | "stretch" | "center" | "repeat"
+ pointerEvents?: "box-none" | "none" | "box-only" | "auto"
/**
- * @see ImageResizeMode.js
+ *
+ * This is a special performance property exposed by RCTView and is useful for scrolling content when there are many subviews,
+ * 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.
+ * The subviews must also have overflow: hidden, as should the containing view (or one of its superviews).
*/
- export interface ImageResizeModeStatic {
- /**
- * contain - The image will be resized such that it will be completely
- * visible, contained within the frame of the View.
- */
- contain: ImageResizeMode
- /**
- * cover - The image will be resized such that the entire area of the view
- * is covered by the image, potentially clipping parts of the image.
- */
- cover: ImageResizeMode
- /**
- * stretch - The image will be stretched to fill the entire frame of the
- * view without clipping. This may change the aspect ratio of the image,
- * distoring it. Only supported on iOS.
- */
- stretch: ImageResizeMode
- /**
- * center - The image will be scaled down such that it is completely visible,
- * if bigger than the area of the view.
- * The image will not be scaled up.
- */
- center: ImageResizeMode,
+ removeClippedSubviews?: boolean
- /**
- * repeat - The image will be repeated to cover the frame of the View. The
- * image will keep it's size and aspect ratio.
- */
- repeat: ImageResizeMode,
- }
-
- export interface ShadowStyleIOS {
- shadowColor?: string
- shadowOffset?: {width: number, height: number}
- shadowOpacity?: number
- shadowRadius?: number
- }
+ style?: ViewStyle;
/**
- * Image style
- * @see https://facebook.github.io/react-native/docs/image.html#style
+ * Used to locate this view in end-to-end tests.
*/
- export interface ImageStyle extends FlexStyle, TransformsStyle, ShadowStyleIOS {
- resizeMode?: ImageResizeMode
- backfaceVisibility?: "visible" | "hidden"
- borderBottomLeftRadius?: number
- borderBottomRightRadius?: number
- backgroundColor?: string
- borderColor?: string
- borderWidth?: number
- borderRadius?: number
- borderTopLeftRadius?: number
- borderTopRightRadius?: number
- overflow?: "visible" | "hidden"
- overlayColor?: string
- tintColor?: string
- opacity?: number
- }
+ testID?: string;
+}
- export interface ImagePropertiesIOS {
- /**
- * The text that's read by the screen reader when the user interacts with the image.
- */
- accessibilityLabel?: string;
+/**
+ * The most fundamental component for building UI, View is a container that supports layout with flexbox, style, some touch handling,
+ * and accessibility controls, and is designed to be nested inside other views and to have 0 to many children of any type.
+ * View maps directly to the native view equivalent on whatever platform React is running on,
+ * whether that is a UIView, , android.view, etc.
+ */
+export interface ViewStatic extends NativeMethodsMixin, React.ClassicComponentClass
{
+ AccessibilityTraits: [
+ 'none',
+ 'button',
+ 'link',
+ 'header',
+ 'search',
+ 'image',
+ 'selected',
+ 'plays',
+ 'key',
+ 'text',
+ 'summary',
+ 'disabled',
+ 'frequentUpdates',
+ 'startsMedia',
+ 'adjustable',
+ 'allowsDirectInteraction',
+ 'pageTurn'
+ ]
- /**
- * When true, indicates the image is an accessibility element.
- */
- accessible?: boolean;
+ AccessibilityComponentType: [
+ 'none',
+ 'button',
+ 'radiobutton_checked',
+ 'radiobutton_unchecked'
+ ],
- /**
- * blurRadius: the blur radius of the blur filter added to the image
- * @platform ios
- */
- blurRadius?: number,
+ /**
+ * Is 3D Touch / Force Touch available (i.e. will touch events include `force`)
+ * @platform ios
+ */
+ forceTouchAvailable: boolean,
+}
- /**
- * When the image is resized, the corners of the size specified by capInsets will stay a fixed size,
- * but the center content and borders of the image will be stretched.
- * This is useful for creating resizable rounded buttons, shadows, and other resizable assets.
- * More info on Apple documentation
- */
- capInsets?: Insets
+/**
+ * @see https://facebook.github.io/react-native/docs/viewpagerandroid.html#props
+ */
- /**
- * A static image to display while downloading the final image off the network.
- */
- defaultSource?: ImageURISource | number
- /**
- * Invoked on load error with {nativeEvent: {error}}
- */
- onError?: (error: { nativeEvent: any }) => void
+export interface ViewPagerAndroidOnPageScrollEventData {
+ position: number;
+ offset: number;
+}
- /**
- * Invoked on download progress with {nativeEvent: {loaded, total}}
- */
- onProgress?: () => void
+export interface ViewPagerAndroidOnPageSelectedEventData {
+ position: number;
+}
- /**
- * Invoked when a partial load of the image is complete. The definition of
- * what constitutes a "partial load" is loader specific though this is meant
- * for progressive JPEG loads.
- * @platform ios
- */
- onPartialLoad?: () => void,
- }
+export interface ViewPagerAndroidProperties extends ViewProperties {
+ /**
+ * Index of initial page that should be selected. Use `setPage` method to
+ * update the page, and `onPageSelected` to monitor page changes
+ */
+ initialPage?: number;
+
+ /**
+ * When false, the content does not scroll.
+ * The default value is true.
+ */
+ scrollEnabled?: boolean;
+
+ /**
+ * Executed when transitioning between pages (ether because of animation for
+ * the requested page change or when user is swiping/dragging between pages)
+ * The `event.nativeEvent` object for this callback will carry following data:
+ * - position - index of first page from the left that is currently visible
+ * - offset - value from range [0,1) describing stage between page transitions.
+ * Value x means that (1 - x) fraction of the page at "position" index is
+ * visible, and x fraction of the next page is visible.
+ */
+ onPageScroll?: (event: NativeSyntheticEvent) => void;
+
+ /**
+ * This callback will be called once ViewPager finish navigating to selected page
+ * (when user swipes between pages). The `event.nativeEvent` object passed to this
+ * callback will have following fields:
+ * - position - index of page that has been selected
+ */
+ onPageSelected?: (event: NativeSyntheticEvent) => void;
+
+ /**
+ * Function called when the page scrolling state has changed.
+ * The page scrolling state can be in 3 states:
+ * - idle, meaning there is no interaction with the page scroller happening at the time
+ * - dragging, meaning there is currently an interaction with the page scroller
+ * - settling, meaning that there was an interaction with the page scroller, and the
+ * page scroller is now finishing it's closing or opening animation
+ */
+ onPageScrollStateChanged?: (state: "Idle" | "Dragging" | "Settling") => void
+
+ /**
+ * Determines whether the keyboard gets dismissed in response to a drag.
+ * - 'none' (the default), drags do not dismiss the keyboard.
+ * - 'on-drag', the keyboard is dismissed when a drag begins.
+ */
+ keyboardDismissMode?: "none" | "on-drag"
+
+ /**
+ * Blank space to show between pages. This is only visible while scrolling, pages are still
+ * edge-to-edge.
+ */
+ pageMargin?: number
+}
+
+export interface ViewPagerAndroidStatic extends NativeMethodsMixin, React.ComponentClass {
+ /**
+ * A helper function to scroll to a specific page in the ViewPager.
+ * The transition between pages will be animated.
+ */
+ setPage(selectedPage: number): void
+
+ /**
+ * A helper function to scroll to a specific page in the ViewPager.
+ * The transition between pages will *not* be animated.
+ */
+ setPageWithoutAnimation(selectedPage: number): void
+}
+
+/**
+ * It is a component to solve the common problem of views that need to move out of the way of the virtual keyboard.
+ * It can automatically adjust either its position or bottom padding based on the position of the keyboard.
+ */
+export interface KeyboardAvoidingViewStatic extends TimerMixin, React.ClassicComponentClass {
+
+}
+
+export interface KeyboardAvoidingViewProps extends ViewProperties, React.Props {
+
+ behavior?: 'height' | 'position' | 'padding'
+
+ /**
+ * The style of the content container(View) when behavior is 'position'.
+ */
+ contentContainerStyle?: ViewStyle
+
+ /**
+ * This is the distance between the top of the user screen and the react native view,
+ * may be non-zero in some use cases.
+ */
+ keyboardVerticalOffset?: number
+
+ ref?: React.Ref
+}
+
+/**
+ * //FIXME: No documentation extracted from code comment on WebView.ios.js
+ */
+export interface NavState {
+
+ url?: string
+ title?: string
+ loading?: boolean
+ canGoBack?: boolean
+ canGoForward?: boolean;
+
+ [key: string]: any
+}
+
+/**
+ * Passed data from WebView via window.postMessage.
+ */
+export interface WebViewMessageEventData {
+/**
+ * The data sent from a WebView; can only be a string.
+ */
+data: string
+}
+
+export interface WebViewPropertiesAndroid {
+
+ /**
+ * Used for android only, JS is enabled by default for WebView on iOS
+ */
+ javaScriptEnabled?: boolean
+
+ /**
+ * Used on Android only, controls whether DOM Storage is enabled
+ * or not android
+ */
+ domStorageEnabled?: boolean,
+
+ /**
+ * Sets the user-agent for the WebView.
+ */
+ userAgent?: string
+}
+
+export interface WebViewIOSLoadRequestEvent {
+ target: number
+ canGoBack: boolean
+ lockIdentifier: number
+ loading: boolean
+ title: string
+ canGoForward: boolean
+ navigationType: 'other' | 'click'
+ url: string
+}
+
+export interface WebViewPropertiesIOS {
+
+ /**
+ * Determines whether HTML5 videos play inline or use the native
+ * full-screen controller. default value false
+ * NOTE : "In order * for video to play inline, not only does
+ * this property need to be set to true, but the video element
+ * in the HTML document must also include the webkit-playsinline
+ * attribute."
+ */
+ allowsInlineMediaPlayback?: boolean
+
+ /**
+ * Boolean value that determines whether the web view bounces
+ * when it reaches the edge of the content. The default value is `true`.
+ * @platform ios
+ */
+ bounces?: boolean
+
+ /**
+ * A floating-point number that determines how quickly the scroll
+ * view decelerates after the user lifts their finger. You may also
+ * use string shortcuts "normal" and "fast" which match the
+ * underlying iOS settings for UIScrollViewDecelerationRateNormal
+ * and UIScrollViewDecelerationRateFast respectively.
+ * - normal: 0.998 - fast: 0.99 (the default for iOS WebView)
+ */
+ decelerationRate?: "normal" | "fast" | number
+
+ /**
+ * Allows custom handling of any webview requests by a JS handler.
+ * Return true or false from this method to continue loading the
+ * request.
+ */
+ onShouldStartLoadWithRequest?: (event: WebViewIOSLoadRequestEvent) => boolean
+
+ /**
+ * Boolean value that determines whether scrolling is enabled in the
+ * `WebView`. The default value is `true`.
+ */
+ scrollEnabled?: boolean
+}
+
+export interface WebViewUriSource {
/*
- * @see https://github.com/facebook/react-native/blob/master/Libraries/Image/ImageSourcePropType.js
- */
- interface ImageURISource {
- /**
- * `uri` is a string representing the resource identifier for the image, which
- * could be an http address, a local file path, or the name of a static image
- * resource (which should be wrapped in the `require('./path/to/image.png')`
- * function).
- */
- uri?: string,
- /**
- * `bundle` is the iOS asset bundle which the image is included in. This
- * will default to [NSBundle mainBundle] if not set.
- * @platform ios
- */
- bundle?: string,
- /**
- * `method` is the HTTP Method to use. Defaults to GET if not specified.
- */
- method?: string,
- /**
- * `headers` is an object representing the HTTP headers to send along with the
- * request for a remote image.
- */
- headers?: {[key: string]: string},
- /**
- * `body` is the HTTP body to send with the request. This must be a valid
- * UTF-8 string, and will be sent exactly as specified, with no
- * additional encoding (e.g. URL-escaping or base64) applied.
- */
- body?: string,
- /**
- * `width` and `height` can be specified if known at build time, in which case
- * these will be used to set the default `` component dimensions.
- */
- width?: number,
- height?: number,
- /**
- * `scale` is used to indicate the scale factor of the image. Defaults to 1.0 if
- * unspecified, meaning that one image pixel equates to one display point / DIP.
- */
- scale?: number,
- }
-
- /**
- * @see https://facebook.github.io/react-native/docs/image.html
- */
- export interface ImageProperties extends ImagePropertiesIOS, React.Props {
- fadeDuration?: number
- /**
- * onLayout function
- *
- * Invoked on mount and layout changes with
- *
- * {nativeEvent: { layout: {x, y, width, height}}}.
- */
- onLayout?: (event: LayoutChangeEvent) => void;
-
- /**
- * Invoked when load completes successfully
- */
- onLoad?: () => void
-
- /**
- * Invoked when load either succeeds or fails
- */
- onLoadEnd?: () => void
-
- /**
- * Invoked on load start
- */
- onLoadStart?: () => void
-
- progressiveRenderingEnabled?: boolean
-
- /**
- * Determines how to resize the image when the frame doesn't match the raw
- * image dimensions.
- *
- * 'cover': Scale the image uniformly (maintain the image's aspect ratio)
- * so that both dimensions (width and height) of the image will be equal
- * to or larger than the corresponding dimension of the view (minus padding).
- *
- * 'contain': Scale the image uniformly (maintain the image's aspect ratio)
- * so that both dimensions (width and height) of the image will be equal to
- * or less than the corresponding dimension of the view (minus padding).
- *
- * 'stretch': Scale width and height independently, This may change the
- * aspect ratio of the src.
- *
- * 'center': Scale the image down so that it is completely visible,
- * if bigger than the area of the view.
- * The image will not be scaled up.
- */
- resizeMode?: 'cover' |'contain' |'stretch' |'center'
-
- /**
- * The mechanism that should be used to resize the image when the image's dimensions
- * differ from the image view's dimensions. Defaults to `auto`.
- *
- * - `auto`: Use heuristics to pick between `resize` and `scale`.
- *
- * - `resize`: A software operation which changes the encoded image in memory before it
- * gets decoded. This should be used instead of `scale` when the image is much larger
- * than the view.
- *
- * - `scale`: The image gets drawn downscaled or upscaled. Compared to `resize`, `scale` is
- * faster (usually hardware accelerated) and produces higher quality images. This
- * should be used if the image is smaller than the view. It should also be used if the
- * image is slightly bigger than the view.
- *
- * More details about `resize` and `scale` can be found at http://frescolib.org/docs/resizing-rotating.html.
- *
- * @platform android
- */
- resizeMethod?: 'auto' | 'resize' | 'scale'
-
- /**
- * `uri` is a string representing the resource identifier for the image, which
- * could be an http address, a local file path, or a static image
- * resource (which should be wrapped in the `require('./path/to/image.png')` function).
- * This prop can also contain several remote `uri`, specified together with
- * their width and height. The native side will then choose the best `uri` to display
- * based on the measured size of the image container.
- */
- source: ImageURISource | ImageURISource[]
-
- /**
- * similarly to `source`, this property represents the resource used to render
- * the loading indicator for the image, displayed until image is ready to be
- * displayed, typically after when it got downloaded from network.
- */
- loadingIndicatorSource?: ImageURISource;
-
- /**
- *
- * Style
- */
- style?: ImageStyle;
-
- /**
- * A unique identifier for this element to be used in UI Automation testing scripts.
- */
- testID?: string;
-
- }
-
- export interface ImageStatic extends NativeMethodsMixin, React.ComponentClass {
- resizeMode: ImageResizeMode
- getSize(uri: string, success: (width: number, height: number) => void, failure: (error: any) => void): any
- prefetch(url: string): any
- abortPrefetch?(requestId: number): void
- queryCache?(urls: string[]): Promise