Merge pull request #31635 from leethree/subtract

[react-native] add Animated.subtract
This commit is contained in:
Eloy Durán 2018-12-24 14:05:23 +01:00 committed by GitHub
commit 42e3741a35
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 417 additions and 402 deletions

View File

@ -1,4 +1,4 @@
declare module 'react-native/Libraries/Core/Devtools/parseErrorStack' {
declare module "react-native/Libraries/Core/Devtools/parseErrorStack" {
export type StackFrame = {
file: string;
methodName: string;
@ -13,10 +13,8 @@ declare module 'react-native/Libraries/Core/Devtools/parseErrorStack' {
export default function parseErrorStack(error: ExtendedError): StackFrame[];
}
declare module 'react-native/Libraries/Core/Devtools/symbolicateStackTrace' {
import { StackFrame } from 'react-native/Libraries/Core/Devtools/parseErrorStack';
declare module "react-native/Libraries/Core/Devtools/symbolicateStackTrace" {
import { StackFrame } from "react-native/Libraries/Core/Devtools/parseErrorStack";
export default function symbolicateStackTrace(
stack: ReadonlyArray<StackFrame>
): Promise<StackFrame[]>;
export default function symbolicateStackTrace(stack: ReadonlyArray<StackFrame>): Promise<StackFrame[]>;
}

View File

@ -26,7 +26,7 @@ declare function fetchBundle(bundleId: number, callback: (error?: Error | null)
//
declare interface GlobalFetch {
fetch(input: RequestInfo, init?: RequestInit): Promise<Response>;
fetch(input: RequestInfo, init?: RequestInit): Promise<Response>;
}
declare function fetch(input: RequestInfo, init?: RequestInit): Promise<Response>;
@ -34,85 +34,100 @@ declare function fetch(input: RequestInfo, init?: RequestInit): Promise<Response
interface Blob {}
declare class FormData {
append(name: string, value: any): void;
append(name: string, value: any): void;
}
declare interface Body {
readonly bodyUsed: boolean;
arrayBuffer(): Promise<ArrayBuffer>;
blob(): Promise<Blob>;
json(): Promise<any>;
text(): Promise<string>;
formData(): Promise<FormData>;
readonly bodyUsed: boolean;
arrayBuffer(): Promise<ArrayBuffer>;
blob(): Promise<Blob>;
json(): Promise<any>;
text(): Promise<string>;
formData(): Promise<FormData>;
}
declare interface Headers {
append(name: string, value: string): void;
delete(name: string): void;
forEach(callback: Function, thisArg?: any): void;
get(name: string): string | null;
has(name: string): boolean;
set(name: string, value: string): void;
append(name: string, value: string): void;
delete(name: string): void;
forEach(callback: Function, thisArg?: any): void;
get(name: string): string | null;
has(name: string): boolean;
set(name: string, value: string): void;
}
declare var Headers: {
prototype: Headers;
new(init?: HeadersInit_): Headers;
prototype: Headers;
new (init?: HeadersInit_): Headers;
};
type BodyInit_ = Blob | Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array | DataView | ArrayBuffer | FormData | string | null;
type BodyInit_ =
| Blob
| Int8Array
| Int16Array
| Int32Array
| Uint8Array
| Uint16Array
| Uint32Array
| Uint8ClampedArray
| Float32Array
| Float64Array
| DataView
| ArrayBuffer
| FormData
| string
| null;
declare interface RequestInit {
body?: BodyInit_;
credentials?: RequestCredentials_;
headers?: HeadersInit_;
integrity?: string;
keepalive?: boolean;
method?: string;
mode?: RequestMode_;
referrer?: string;
window?: any;
body?: BodyInit_;
credentials?: RequestCredentials_;
headers?: HeadersInit_;
integrity?: string;
keepalive?: boolean;
method?: string;
mode?: RequestMode_;
referrer?: string;
window?: any;
}
declare interface Request extends Object, Body {
readonly credentials: RequestCredentials_;
readonly headers: Headers;
readonly method: string;
readonly mode: RequestMode_;
readonly referrer: string;
readonly url: string;
clone(): Request;
readonly credentials: RequestCredentials_;
readonly headers: Headers;
readonly method: string;
readonly mode: RequestMode_;
readonly referrer: string;
readonly url: string;
clone(): Request;
}
declare var Request: {
prototype: Request;
new(input: Request | string, init?: RequestInit): Request;
prototype: Request;
new (input: Request | string, init?: RequestInit): Request;
};
declare type RequestInfo = Request | string;
declare interface ResponseInit {
headers?: HeadersInit_;
status?: number;
statusText?: string;
headers?: HeadersInit_;
status?: number;
statusText?: string;
}
declare interface Response extends Object, Body {
readonly headers: Headers;
readonly ok: boolean;
readonly status: number;
readonly statusText: string;
readonly type: ResponseType_;
readonly url: string;
readonly redirected: boolean;
clone(): Response;
readonly headers: Headers;
readonly ok: boolean;
readonly status: number;
readonly statusText: string;
readonly type: ResponseType_;
readonly url: string;
readonly redirected: boolean;
clone(): Response;
}
declare var Response: {
prototype: Response;
new(body?: BodyInit_, init?: ResponseInit): Response;
error: () => Response;
redirect: (url: string, status?: number) => Response;
prototype: Response;
new (body?: BodyInit_, init?: ResponseInit): Response;
error: () => Response;
redirect: (url: string, status?: number) => Response;
};
type HeadersInit_ = Headers | string[][] | { [key: string]: string };
@ -125,86 +140,104 @@ type ResponseType_ = "basic" | "cors" | "default" | "error" | "opaque" | "opaque
//
interface XMLHttpRequestEventMap extends XMLHttpRequestEventTargetEventMap {
"readystatechange": Event;
readystatechange: Event;
}
interface XMLHttpRequest extends EventTarget, XMLHttpRequestEventTarget {
// msCaching: string;
onreadystatechange: ((this: XMLHttpRequest, ev: Event) => any) | null;
readonly readyState: number;
readonly response: any;
readonly responseText: string;
responseType: XMLHttpRequestResponseType;
readonly responseURL: string;
readonly responseXML: Document | null;
readonly status: number;
readonly statusText: string;
timeout: number;
readonly upload: XMLHttpRequestUpload;
withCredentials: boolean;
abort(): void;
getAllResponseHeaders(): string;
getResponseHeader(header: string): string | null;
// msCachingEnabled(): boolean;
open(method: string, url: string, async?: boolean, user?: string | null, password?: string | null): void;
overrideMimeType(mime: string): void;
send(data?: any): void;
setRequestHeader(header: string, value: string): void;
readonly DONE: number;
readonly HEADERS_RECEIVED: number;
readonly LOADING: number;
readonly OPENED: number;
readonly UNSENT: number;
addEventListener<K extends keyof XMLHttpRequestEventMap>(type: K, listener: (this: XMLHttpRequest, ev: XMLHttpRequestEventMap[K]) => any): void;
// addEventListener(type: string, listener: EventListenerOrEventListenerObject): void;
removeEventListener<K extends keyof XMLHttpRequestEventMap>(type: K, listener: (this: XMLHttpRequest, ev: XMLHttpRequestEventMap[K]) => any): void;
// removeEventListener(type: string, listener: EventListenerOrEventListenerObject): void;
// msCaching: string;
onreadystatechange: ((this: XMLHttpRequest, ev: Event) => any) | null;
readonly readyState: number;
readonly response: any;
readonly responseText: string;
responseType: XMLHttpRequestResponseType;
readonly responseURL: string;
readonly responseXML: Document | null;
readonly status: number;
readonly statusText: string;
timeout: number;
readonly upload: XMLHttpRequestUpload;
withCredentials: boolean;
abort(): void;
getAllResponseHeaders(): string;
getResponseHeader(header: string): string | null;
// msCachingEnabled(): boolean;
open(method: string, url: string, async?: boolean, user?: string | null, password?: string | null): void;
overrideMimeType(mime: string): void;
send(data?: any): void;
setRequestHeader(header: string, value: string): void;
readonly DONE: number;
readonly HEADERS_RECEIVED: number;
readonly LOADING: number;
readonly OPENED: number;
readonly UNSENT: number;
addEventListener<K extends keyof XMLHttpRequestEventMap>(
type: K,
listener: (this: XMLHttpRequest, ev: XMLHttpRequestEventMap[K]) => any
): void;
// addEventListener(type: string, listener: EventListenerOrEventListenerObject): void;
removeEventListener<K extends keyof XMLHttpRequestEventMap>(
type: K,
listener: (this: XMLHttpRequest, ev: XMLHttpRequestEventMap[K]) => any
): void;
// removeEventListener(type: string, listener: EventListenerOrEventListenerObject): void;
}
declare var XMLHttpRequest: {
prototype: XMLHttpRequest;
new(): XMLHttpRequest;
readonly DONE: number;
readonly HEADERS_RECEIVED: number;
readonly LOADING: number;
readonly OPENED: number;
readonly UNSENT: number;
prototype: XMLHttpRequest;
new (): XMLHttpRequest;
readonly DONE: number;
readonly HEADERS_RECEIVED: number;
readonly LOADING: number;
readonly OPENED: number;
readonly UNSENT: number;
};
interface XMLHttpRequestEventTargetEventMap {
"abort": Event;
"error": Event;
"load": Event;
"loadend": Event;
"loadstart": Event;
"progress": Event;
"timeout": Event;
abort: Event;
error: Event;
load: Event;
loadend: Event;
loadstart: Event;
progress: Event;
timeout: Event;
}
interface XMLHttpRequestEventTarget {
onabort: ((this: XMLHttpRequest, ev: Event) => any) | null;
onerror: ((this: XMLHttpRequest, ev: Event) => any) | null;
onload: ((this: XMLHttpRequest, ev: Event) => any) | null;
onloadend: ((this: XMLHttpRequest, ev: Event) => any) | null;
onloadstart: ((this: XMLHttpRequest, ev: Event) => any) | null;
onprogress: ((this: XMLHttpRequest, ev: Event) => any) | null;
ontimeout: ((this: XMLHttpRequest, ev: Event) => any) | null;
addEventListener<K extends keyof XMLHttpRequestEventTargetEventMap>(type: K, listener: (this: XMLHttpRequestEventTarget, ev: XMLHttpRequestEventTargetEventMap[K]) => any): void;
// addEventListener(type: string, listener: EventListenerOrEventListenerObject): void;
removeEventListener<K extends keyof XMLHttpRequestEventTargetEventMap>(type: K, listener: (this: XMLHttpRequestEventTarget, ev: XMLHttpRequestEventTargetEventMap[K]) => any): void;
// removeEventListener(type: string, listener: EventListenerOrEventListenerObject): void;
onabort: ((this: XMLHttpRequest, ev: Event) => any) | null;
onerror: ((this: XMLHttpRequest, ev: Event) => any) | null;
onload: ((this: XMLHttpRequest, ev: Event) => any) | null;
onloadend: ((this: XMLHttpRequest, ev: Event) => any) | null;
onloadstart: ((this: XMLHttpRequest, ev: Event) => any) | null;
onprogress: ((this: XMLHttpRequest, ev: Event) => any) | null;
ontimeout: ((this: XMLHttpRequest, ev: Event) => any) | null;
addEventListener<K extends keyof XMLHttpRequestEventTargetEventMap>(
type: K,
listener: (this: XMLHttpRequestEventTarget, ev: XMLHttpRequestEventTargetEventMap[K]) => any
): void;
// addEventListener(type: string, listener: EventListenerOrEventListenerObject): void;
removeEventListener<K extends keyof XMLHttpRequestEventTargetEventMap>(
type: K,
listener: (this: XMLHttpRequestEventTarget, ev: XMLHttpRequestEventTargetEventMap[K]) => any
): void;
// removeEventListener(type: string, listener: EventListenerOrEventListenerObject): void;
}
interface XMLHttpRequestUpload extends EventTarget, XMLHttpRequestEventTarget {
addEventListener<K extends keyof XMLHttpRequestEventTargetEventMap>(type: K, listener: (this: XMLHttpRequestUpload, ev: XMLHttpRequestEventTargetEventMap[K]) => any): void;
// addEventListener(type: string, listener: EventListenerOrEventListenerObject): void;
removeEventListener<K extends keyof XMLHttpRequestEventTargetEventMap>(type: K, listener: (this: XMLHttpRequestUpload, ev: XMLHttpRequestEventTargetEventMap[K]) => any): void;
// removeEventListener(type: string, listener: EventListenerOrEventListenerObject): void;
addEventListener<K extends keyof XMLHttpRequestEventTargetEventMap>(
type: K,
listener: (this: XMLHttpRequestUpload, ev: XMLHttpRequestEventTargetEventMap[K]) => any
): void;
// addEventListener(type: string, listener: EventListenerOrEventListenerObject): void;
removeEventListener<K extends keyof XMLHttpRequestEventTargetEventMap>(
type: K,
listener: (this: XMLHttpRequestUpload, ev: XMLHttpRequestEventTargetEventMap[K]) => any
): void;
// removeEventListener(type: string, listener: EventListenerOrEventListenerObject): void;
}
declare var XMLHttpRequestUpload: {
prototype: XMLHttpRequestUpload;
new(): XMLHttpRequestUpload;
prototype: XMLHttpRequestUpload;
new (): XMLHttpRequestUpload;
};
type XMLHttpRequestResponseType = "" | "arraybuffer" | "blob" | "document" | "json" | "text";

View File

@ -35,10 +35,10 @@
/// <reference path="BatchedBridge.d.ts" />
/// <reference path="Devtools.d.ts" />
import * as PropTypes from 'prop-types';
import * as React from 'react';
import * as PropTypes from "prop-types";
import * as React from "react";
type Constructor<T> = new(...args: any[]) => T;
type Constructor<T> = new (...args: any[]) => T;
export type MeasureOnSuccessCallback = (
x: number,
@ -1006,7 +1006,6 @@ export interface TextInputIOSProps {
*/
spellCheck?: boolean;
/**
* Give the keyboard and the system information about the expected
* semantic meaning for the content that users enter.
@ -1046,18 +1045,38 @@ export interface TextInputIOSProps {
* - `'password'`
*
*/
textContentType?: "none" | "URL" | "addressCity" | "addressCityAndState" |
"addressState" | "countryName" | "creditCardNumber" | "emailAddress" |
"familyName" | "fullStreetAddress" | "givenName" | "jobTitle" |
"location" | "middleName" | "name" | "namePrefix" | "nameSuffix" |
"nickname" | "organizationName" | "postalCode" | "streetAddressLine1" |
"streetAddressLine2" | "sublocality" | "telephoneNumber" | "username" |
"password";
textContentType?:
| "none"
| "URL"
| "addressCity"
| "addressCityAndState"
| "addressState"
| "countryName"
| "creditCardNumber"
| "emailAddress"
| "familyName"
| "fullStreetAddress"
| "givenName"
| "jobTitle"
| "location"
| "middleName"
| "name"
| "namePrefix"
| "nameSuffix"
| "nickname"
| "organizationName"
| "postalCode"
| "streetAddressLine1"
| "streetAddressLine2"
| "sublocality"
| "telephoneNumber"
| "username"
| "password";
/**
* If false, scrolling of the text view will be disabled. The default value is true. Only works with multiline={true}
*/
scrollEnabled?: boolean
scrollEnabled?: boolean;
}
/**
@ -1138,7 +1157,7 @@ export interface TextInputFocusEventData {
* @see TextInputProps.onScroll
*/
export interface TextInputScrollEventData {
contentOffset: { x: number; y: number; }
contentOffset: { x: number; y: number };
}
/**
@ -1192,8 +1211,7 @@ export interface TextInputSubmitEditingEventData {
/**
* @see https://facebook.github.io/react-native/docs/textinput.html#props
*/
export interface TextInputProps
extends ViewProps, TextInputIOSProps, TextInputAndroidProps, AccessibilityProps {
export interface TextInputProps extends ViewProps, TextInputIOSProps, TextInputAndroidProps, AccessibilityProps {
/**
* Specifies whether fonts should scale to respect Text Size accessibility settings.
* The default is `true`.
@ -1232,12 +1250,12 @@ export interface TextInputProps
/**
* If true, caret is hidden. The default value is false.
*/
caretHidden?: boolean
caretHidden?: boolean;
/**
* If true, context menu is hidden. The default value is false.
*/
contextMenuHidden?: boolean
contextMenuHidden?: boolean;
/**
* Provides an initial value that will change when the user starts typing.
@ -1741,13 +1759,13 @@ export interface ViewStyle extends FlexStyle, ShadowStyleIOS, TransformsStyle {
opacity?: number;
testID?: string;
/**
* Sets the elevation of a view, using Android's underlying
* [elevation API](https://developer.android.com/training/material/shadows-clipping.html#Elevation).
* This adds a drop shadow to the item and affects z-order for overlapping views.
* Only supported on Android 5.0+, has no effect on earlier versions.
*
* @platform android
*/
* Sets the elevation of a view, using Android's underlying
* [elevation API](https://developer.android.com/training/material/shadows-clipping.html#Elevation).
* This adds a drop shadow to the item and affects z-order for overlapping views.
* Only supported on Android 5.0+, has no effect on earlier versions.
*
* @platform android
*/
elevation?: number;
}
@ -1818,7 +1836,6 @@ export interface ViewPropsAndroid {
renderToHardwareTextureAndroid?: boolean;
}
type Falsy = undefined | null | false;
interface RecursiveArray<T> extends Array<T | RecursiveArray<T>> {}
/** Keep a brand of 'T' so that calls to `StyleSheet.flatten` can take `RegisteredStyle<T>` and return `T`. */
@ -1871,7 +1888,6 @@ export type AccessibilityRole =
| "summary"
| "imagebutton";
export interface AccessibilityPropsAndroid {
/**
* In some cases, we also want to alert the end user of the type of selected component (i.e., that it is a button).
@ -1961,7 +1977,11 @@ type AccessibilityTrait =
* @see https://facebook.github.io/react-native/docs/view.html#props
*/
export interface ViewProps
extends ViewPropsAndroid, ViewPropsIOS, GestureResponderHandlers, Touchable, AccessibilityProps {
extends ViewPropsAndroid,
ViewPropsIOS,
GestureResponderHandlers,
Touchable,
AccessibilityProps {
/**
* This defines how far a touch event can start away from the view.
* Typical interface guidelines recommend touch targets that are at least
@ -2554,7 +2574,6 @@ declare class SafeAreaViewComponent extends React.Component<ViewProps> {}
declare const SafeAreaViewBase: Constructor<NativeMethodsMixin> & typeof SafeAreaViewComponent;
export class SafeAreaView extends SafeAreaViewBase {}
/**
* A component which enables customization of the keyboard input accessory view on iOS. The input accessory view is
* displayed above the keyboard whenever a TextInput has focus. This component can be used to create custom toolbars.
@ -3258,7 +3277,8 @@ export interface RecyclerViewBackedScrollViewProps extends ScrollViewProps {}
* now only horizontal scrolling is supported.
*/
declare class RecyclerViewBackedScrollViewComponent extends React.Component<RecyclerViewBackedScrollViewProps> {}
declare const RecyclerViewBackedScrollViewBase: Constructor<ScrollResponderMixin> & typeof RecyclerViewBackedScrollViewComponent;
declare const RecyclerViewBackedScrollViewBase: Constructor<ScrollResponderMixin> &
typeof RecyclerViewBackedScrollViewComponent;
export class RecyclerViewBackedScrollView extends RecyclerViewBackedScrollViewBase {
/**
* A helper function to scroll to a specific point in the scrollview.
@ -3654,7 +3674,7 @@ export interface ImageLoadEventData extends ImageLoadEventDataAndroid {
height: number;
width: number;
url: string;
}
};
}
export interface ImageErrorEventData {
@ -4105,7 +4125,7 @@ export interface SectionListData<ItemT> extends SectionBase<ItemT> {
*/
export interface SectionListRenderItemInfo<ItemT> extends ListRenderItemInfo<ItemT> {
section: SectionListData<ItemT>;
section: SectionListData<ItemT>;
}
export type SectionListRenderItem<ItemT> = (info: SectionListRenderItemInfo<ItemT>) => React.ReactElement<any> | null;
@ -4163,7 +4183,7 @@ export interface SectionListProps<ItemT> extends VirtualizedListWithoutRenderIte
*/
initialNumToRender?: number;
/**
/**
* Reverses the direction of scroll. Uses scale transforms of -1.
*/
inverted?: boolean;
@ -4199,11 +4219,13 @@ export interface SectionListProps<ItemT> extends VirtualizedListWithoutRenderIte
* Recommended action is to either compute your own offset and `scrollTo` it, or scroll as far
* as possible and then try again after more items have been rendered.
*/
onScrollToIndexFailed?: (info: {
index: number,
highestMeasuredFrameIndex: number,
averageItemLength: number
}) => void;
onScrollToIndexFailed?: (
info: {
index: number;
highestMeasuredFrameIndex: number;
averageItemLength: number;
}
) => void;
/**
* Set this true while waiting for new data from a refresh.
@ -4269,11 +4291,11 @@ export interface SectionListStatic<SectionT> extends React.ComponentClass<Sectio
/**
* @see https://facebook.github.io/react-native/docs/virtualizedlist.html#props
*/
export interface VirtualizedListProps<ItemT> extends VirtualizedListWithoutRenderItemProps<ItemT> {
renderItem: ListRenderItem<ItemT>;
}
export interface VirtualizedListProps<ItemT> extends VirtualizedListWithoutRenderItemProps<ItemT> {
renderItem: ListRenderItem<ItemT>;
}
export interface VirtualizedListWithoutRenderItemProps<ItemT> extends ScrollViewProps {
export interface VirtualizedListWithoutRenderItemProps<ItemT> extends ScrollViewProps {
/**
* Rendered when the list is empty. Can be a React Component Class, a render function, or
* a rendered element.
@ -4387,11 +4409,13 @@ export interface SectionListStatic<SectionT> extends React.ComponentClass<Sectio
* Recommended action is to either compute your own offset and `scrollTo` it, or scroll as far
* as possible and then try again after more items have been rendered.
*/
onScrollToIndexFailed?: (info: {
index: number,
highestMeasuredFrameIndex: number,
averageItemLength: number
}) => void;
onScrollToIndexFailed?: (
info: {
index: number;
highestMeasuredFrameIndex: number;
averageItemLength: number;
}
) => void;
/**
* Called when the viewability of rows changes, as defined by the
@ -4859,7 +4883,9 @@ export interface ModalPropsIOS {
* The `supportedOrientations` prop allows the modal to be rotated to any of the specified orientations.
* On iOS, the modal is still restricted by what's specified in your app's Info.plist's UISupportedInterfaceOrientations field.
*/
supportedOrientations?: Array<"portrait" | "portrait-upside-down" | "landscape" | "landscape-left" | "landscape-right">;
supportedOrientations?: Array<
"portrait" | "portrait-upside-down" | "landscape" | "landscape-left" | "landscape-right"
>;
/**
* The `onDismiss` prop allows passing a function that will be called once the modal has been dismissed.
@ -4880,7 +4906,6 @@ export interface ModalPropsAndroid {
hardwareAccelerated?: boolean;
}
export type ModalProps = ModalBaseProps & ModalPropsIOS & ModalPropsAndroid;
export class Modal extends React.Component<ModalProps> {}
@ -5023,7 +5048,9 @@ export interface TouchableWithoutFeedbackProps extends AccessibilityProps {
* @see https://facebook.github.io/react-native/docs/touchablewithoutfeedback.html
*/
declare class TouchableWithoutFeedbackComponent extends React.Component<TouchableWithoutFeedbackProps> {}
declare const TouchableWithoutFeedbackBase: Constructor<TimerMixin> & Constructor<TouchableMixin> & typeof TouchableWithoutFeedbackComponent;
declare const TouchableWithoutFeedbackBase: Constructor<TimerMixin> &
Constructor<TouchableMixin> &
typeof TouchableWithoutFeedbackComponent;
export class TouchableWithoutFeedback extends TouchableWithoutFeedbackBase {}
/**
@ -5071,7 +5098,10 @@ export interface TouchableHighlightProps extends TouchableWithoutFeedbackProps {
* @see https://facebook.github.io/react-native/docs/touchablehighlight.html
*/
declare class TouchableHighlightComponent extends React.Component<TouchableHighlightProps> {}
declare const TouchableHighlightBase: Constructor<NativeMethodsMixin> & Constructor<TimerMixin> & Constructor<TouchableMixin> & typeof TouchableHighlightComponent;
declare const TouchableHighlightBase: Constructor<NativeMethodsMixin> &
Constructor<TimerMixin> &
Constructor<TouchableMixin> &
typeof TouchableHighlightComponent;
export class TouchableHighlight extends TouchableHighlightBase {}
/**
@ -5094,7 +5124,10 @@ export interface TouchableOpacityProps extends TouchableWithoutFeedbackProps {
* @see https://facebook.github.io/react-native/docs/touchableopacity.html
*/
declare class TouchableOpacityComponent extends React.Component<TouchableOpacityProps> {}
declare const TouchableOpacityBase: Constructor<TimerMixin> & Constructor<TouchableMixin> & Constructor<NativeMethodsMixin> & typeof TouchableOpacityComponent;
declare const TouchableOpacityBase: Constructor<TimerMixin> &
Constructor<TouchableMixin> &
Constructor<NativeMethodsMixin> &
typeof TouchableOpacityComponent;
export class TouchableOpacity extends TouchableOpacityBase {
/**
* Animate the touchable to a new opacity.
@ -5234,7 +5267,9 @@ export namespace StyleSheet {
/**
* Creates a StyleSheet style reference from the given object.
*/
export function create<T extends NamedStyles<T> | NamedStyles<any>>(styles: T): { [P in keyof T]: RegisteredStyle<T[P]> };
export function create<T extends NamedStyles<T> | NamedStyles<any>>(
styles: T
): { [P in keyof T]: RegisteredStyle<T[P]> };
/**
* Flattens an array of style objects, into one aggregated style object.
@ -5289,10 +5324,7 @@ export namespace StyleSheet {
* internally to process color and transform values. You should not use this
* unless you really know what you are doing and have exhausted other options.
*/
export function setStyleAttributePreprocessor(
property: string,
process: (nextProp: any) => any
): void;
export function setStyleAttributePreprocessor(property: string, process: (nextProp: any) => any): void;
/**
* This is defined as the width of a thin line on the platform. It can be
@ -5714,7 +5746,7 @@ interface PlatformStatic {
/**
* @see https://facebook.github.io/react-native/docs/platform-specific-code.html#content
*/
select<T>(specifics: { [platform in PlatformOSType | 'default']?: T }): T;
select<T>(specifics: { [platform in PlatformOSType | "default"]?: T }): T;
}
interface PlatformIOSStatic extends PlatformStatic {
@ -5785,7 +5817,10 @@ export interface Dimensions {
* @param type the type of event to listen to
* @param handler the event handler
*/
addEventListener(type: "change", handler: ({ window, screen }: { window: ScaledSize, screen: ScaledSize }) => void): void;
addEventListener(
type: "change",
handler: ({ window, screen }: { window: ScaledSize; screen: ScaledSize }) => void
): void;
/**
* Remove an event listener
@ -5793,7 +5828,10 @@ export interface Dimensions {
* @param type the type of event
* @param handler the event handler
*/
removeEventListener(type: "change", handler: ({ window, screen }: { window: ScaledSize, screen: ScaledSize }) => void): void;
removeEventListener(
type: "change",
handler: ({ window, screen }: { window: ScaledSize; screen: ScaledSize }) => void
): void;
}
export type SimpleTask = {
@ -6303,11 +6341,7 @@ export interface ScrollViewPropsAndroid {
nestedScrollEnabled?: boolean;
}
export interface ScrollViewProps
extends ViewProps,
ScrollViewPropsIOS,
ScrollViewPropsAndroid,
Touchable {
export interface ScrollViewProps extends ViewProps, ScrollViewPropsIOS, ScrollViewPropsAndroid, Touchable {
/**
* These styles will be applied to the scroll view content container which
* wraps all of the child views. Example:
@ -6713,7 +6747,7 @@ type AccessibilityChangeEvent = boolean;
type AccessibilityAnnoucementFinishedEvent = {
announcement: string;
success: boolean
success: boolean;
};
type AccessibilityEvent = AccessibilityChangeEvent | AccessibilityAnnoucementFinishedEvent;
@ -6897,7 +6931,7 @@ export interface AlertIOSStatic {
callbackOrButtons?: ((value: string) => void) | Array<AlertIOSButton>,
type?: AlertType,
defaultValue?: string,
keyboardType?: KeyboardType | KeyboardTypeIOS,
keyboardType?: KeyboardType | KeyboardTypeIOS
) => void;
}
@ -7699,9 +7733,9 @@ type ScheduleLocalNotificationDetails = {
export type PushNotificationEventName = "notification" | "localNotification" | "register" | "registrationError";
type FetchResult = {
NewData: "UIBackgroundFetchResultNewData",
NoData: "UIBackgroundFetchResultNoData",
ResultFailed: "UIBackgroundFetchResultFailed"
NewData: "UIBackgroundFetchResultNewData";
NoData: "UIBackgroundFetchResultNoData";
ResultFailed: "UIBackgroundFetchResultFailed";
};
/**
@ -7770,7 +7804,10 @@ export interface PushNotificationIOSStatic {
*
* The type MUST be 'notification'
*/
addEventListener(type: "notification" | "localNotification", handler: (notification: PushNotification) => void): void;
addEventListener(
type: "notification" | "localNotification",
handler: (notification: PushNotification) => void
): void;
/**
* Fired when the user registers for remote notifications.
@ -7789,16 +7826,21 @@ export interface PushNotificationIOSStatic {
*
* The type MUST be 'registrationError'
*/
addEventListener(type: "registrationError", handler: (error: { message: string, code: number, details: any }) => void): void;
addEventListener(
type: "registrationError",
handler: (error: { message: string; code: number; details: any }) => void
): void;
/**
* Removes the event listener. Do this in `componentWillUnmount` to prevent
* memory leaks
*/
removeEventListener(type: PushNotificationEventName,
handler: ((notification: PushNotification) => void)
removeEventListener(
type: PushNotificationEventName,
handler:
| ((notification: PushNotification) => void)
| ((deviceToken: string) => void)
| ((error: { message: string, code: number, details: any }) => void)
| ((error: { message: string; code: number; details: any }) => void)
): void;
/**
@ -7956,7 +7998,7 @@ type TimePickerAndroidOpenOptions = {
hour?: number;
minute?: number;
is24Hour?: boolean;
mode?: 'clock' | 'spinner' | 'default';
mode?: "clock" | "spinner" | "default";
};
/**
@ -8166,7 +8208,7 @@ export interface SwitchProps extends SwitchPropsIOS {
*
* Color when false and color when true
*/
trackColor?: { false: string, true: string };
trackColor?: { false: string; true: string };
/**
* If true the user won't be able to toggle the switch.
@ -8190,7 +8232,7 @@ export interface SwitchProps extends SwitchPropsIOS {
*/
value?: boolean;
/**
/**
* On iOS, custom color for the background.
* Can be seen when the switch value is false or when the switch is disabled.
*/
@ -8492,6 +8534,14 @@ export namespace Animated {
class AnimatedAddition extends AnimatedInterpolation {}
/**
* Creates a new Animated value composed by subtracting the second Animated
* value from the first Animated value.
*/
export function subtract(a: Animated, b: Animated): AnimatedSubtraction;
class AnimatedSubtraction extends AnimatedInterpolation {}
/**
* Creates a new Animated value composed by dividing the first Animated
* value by the second Animated value.

View File

@ -66,7 +66,7 @@ import {
StatusBarPropsIOS,
StatusBarPropsAndroid,
SwitchProps,
SwitchPropsIOS
SwitchPropsIOS,
} from "react-native";
declare module "react-native" {

View File

@ -3,27 +3,16 @@ import * as ReactNative from "react-native";
// See https://github.com/react-native-china/react-native-ART-doc/blob/6ba9c0f7c7e495a12045f3d7061834d2c74413c5/doc.md
const {
Surface,
Shape,
Group,
Text,
ClippingRectangle
} = ReactNative.ART
const { Surface, Shape, Group, Text, ClippingRectangle } = ReactNative.ART;
class Test extends React.Component {
render() {
return (
<Surface width={200} height={200}>
<ClippingRectangle
width={ 20 }
height={ 20 }
x={ 100 }
y={ 100 }
>
<Shape d={ /*new Path().moveTo(0,0).lineTo(200,200)*/ 'fixme' } stroke="black" strokeWidth={10}/>
</ClippingRectangle>
</Surface>
)
}
render() {
return (
<Surface width={200} height={200}>
<ClippingRectangle width={20} height={20} x={100} y={100}>
<Shape d={/*new Path().moveTo(0,0).lineTo(200,200)*/ "fixme"} stroke="black" strokeWidth={10} />
</ClippingRectangle>
</Surface>
);
}
}

View File

@ -54,6 +54,7 @@ function TestAnimatedAPI() {
});
Animated.add(v1, v2);
Animated.subtract(v1, v2);
Animated.divide(v1, v2);
Animated.multiply(v1, v2);
Animated.modulo(v1, 2);
@ -70,10 +71,7 @@ function TestAnimatedAPI() {
}
};
Animated.event(
[{ nativeEvent: { contentOffset: { y: v1 } } }],
{ useNativeDriver: true, listener },
);
Animated.event([{ nativeEvent: { contentOffset: { y: v1 } } }], { useNativeDriver: true, listener });
return (
<View>

View File

@ -1,26 +1,28 @@
const fetchCopy: GlobalFetch['fetch'] = fetch;
const fetchCopy: GlobalFetch["fetch"] = fetch;
const myHeaders = new Headers();
myHeaders.append('Content-Type', 'image/jpeg');
myHeaders.append("Content-Type", "image/jpeg");
const myInit: RequestInit = {
method: 'GET',
headers: myHeaders,
mode: 'cors',
method: "GET",
headers: myHeaders,
mode: "cors",
};
const myRequest = new Request('flowers.jpg');
const myRequest = new Request("flowers.jpg");
fetch(myRequest, myInit).then((response) => {
console.log(response.type);
console.log(response.url);
console.log(response.status);
console.log(response.ok);
console.log(response.statusText);
console.log(response.headers);
fetch(myRequest, myInit)
.then(response => {
console.log(response.type);
console.log(response.url);
console.log(response.status);
console.log(response.ok);
console.log(response.statusText);
console.log(response.headers);
return response.blob();
}).then((blob) => {
const init = { status: 200, statusText: 'SuperSmashingGreat!' }
const myResponse = new Response(blob, init);
})
return response.blob();
})
.then(blob => {
const init = { status: 200, statusText: "SuperSmashingGreat!" };
const myResponse = new Response(blob, init);
});

View File

@ -97,7 +97,7 @@ NativeModules.NativeUntypedModule;
NativeModules.NativeTypedModule.someFunction();
NativeModules.NativeTypedModule.someProperty = "";
function dimensionsListener(dimensions: { window: ScaledSize, screen: ScaledSize }) {
function dimensionsListener(dimensions: { window: ScaledSize; screen: ScaledSize }) {
console.log("window dimensions: ", dimensions.window);
console.log("screen dimensions: ", dimensions.screen);
}
@ -105,8 +105,8 @@ function dimensionsListener(dimensions: { window: ScaledSize, screen: ScaledSize
function testDimensions() {
const { width, height, scale, fontScale } = Dimensions.get(1 === 1 ? "window" : "screen");
Dimensions.addEventListener('change', dimensionsListener);
Dimensions.removeEventListener('change', dimensionsListener);
Dimensions.addEventListener("change", dimensionsListener);
Dimensions.removeEventListener("change", dimensionsListener);
}
BackHandler.addEventListener("hardwareBackPress", () => {}).remove();
@ -158,31 +158,31 @@ const stylesAlt = StyleSheet.create({
},
});
StyleSheet.setStyleAttributePreprocessor('fontFamily', (family: string) => family);
StyleSheet.setStyleAttributePreprocessor("fontFamily", (family: string) => family);
const welcomeFontSize = StyleSheet.flatten(styles.welcome).fontSize;
const viewStyle: StyleProp<ViewStyle> = {
backgroundColor: "#F5FCFF",
}
backgroundColor: "#F5FCFF",
};
const textStyle: StyleProp<TextStyle> = {
fontSize: 20,
}
fontSize: 20,
};
const imageStyle: StyleProp<ImageStyle> = {
resizeMode: 'contain',
}
resizeMode: "contain",
};
const viewProperty = StyleSheet.flatten(viewStyle).backgroundColor;
const textProperty = StyleSheet.flatten(textStyle).fontSize;
const imageProperty = StyleSheet.flatten(imageStyle).resizeMode;
const s = StyleSheet.create({
shouldWork: {
fontWeight: '900', // if we comment this line, errors gone
marginTop: 5, // if this line commented, errors also gone
},
})
const f1: RegisteredStyle<TextStyle> = s.shouldWork
shouldWork: {
fontWeight: "900", // if we comment this line, errors gone
marginTop: 5, // if this line commented, errors also gone
},
});
const f1: RegisteredStyle<TextStyle> = s.shouldWork;
const testNativeSyntheticEvent = <T extends {}>(e: NativeSyntheticEvent<T>): void => {
e.isDefaultPrevented();
@ -201,7 +201,7 @@ const testNativeSyntheticEvent = <T extends {}>(e: NativeSyntheticEvent<T>): voi
e.timeStamp;
e.type;
e.nativeEvent;
}
};
function eventHandler<T extends React.BaseSyntheticEvent>(e: T) {}
@ -271,18 +271,16 @@ export class TouchableNativeFeedbackTest extends React.Component {
e.persist();
e.isPropagationStopped();
e.isDefaultPrevented();
}
};
render() {
return (
<TouchableNativeFeedback
onPress={this.onPressButton}
>
<View style={{width: 150, height: 100, backgroundColor: 'red'}}>
<Text style={{margin: 30}}>Button</Text>
<TouchableNativeFeedback onPress={this.onPressButton}>
<View style={{ width: 150, height: 100, backgroundColor: "red" }}>
<Text style={{ margin: 30 }}>Button</Text>
</View>
</TouchableNativeFeedback>
)
);
}
}
@ -353,11 +351,11 @@ export class FlatListTest extends React.Component<FlatListProps<number>, {}> {
}
export class SectionListTest extends React.Component<SectionListProps<string>, {}> {
myList: SectionList<any>
myList: SectionList<any>;
scrollMe = () => {
this.myList.scrollToLocation({itemIndex: 0, sectionIndex: 1});
}
this.myList.scrollToLocation({ itemIndex: 0, sectionIndex: 1 });
};
render() {
const sections = [
@ -381,7 +379,7 @@ export class SectionListTest extends React.Component<SectionListProps<string>, {
<Button title="Press" onPress={this.scrollMe} />
<SectionList
ref={(ref: any) => this.myList = ref}
ref={(ref: any) => (this.myList = ref)}
sections={sections}
renderSectionHeader={({ section }) => (
<View>
@ -407,10 +405,7 @@ export class CapsLockComponent extends React.Component<TextProps> {
}
}
class ScrollerListComponentTest extends React.Component<
{},
{ dataSource: ListViewDataSource }
> {
class ScrollerListComponentTest extends React.Component<{}, { dataSource: ListViewDataSource }> {
eventHandler = (event: NativeSyntheticEvent<NativeScrollEvent>) => {
console.log(event);
};
@ -439,10 +434,7 @@ class ScrollerListComponentTest extends React.Component<
invertStickyHeaders={true}
contentOffset={{ x: 0, y: 0 }}
{...props}
style={[
scrollViewStyle1.scrollView,
scrollViewStyle2
]}
style={[scrollViewStyle1.scrollView, scrollViewStyle2]}
/>
);
}}
@ -525,7 +517,7 @@ class InputAccessoryViewTest extends React.Component {
<InputAccessoryView nativeID={uniqueID}>
<TextInput inputAccessoryViewID={uniqueID} />
</InputAccessoryView>
)
);
}
}
@ -544,64 +536,63 @@ const deviceEventEmitterStatic: DeviceEventEmitterStatic = null;
deviceEventEmitterStatic.addListener("keyboardWillShow", data => true);
deviceEventEmitterStatic.addListener("keyboardWillShow", data => true, {});
class TextInputTest extends React.Component<{}, {username: string}> {
class TextInputTest extends React.Component<{}, { username: string }> {
username: TextInput | null = null;
handleUsernameChange = (text: string) => {
console.log(`text: ${ text }`);
}
console.log(`text: ${text}`);
};
onScroll = (e: NativeSyntheticEvent<TextInputScrollEventData>) => {
testNativeSyntheticEvent(e);
console.log(`x: ${ e.nativeEvent.contentOffset.x }`);
console.log(`y: ${ e.nativeEvent.contentOffset.y }`);
}
console.log(`x: ${e.nativeEvent.contentOffset.x}`);
console.log(`y: ${e.nativeEvent.contentOffset.y}`);
};
handleOnBlur = (e: NativeSyntheticEvent<TextInputFocusEventData>) => {
testNativeSyntheticEvent(e);
}
};
handleOnFocus = (e: NativeSyntheticEvent<TextInputFocusEventData>) => {
testNativeSyntheticEvent(e);
}
};
handleOnSelectionChange = (e: NativeSyntheticEvent<TextInputSelectionChangeEventData>) => {
testNativeSyntheticEvent(e);
console.log(`target: ${ e.nativeEvent.target }`);
console.log(`start: ${ e.nativeEvent.selection.start }`);
console.log(`end: ${ e.nativeEvent.selection.end }`);
}
console.log(`target: ${e.nativeEvent.target}`);
console.log(`start: ${e.nativeEvent.selection.start}`);
console.log(`end: ${e.nativeEvent.selection.end}`);
};
handleOnKeyPress = (e: NativeSyntheticEvent<TextInputKeyPressEventData>) => {
testNativeSyntheticEvent(e);
console.log(`key: ${ e.nativeEvent.key }`);
}
console.log(`key: ${e.nativeEvent.key}`);
};
handleOnChange = (e: NativeSyntheticEvent<TextInputChangeEventData>) => {
testNativeSyntheticEvent(e);
console.log(`eventCount: ${ e.nativeEvent.eventCount }`);
console.log(`target: ${ e.nativeEvent.target }`);
console.log(`text: ${ e.nativeEvent.text }`);
}
console.log(`eventCount: ${e.nativeEvent.eventCount}`);
console.log(`target: ${e.nativeEvent.target}`);
console.log(`text: ${e.nativeEvent.text}`);
};
handleOnContentSizeChange = (e: NativeSyntheticEvent<TextInputContentSizeChangeEventData>) => {
testNativeSyntheticEvent(e);
console.log(`contentSize.width: ${ e.nativeEvent.contentSize.width }`);
console.log(`contentSize.height: ${ e.nativeEvent.contentSize.height }`);
}
console.log(`contentSize.width: ${e.nativeEvent.contentSize.width}`);
console.log(`contentSize.height: ${e.nativeEvent.contentSize.height}`);
};
handleOnEndEditing = (e: NativeSyntheticEvent<TextInputEndEditingEventData>) => {
testNativeSyntheticEvent(e);
console.log(`text: ${ e.nativeEvent.text }`);
}
console.log(`text: ${e.nativeEvent.text}`);
};
handleOnSubmitEditing = (e: NativeSyntheticEvent<TextInputSubmitEditingEventData>) => {
testNativeSyntheticEvent(e);
console.log(`text: ${ e.nativeEvent.text }`);
}
console.log(`text: ${e.nativeEvent.text}`);
};
render() {
return (
@ -609,54 +600,31 @@ class TextInputTest extends React.Component<{}, {username: string}> {
<Text onPress={() => this.username.focus()}>Username</Text>
<TextInput
ref={input => this.username = input}
ref={input => (this.username = input)}
textContentType="username"
value={this.state.username}
onChangeText={this.handleUsernameChange}
/>
<TextInput
multiline
onScroll={this.onScroll}
/>
<TextInput multiline onScroll={this.onScroll} />
<TextInput
onBlur={this.handleOnBlur}
onFocus={this.handleOnFocus}
/>
<TextInput onBlur={this.handleOnBlur} onFocus={this.handleOnFocus} />
<TextInput
onSelectionChange={this.handleOnSelectionChange}
/>
<TextInput onSelectionChange={this.handleOnSelectionChange} />
<TextInput
onKeyPress={this.handleOnKeyPress}
/>
<TextInput onKeyPress={this.handleOnKeyPress} />
<TextInput
onChange={this.handleOnChange}
/>
<TextInput onChange={this.handleOnChange} />
<TextInput
onChange={this.handleOnChange}
/>
<TextInput onChange={this.handleOnChange} />
<TextInput
onEndEditing={this.handleOnEndEditing}
/>
<TextInput onEndEditing={this.handleOnEndEditing} />
<TextInput
onSubmitEditing={this.handleOnSubmitEditing}
/>
<TextInput onSubmitEditing={this.handleOnSubmitEditing} />
<TextInput
multiline
onContentSizeChange={this.handleOnContentSizeChange}
/>
<TextInput multiline onContentSizeChange={this.handleOnContentSizeChange} />
<TextInput
contextMenuHidden={true}
/>
<TextInput contextMenuHidden={true} />
</View>
);
}
@ -666,15 +634,9 @@ class StatusBarTest extends React.Component {
render() {
StatusBar.setBarStyle("dark-content", true);
console.log('height:', StatusBar.currentHeight);
console.log("height:", StatusBar.currentHeight);
return (
<StatusBar
backgroundColor="blue"
barStyle="light-content"
translucent
/>
);
return <StatusBar backgroundColor="blue" barStyle="light-content" translucent />;
}
}
@ -682,9 +644,9 @@ class WebViewTest extends React.Component {
render() {
return (
<WebView
nativeConfig={{ component: 'test', props: {}, viewManager: {} }}
onShouldStartLoadWithRequest={(event) => event.navigationType !== 'formresubmit'}
originWhitelist={['https://origin.test']}
nativeConfig={{ component: "test", props: {}, viewManager: {} }}
onShouldStartLoadWithRequest={event => event.navigationType !== "formresubmit"}
originWhitelist={["https://origin.test"]}
saveFormDataDisabled={false}
useWebKit={true}
allowFileAccess={true}
@ -696,36 +658,36 @@ class WebViewTest extends React.Component {
export class ImageTest extends React.Component {
componentDidMount(): void {
const image: ImageResolvedAssetSource = Image.resolveAssetSource({
uri: 'https://seeklogo.com/images/T/typescript-logo-B29A3F462D-seeklogo.com.png'
uri: "https://seeklogo.com/images/T/typescript-logo-B29A3F462D-seeklogo.com.png",
});
console.log(image.width, image.height, image.scale, image.uri);
}
handleOnLoad = (e: NativeSyntheticEvent<ImageLoadEventData>) => {
testNativeSyntheticEvent(e);
console.log('height:', e.nativeEvent.source.height);
console.log('width:', e.nativeEvent.source.width);
console.log('url:', e.nativeEvent.source.url);
}
console.log("height:", e.nativeEvent.source.height);
console.log("width:", e.nativeEvent.source.width);
console.log("url:", e.nativeEvent.source.url);
};
handleOnError = (e: NativeSyntheticEvent<ImageErrorEventData>) => {
testNativeSyntheticEvent(e);
console.log('error:', e.nativeEvent.error);
}
console.log("error:", e.nativeEvent.error);
};
render() {
const resizeMode: ImageResizeMode = 'contain';
const resizeMode: ImageResizeMode = "contain";
return (
<View>
<Image
source={{ uri: 'https://seeklogo.com/images/T/typescript-logo-B29A3F462D-seeklogo.com.png' }}
source={{ uri: "https://seeklogo.com/images/T/typescript-logo-B29A3F462D-seeklogo.com.png" }}
onLoad={this.handleOnLoad}
onError={this.handleOnError}
/>
<Image
source={{ uri: 'https://seeklogo.com/images/T/typescript-logo-B29A3F462D-seeklogo.com.png' }}
source={{ uri: "https://seeklogo.com/images/T/typescript-logo-B29A3F462D-seeklogo.com.png" }}
resizeMode={resizeMode}
/>
</View>
@ -738,13 +700,13 @@ export class ImageBackgroundProps extends React.Component {
setImageRef = (image: Image) => {
this._imageRef = image;
}
};
render() {
return (
<View>
<ImageBackground
source={{ uri: 'https://seeklogo.com/images/T/typescript-logo-B29A3F462D-seeklogo.com.png' }}
source={{ uri: "https://seeklogo.com/images/T/typescript-logo-B29A3F462D-seeklogo.com.png" }}
imageRef={this.setImageRef}
/>
</View>
@ -752,7 +714,7 @@ export class ImageBackgroundProps extends React.Component {
}
}
const listViewDataSourceTest = new ListView.DataSource({rowHasChanged: () => true})
const listViewDataSourceTest = new ListView.DataSource({ rowHasChanged: () => true });
class AccessibilityTest extends React.Component {
render() {
@ -760,16 +722,13 @@ class AccessibilityTest extends React.Component {
<View
accessibilityElementsHidden={true}
importantForAccessibility={"no-hide-descendants"}
accessibilityTraits={'none'}
accessibilityTraits={"none"}
onAccessibilityTap={() => {}}
accessibilityRole="header"
accessibilityStates={["selected"]}
accessibilityHint="Very importent header"
>
<Text
accessibilityTraits={['key', 'text']}
accessibilityIgnoresInvertColors
>
<Text accessibilityTraits={["key", "text"]} accessibilityIgnoresInvertColors>
Text
</Text>
<View />
@ -778,51 +737,44 @@ class AccessibilityTest extends React.Component {
}
}
const KeyboardAvoidingViewTest = () => (
<KeyboardAvoidingView enabled />
);
const KeyboardAvoidingViewTest = () => <KeyboardAvoidingView enabled />;
const AlertIOSTest = () => {
AlertIOS.prompt(
'My Prompt',
'Enter your email',
"My Prompt",
"Enter your email",
[
{
text: 'Cancel',
style: 'cancel'
text: "Cancel",
style: "cancel",
},
{
text: 'Add',
text: "Add",
onPress: (value: string) => {
console.log(value);
console.log(value);
},
},
},
],
'default',
'email-address'
"default",
"email-address"
);
}
};
const ModalTest = () => (
<Modal hardwareAccelerated />
)
const ModalTest = () => <Modal hardwareAccelerated />;
const TimePickerAndroidTest = () => (
const TimePickerAndroidTest = () =>
TimePickerAndroid.open({
hour: 8,
minute: 15,
is24Hour: true,
mode: 'spinner'
})
)
mode: "spinner",
});
class BridgedComponentTest extends React.Component {
static propTypes = {
jsProp: PropTypes.string.isRequired,
...ViewPropTypes,
}
};
render() {
return <NativeBridgedComponent {...this.props} nativeProp="test" />;
@ -831,19 +783,13 @@ class BridgedComponentTest extends React.Component {
const NativeBridgedComponent = requireNativeComponent("NativeBridgedComponent");
const SwitchColorTest = () => (
<Switch trackColor={{ true: 'pink', false: 'red'}} />
)
const SwitchColorTest = () => <Switch trackColor={{ true: "pink", false: "red" }} />;
const SwitchThumbColorTest = () => (
<Switch thumbColor={'red'} />
)
const SwitchThumbColorTest = () => <Switch thumbColor={"red"} />;
const NativeIDTest = () => (
<ScrollView nativeID={'nativeID'}>
<View nativeID={'nativeID'} />
<Text nativeID={'nativeID'} >
Text
</Text>
<ScrollView nativeID={"nativeID"}>
<View nativeID={"nativeID"} />
<Text nativeID={"nativeID"}>Text</Text>
</ScrollView>
)
);

View File

@ -1,5 +1,4 @@
import * as React from "react";
import { TextInputProperties } from "react-native";
class Test extends React.Component<TextInputProperties> {
}
class Test extends React.Component<TextInputProperties> {}