react-*: Fix lint (#20825)

This commit is contained in:
Andy 2017-10-23 07:31:51 -07:00 committed by GitHub
parent 2552256a2f
commit 72bc73d061
18 changed files with 217 additions and 516 deletions

View File

@ -17,64 +17,23 @@ import { EventEmitter } from 'events';
* Consult [documentation](https://allenfang.github.io/react-bootstrap-table/docs.html#remote)
* for more info
*
* @interface RemoteObjSpec
*/
export interface RemoteObjSpec {
/**
* If set, cell edits will be handled remotely
*
* @type {boolean}
* @memberof RemoteObjSpec
*/
/** If set, cell edits will be handled remotely */
cellEdit?: boolean;
/**
* If set insertions will be handled remotely
*
* @type {boolean}
* @memberof RemoteObjSpec
*/
/** If set insertions will be handled remotely */
insertRow?: boolean;
/**
* If set deletion will be handled remotely
*
* @type {boolean}
* @memberof RemoteObjSpec
*/
/** If set deletion will be handled remotely */
dropRow?: boolean;
/**
* If set filters will be handled remotely
*
* @type {boolean}
* @memberof RemoteObjSpec
*/
/** If set filters will be handled remotely */
filter?: boolean;
/**
* If set search will be handled remotely
*
* @type {boolean}
* @memberof RemoteObjSpec
*/
/** If set search will be handled remotely */
search?: boolean;
/**
* If set, exporting CSV will be handled remotely
*
* @type {boolean}
* @memberof RemoteObjSpec
*/
/** If set, exporting CSV will be handled remotely */
exportCSV?: boolean;
/**
* If set sorting will be handled remotely
*
* @type {boolean}
* @memberof RemoteObjSpec
*/
/** If set sorting will be handled remotely */
sort?: boolean;
/**
* If set pagination will be handled remotely
*
* @type {boolean}
* @memberof RemoteObjSpec
*/
/** If set pagination will be handled remotely */
pagination?: boolean;
}
@ -474,7 +433,6 @@ export interface Options {
*
* https://allenfang.github.io/react-bootstrap-table/example.html#remote
*
* @memberof BootstrapTableProps
*/
onCellEdit?: (row: any, field: string, value: any) => any;
/**
@ -482,7 +440,6 @@ export interface Options {
*
* https://github.com/AllenFang/react-bootstrap-table/blob/master/examples/js/remote/remote-store-filtering.js#L67
*
* @memberof BootstrapTableProps
*/
onFilterChange?: (filterObj: any) => any;
/**
@ -490,7 +447,6 @@ export interface Options {
*
* https://github.com/AllenFang/react-bootstrap-table/blob/master/examples/js/remote/remote-store-delete-row.js#L27
*
* @memberof BootstrapTableProps
*/
onDeleteRow?: (rows: any) => any;
/**
@ -498,7 +454,6 @@ export interface Options {
*
* https://github.com/AllenFang/react-bootstrap-table/blob/master/examples/js/remote/remote-store-paging.js#L30
*
* @memberof BootstrapTableProps
*/
onpageChange?: (page: any, sizePerPage: number) => any;
}

View File

@ -7,7 +7,6 @@ export interface ClassNameProps {
/**
* Property types for general properties.
*
* @returns {Object}
*/
export declare const GeneralPropTypes: {
showFor: PropTypes.Requireable<any>;
@ -40,8 +39,6 @@ export interface GeneralPropTypes extends ClassNameProps {
/**
* Creates class names from the given arguments.
*
* @param {*} args
* @returns {string}
*/
export declare function createClassName(...args: any[]): string;
/**
@ -78,46 +75,32 @@ export declare function objectKeys(object: object): string[];
* Returns the values for the given object.
* This method is used for getting the values for enumerables.
*
* @param {Object} object
* @returns {Array}
*/
export declare function objectValues(object: object): any[];
/**
* Removes properties from the given object.
* This method is used for removing valid attributes from component props prior to rendering.
*
* @param {Object} object
* @param {Array} remove
* @returns {Object}
*/
export declare function removeProps(object: object, remove: string[]): object;
/**
* Returns whether or not the given value is defined.
*
* @param {*} value
* @returns {boolean}
*/
export declare function isDefined(value: any): boolean;
/**
* Adds a breakpoint to a class if breakpoint is specified.
*
* @param {String} prop
* @param {String} size
* @returns {string}
*/
export declare function addBreakpoint(prop: string, size: string): string;
/**
* Sets direction for grid and gutters (horizontal or vertical).
*
* @param {boolean} isVertical
* @param {String} gutters
* @returns {string}
*/
export declare function setDirection(isVertical?: boolean, gutters?: string | null): string;
/**
* Property types for flexbox utilities.
*
* @returns {Object}
*/
export declare const FlexboxPropTypes: {
alignX: PropTypes.Requireable<any>;
@ -156,8 +139,6 @@ export interface FlexboxPropTypes extends GeneralPropTypes {
/**
* Parses the flexbox class names from the given properties.
*
* @param {Object} props
* @returns {Object}
*/
export declare function flexboxClassNames(props: FlexboxPropTypes): {
[name: string]: boolean | undefined;

File diff suppressed because one or more lines are too long

View File

@ -851,8 +851,6 @@ export interface GridProps extends ViewProperties {
/**
* Opacity on pressing
*
* @type {number}
* @memberof GridProps
*/
activeOpacity?: number;

View File

@ -66,34 +66,33 @@ export interface FetchBlobResponse {
taskId: string;
/**
* get path of response temp file
* @return {string} File path of temp file.
* @return File path of temp file.
*/
path(): string;
type: "base64" | "path" | "utf8";
data: any;
/**
* Convert result to javascript RNFetchBlob object.
* @return {Promise<Blob>} Return a promise resolves Blob object.
* @return Return a promise resolves Blob object.
*/
blob(contentType: string, sliceSize: number): Promise<PolyfillBlob>;
/**
* Convert result to text.
* @return {string} Decoded base64 string.
* @return Decoded base64 string.
*/
text(): string | Promise<any>;
/**
* Convert result to JSON object.
* @return {object} Parsed javascript object.
* @return Parsed javascript object.
*/
json(): any;
/**
* Return BASE64 string directly.
* @return {string} BASE64 string of response body.
* @return BASE64 string of response body.
*/
base64(): any;
/**
* Remove cahced file
* @return {Promise}
*/
flush(): void;
respInfo: RNFetchBlobResponseInfo;
@ -101,12 +100,12 @@ export interface FetchBlobResponse {
/**
* Read file content with given encoding, if the response does not contains
* a file path, show warning message
* @param {String} encode Encode type, should be one of `base64`, `ascrii`, `utf8`.
* @param encode Encode type, should be one of `base64`, `ascrii`, `utf8`.
*/
readFile(encode: Encoding): Promise<any> | null;
/**
* Start read stream from cached file
* @param {String} encode Encode type, should be one of `base64`, `ascrii`, `utf8`.
* @param encode Encode type, should be one of `base64`, `ascrii`, `utf8`.
*/
readStream(encode: Encoding): RNFetchBlobStream | null;
}
@ -154,15 +153,15 @@ export declare class PolyfillBlob extends EventTarget {
*
* @param data Content of Blob object
* @param cType Content type settings of Blob object, `text/plain` by default
* @param {boolean} defer When this argument set to `true`, blob constructor will not invoke blob created event automatically.
* @param defer When this argument set to `true`, blob constructor will not invoke blob created event automatically.
*/
constructor(data: any, cType: any, defer: boolean);
/**
* Since Blob content will asynchronously write to a file during creation,
* use this method to register an event handler for Blob initialized event.
* @param {(b:Blob) => void} fn An event handler invoked when Blob created
* @return {Blob} The Blob object instance itself
* @param fn An event handler invoked when Blob created
* @return The Blob object instance itself
*/
onCreated(fn: () => void): PolyfillBlob;
@ -170,30 +169,27 @@ export declare class PolyfillBlob extends EventTarget {
/**
* Get file reference of the Blob object.
* @return {string} Blob file reference which can be consumed by RNFetchBlob fs
* @return Blob file reference which can be consumed by RNFetchBlob fs
*/
getRNFetchBlobRef(): string;
/**
* Create a Blob object which is sliced from current object
* @param {number} start Start byte number
* @param {number} end End byte number
* @param {string} contentType Optional, content type of new Blob object
* @return {Blob}
* @param start Start byte number
* @param end End byte number
* @param contentType Optional, content type of new Blob object
*/
slice(start?: number, end?: number, contentType?: string): PolyfillBlob;
/**
* Read data of the Blob object, this is not standard method.
* @param {string} encoding Read data with encoding
* @return {Promise}
* @param encoding Read data with encoding
*/
readBlob(encoding: string): Promise<any>;
/**
* Release the resource of the Blob object.
* @nonstandard
* @return {Promise}
*/
close(): Promise<void>;
}
@ -220,9 +216,9 @@ export interface PolyfillXMLHttpRequest extends PolyfillXMLHttpRequestEventTarge
/**
* XMLHttpRequest.open, always async, user and password not supported. When
* this method invoked, headers should becomes empty again.
* @param {string} method Request method
* @param {string} url Request URL
* @param {boolean} async Always async
* @param method Request method
* @param url Request URL
* @param async Always async
* @param user NOT SUPPORTED
* @param password NOT SUPPORTED
*/
@ -284,16 +280,15 @@ export interface PolyfillXMLHttpRequestEventTarget extends EventTarget {
export interface Net {
/**
* Get cookie according to the given url.
* @param {string} domain Domain of the cookies to be removed, remove all
* @return {Promise<Array<String>>} Cookies of a specific domain.
* @param domain Domain of the cookies to be removed, remove all
* @return Cookies of a specific domain.
*/
getCookies(domain: string): Promise<string[]>;
/**
* Remove cookies for a specific domain
* @param {?string} domain Domain of the cookies to be removed, remove all
* @param domain Domain of the cookies to be removed, remove all
* cookies when this is null.
* @return {Promise<null>}
*/
removeCookies(domain?: string): Promise<null>;
}
@ -303,22 +298,19 @@ export interface FS {
/**
* Remove file at path.
* @param {string} path:string Path of target file.
* @return {Promise}
* @param path:string Path of target file.
*/
unlink(path: string): Promise<void>;
/**
* Create a directory.
* @param {string} path Path of directory to be created
* @return {Promise}
* @param path Path of directory to be created
*/
mkdir(path: string): Promise<void>;
/**
* Get a file cache session
* @param {string} name Stream ID
* @return {RNFetchBlobSession}
* @param name Stream ID
*/
session(name: string): RNFetchBlobSession;
@ -326,10 +318,10 @@ export interface FS {
/**
* Create file stream from file at `path`.
* @param {string} path The file path.
* @param {string} encoding Data encoding, should be one of `base64`, `utf8`, `ascii`
* @param {boolean} bufferSize Size of stream buffer.
* @return {RNFetchBlobStream} RNFetchBlobStream stream instance.
* @param path The file path.
* @param encoding Data encoding, should be one of `base64`, `utf8`, `ascii`
* @param bufferSize Size of stream buffer.
* @return RNFetchBlobStream stream instance.
*/
readStream(path: string, encoding: Encoding, bufferSize?: number, tick?: number): Promise<RNFetchBlobReadStream>;
@ -339,19 +331,18 @@ export interface FS {
/**
* Create write stream to a file.
* @param {string} path Target path of file stream.
* @param {string} encoding Encoding of input data.
* @param {boolean} append A flag represent if data append to existing ones.
* @return {Promise<{}>} A promise resolves a `WriteStream` object.
* @param path Target path of file stream.
* @param encoding Encoding of input data.
* @param append A flag represent if data append to existing ones.
* @return A promise resolves a `WriteStream` object.
*/
writeStream(path: string, encoding: Encoding, append?: boolean): Promise<RNFetchBlobWriteStream>;
/**
* Write data to file.
* @param {string} path Path of the file.
* @param {string | number[]} data Data to write to the file.
* @param {string} encoding Encoding of data (Optional).
* @return {Promise}
* @param path Path of the file.
* @param data Data to write to the file.
* @param encoding Encoding of data (Optional).
*/
writeFile(path: string, data: string | number[], encoding?: Encoding): Promise<void>;
@ -359,15 +350,13 @@ export interface FS {
/**
* Wrapper method of readStream.
* @param {string} path Path of the file.
* @param {'base64' | 'utf8' | 'ascii'} encoding Encoding of read stream.
* @return {Promise<Array<number> | string>}
* @param path Path of the file.
* @param encoding Encoding of read stream.
*/
readFile(path: string, encoding: Encoding, bufferSize?: number): Promise<any>;
/**
* Check if file exists and if it is a folder.
* @param {string} path Path to check
* @return {Promise<boolean>}
* @param path Path to check
*/
exists(path: string): Promise<boolean>;
@ -377,8 +366,7 @@ export interface FS {
/**
* Show statistic data of a path.
* @param {string} path Target path
* @return {RNFetchBlobStat}
* @param path Target path
*/
stat(path: string): Promise<RNFetchBlobStat>;
@ -386,8 +374,7 @@ export interface FS {
/**
* Android only method, request media scanner to scan the file.
* @param {Array<Object<string, string>>} pairs Array contains Key value pairs with key `path` and `mime`.
* @return {Promise}
* @param pairs Array contains Key value pairs with key `path` and `mime`.
*/
scanFile(pairs: Array<{ [key: string]: string }>): Promise<void>;

View File

@ -39,8 +39,7 @@ export interface EventPurchaseTransaction {
export class GoogleAnalyticsTracker {
/**
* Save all tracker related data that is needed to call native methods with proper data.
* @param trackerId {String}
* @param customDimensionsFieldsIndexMap {{fieldName: fieldIndex}} Custom dimensions field/index pairs
* @param customDimensionsFieldsIndexMap Custom dimensions field/index pairs
*/
constructor(trackerId: string, customDimensionsFieldsIndexMap?: { [s: string]: number })
@ -51,39 +50,37 @@ export class GoogleAnalyticsTracker {
* Underlay native methods will transform provided customDimensions map to expected format.
* Google analytics expect dimensions to be tracker with 'dimension{index}' keys,
* not dimension field names.
* @param customDimensions {Object}
* @returns {Object}
*/
transformCustomDimensionsFieldsToIndexes(customDimensions: {}): void;
/**
* Track the current screen/view Important: Calling this will also set the "current view" for
* other calls. So events tracked will be tagged as having occured on the current view.
* @param {String} screenName The name of the current screen
* @param screenName The name of the current screen
*/
trackScreenView(screenName: string): void;
/**
* Track an event that has occured
* @param {String} category The event category
* @param {String} action The event action
* @param {EventOptionalValues} optionalValues An object containing optional label and value
* @param category The event category
* @param action The event action
* @param optionalValues An object containing optional label and value
*/
trackEvent(category: string, action: string, optionalValues?: EventOptionalValues): void;
/**
* Track the current screen/view with custom dimension values
* @param {String} screenName The name of the current screen
* @param {Object} customDimensionValues An object containing custom dimension key/value pairs
* @param screenName The name of the current screen
* @param customDimensionValues An object containing custom dimension key/value pairs
*/
trackScreenViewWithCustomDimensionValues(screenName: string, customDimensionValues: {}): void;
/**
* Track an event that has occured with custom dimension values
* @param {String} category The event category
* @param {String} action The event action
* @param {EventOptionalValues} optionalValues An object containing optional label and value
* @param {Object} customDimensionValues An object containing custom dimension key/value pairs
* @param category The event category
* @param action The event action
* @param optionalValues An object containing optional label and value
* @param customDimensionValues An object containing custom dimension key/value pairs
*/
trackEventWithCustomDimensionValues(
category: string,
@ -94,18 +91,18 @@ export class GoogleAnalyticsTracker {
/**
* Track an event that has occured
* @param {String} category The event category
* @param {Number} value The timing measurement in milliseconds
* @param {TimeTrackingOptionalValues} optionalValues An object containing optional name and label
* @param category The event category
* @param value The timing measurement in milliseconds
* @param optionalValues An object containing optional name and label
*/
trackTiming(category: string, value: number, optionalValues?: TimeTrackingOptionalValues): void;
/**
* Track a purchase event. This uses the Enhanced Ecommerce GA feature.
* @param {EventPurchaseProduct} product An object with product values
* @param {EventPurchaseTransaction} transaction An object with transaction values
* @param {String} eventCategory The event category, defaults to Ecommerce
* @param {String} eventAction The event action, defaults to Purchase
* @param product An object with product values
* @param transaction An object with transaction values
* @param eventCategory The event category, defaults to Ecommerce
* @param eventAction The event action, defaults to Purchase
*/
trackPurchaseEvent(
product: EventPurchaseProduct,
@ -116,10 +113,10 @@ export class GoogleAnalyticsTracker {
/**
* Track a purchase event. This uses the Enhanced Ecommerce GA feature.
* @param {EventPurchaseProduct[]} products An array with products
* @param {EventPurchaseTransaction} transaction An object with transaction values
* @param {String} eventCategory The event category, defaults to Ecommerce
* @param {String} eventAction The event action, defaults to Purchase
* @param products An array with products
* @param transaction An object with transaction values
* @param eventCategory The event category, defaults to Ecommerce
* @param eventAction The event action, defaults to Purchase
*/
trackMultiProductsPurchaseEvent(
products: EventPurchaseProduct[],
@ -130,11 +127,11 @@ export class GoogleAnalyticsTracker {
/**
* Track a purchase event with custom dimensions. This uses the Enhanced Ecommerce GA feature.
* @param {EventPurchaseProduct[]} products An array with products
* @param {EventPurchaseTransaction} transaction An object with transaction values
* @param {String} eventCategory The event category, defaults to Ecommerce
* @param {String} eventAction The event action, defaults to Purchase
* @param {Object} customDimensionValues An object containing custom dimension key/value pairs
* @param products An array with products
* @param transaction An object with transaction values
* @param eventCategory The event category, defaults to Ecommerce
* @param eventAction The event action, defaults to Purchase
* @param customDimensionValues An object containing custom dimension key/value pairs
*/
trackMultiProductsPurchaseEventWithCustomDimensionValues(
products: EventPurchaseProduct[],
@ -146,15 +143,15 @@ export class GoogleAnalyticsTracker {
/**
* Track an exception
* @param {String} error The description of the error
* @param {Boolean} fatal A value indiciating if the error was fatal, defaults to false
* @param error The description of the error
* @param fatal A value indiciating if the error was fatal, defaults to false
*/
trackException(error: string, fatal?: boolean): void;
/**
* Sets the Google Analytics User-ID for the current user for tracking.
* The userId should be an anonymous identifier that complies with Google Analytic's User-ID policy.
* @param {String} userId The current userId,
* @param userId The current userId,
*/
setUser(userId: string): void;
@ -166,54 +163,48 @@ export class GoogleAnalyticsTracker {
* Important: For iOS you can only use this method if you have done the optional step 6 from the installation
* guide. Only enable this (and link the appropriate libraries) if you plan to use advertising features
* in your app, or else your app may get rejected from the AppStore.
* @param {Boolean} enabled Defaults to true
* @param enabled Defaults to true
*/
allowIDFA(enabled?: boolean): void;
/**
* Track a social interaction, Facebook, Twitter, etc.
* @param {String} network
* @param {String} action
* @param {String} targetUrl
*/
trackSocialInteraction(network: string, action: string, targetUrl: string): void;
/**
* Sets if uncaught exceptions should be tracked
* @param {Boolean} enabled
*/
setTrackUncaughtExceptions(enabled: boolean): void;
/**
* Sets the trackers appName
* The Bundle name is used by default
* @param {String} appName
*/
setAppName(appName: string): void;
/**
* Sets the trackers appVersion
* @param {String} appVersion
*/
setAppVersion(appVersion: string): void;
/**
* Sets if AnonymizeIp is enabled
* If enabled the last octet of the IP address will be removed
* @param {Boolean} enabled disabled by default
* @param enabled disabled by default
*/
setAnonymizeIp(enabled: string): void;
/**
* Sets the tracker currency property. See accepted currency codes here
* https://developers.google.com/analytics/devguides/platform/features/currencies
* @param {string} currencyCode ISO 4217 currency code
* @param currencyCode ISO 4217 currency code
*/
setCurrency(currencyCode: string): void;
/**
* Sets tracker sampling rate.
* @param {Float} sampleRatio Percentage 0 - 100
* @param sampleRatio Percentage 0 - 100
*/
setSamplingRate(sampleRatio: number): void;
}
@ -223,49 +214,44 @@ export interface GAEvent<T> {
payload: T;
}
export class GoogleTagManager {
export namespace GoogleTagManager {
/**
* Call once to open the container for all subsequent static calls.
* @param {String} containerId
*/
static openContainerWithId(containerId: string): Promise<void>;
function openContainerWithId(containerId: string): Promise<void>;
/**
* Retrieves a boolean value with the given key from the opened container.
* @param {String} key
*/
static boolForKey(key: string): Promise<boolean>;
function boolForKey(key: string): Promise<boolean>;
/**
* Retrieves a string with the given key from the opened container.
* @param {String} key
*/
static stringForKey(key: string): Promise<string>;
function stringForKey(key: string): Promise<string>;
/**
* Retrieves a number with the given key from the opened container.
* @param {String} key
*/
static doubleForKey(key: string): Promise<number>;
function doubleForKey(key: string): Promise<number>;
/**
* push a datalayer event for Google Analytics through Google Tag Manager.
* @param {Object} dictionary An Map<String, Object> containing key and value pairs.
* @param dictionary An Map<String, Object> containing key and value pairs.
* it must have at least one key "event" with event name
* example: {event: "eventName", pageId: "/home"}
*/
static pushDataLayerEvent<E>(dictionary: GAEvent<E>): Promise<boolean>;
function pushDataLayerEvent<E>(dictionary: GAEvent<E>): Promise<boolean>;
}
export class GoogleAnalyticsSettings {
export namespace GoogleAnalyticsSettings {
/**
* Sets if OptOut is active and disables Google Analytics
* This has to be set each time the App starts
*
* Disabled by default.
* @param {Boolean} enabled
*/
static setOptOut(enabled: boolean): void;
function setOptOut(enabled: boolean): void;
/**
* Sets the trackers dispatch interval
@ -278,16 +264,14 @@ export class GoogleAnalyticsSettings {
*
* This is set to 20 seconds by default.
*
* @param {Number} intervalInSeconds
*/
static setDispatchInterval(intervalInSeconds: number): void;
function setDispatchInterval(intervalInSeconds: number): void;
/**
* When enabled the native library prevents any data from being sent to Google Analytics.
* This allows you to test or debug the implementation, without your test data appearing in
* your Google Analytics reports.
*
* @param {Boolean} enabled
*/
static setDryRun(enabled: boolean): void;
function setDryRun(enabled: boolean): void;
}

View File

@ -11,8 +11,6 @@ export interface ReactNativeModalProps {
* Modal show animation
*
* @default 'slideInUp'
* @type {(SlidingEntrances | string)}
* @memberof ReactNativeModalProps
*/
animationIn?: SlidingEntrances | string;
@ -20,8 +18,6 @@ export interface ReactNativeModalProps {
* Timing for the modal show animation (in ms)
*
* @default 300
* @type {number}
* @memberof ReactNativeModalProps
*/
animationInTiming?: number;
@ -29,8 +25,6 @@ export interface ReactNativeModalProps {
* Modal hide animation
*
* @default 'slideOutDown'
* @type {(SlidingExits | string)}
* @memberof ReactNativeModalProps
*/
animationOut?: SlidingExits | string;
@ -38,8 +32,6 @@ export interface ReactNativeModalProps {
* Timing for the modal hide animation (in ms)
*
* @default 300
* @type {number}
* @memberof ReactNativeModalProps
*/
animationOutTiming?: number;
@ -47,8 +39,6 @@ export interface ReactNativeModalProps {
* Move the modal up if the keyboard is open
*
* @default false
* @type {boolean}
* @memberof ReactNativeModalProps
*/
avoidKeyboard?: boolean;
@ -56,8 +46,6 @@ export interface ReactNativeModalProps {
* The backdrop background color
*
* @default 'black'
* @type {string}
* @memberof ReactNativeModalProps
*/
backdropColor?: string;
@ -65,8 +53,6 @@ export interface ReactNativeModalProps {
* The backdrop opacity when the modal is visible
*
* @default 0.70
* @type {number}
* @memberof ReactNativeModalProps
*/
backdropOpacity?: number;
@ -74,8 +60,6 @@ export interface ReactNativeModalProps {
* The backdrop show timing (in ms)
*
* @default 300
* @type {number}
* @memberof ReactNativeModalProps
*/
backdropTransitionInTiming?: number;
@ -83,16 +67,12 @@ export interface ReactNativeModalProps {
* The backdrop hide timing (in ms)
*
* @default 300
* @type {number}
* @memberof ReactNativeModalProps
*/
backdropTransitionOutTiming?: number;
/**
* The modal content
*
* @type {(ReactNode[] | ReactNode)}
* @memberof ReactNativeModalProps
*/
children: ReactNode[] | ReactNode;
@ -100,8 +80,6 @@ export interface ReactNativeModalProps {
* Show the modal?
*
* @default false
* @type {boolean}
* @memberof ReactNativeModalProps
*/
isVisible: boolean;
@ -109,7 +87,6 @@ export interface ReactNativeModalProps {
* Style applied to the modal
*
* @default null
* @memberof ReactNativeModalProps
*/
style?: ViewStyle[] | ViewStyle;
@ -117,7 +94,6 @@ export interface ReactNativeModalProps {
* Called when the modal is completely visible
*
* @default () => {}
* @memberof ReactNativeModalProps
*/
onModalShow?(): void;
@ -125,7 +101,6 @@ export interface ReactNativeModalProps {
* Called when the modal is completely hidden
*
* @default () => {}
* @memberof ReactNativeModalProps
*/
onModalHide?(): void;
@ -133,7 +108,6 @@ export interface ReactNativeModalProps {
* Called when the Android back button is pressed
*
* @default () => {}
* @memberof ReactNativeModalProps
*/
onBackButtonPress?(): void;
@ -141,7 +115,6 @@ export interface ReactNativeModalProps {
* Called when the backdrop is pressed
*
* @default () => {}
* @memberof ReactNativeModalProps
*/
onBackdropPress?(): void;
}

View File

@ -13,8 +13,6 @@ export interface ModalProps extends ViewProperties {
*
* Default is false
*
* @type {boolean}
* @memberof ModalProps
*/
isOpen?: boolean;
@ -23,8 +21,6 @@ export interface ModalProps extends ViewProperties {
*
* Default is false
*
* @type {boolean}
* @memberof ModalProps
*/
isDisabled?: boolean;
@ -33,8 +29,6 @@ export interface ModalProps extends ViewProperties {
*
* Default is true
*
* @type {boolean}
* @memberof ModalProps
*/
backdropPressToClose?: boolean;
@ -43,8 +37,6 @@ export interface ModalProps extends ViewProperties {
*
* Default is true
*
* @type {boolean}
* @memberof ModalProps
*/
swipeToClose?: boolean;
@ -53,8 +45,6 @@ export interface ModalProps extends ViewProperties {
*
* Default is 50
*
* @type {number}
* @memberof ModalProps
*/
swipeThreshold?: number;
@ -63,8 +53,6 @@ export interface ModalProps extends ViewProperties {
*
* Default is the Window Height
*
* @type {number}
* @memberof ModalProps
*/
swipeArea?: number;
@ -74,8 +62,6 @@ export interface ModalProps extends ViewProperties {
*
* Default is center
*
* @type {string}
* @memberof ModalProps
*/
position?: 'top' | 'center' | 'bottom' | string;
@ -84,8 +70,6 @@ export interface ModalProps extends ViewProperties {
*
* Default is bottom
*
* @type {('top' | 'bottom' | string)}
* @memberof ModalProps
*/
entry?: 'top' | 'bottom' | string;
@ -94,8 +78,6 @@ export interface ModalProps extends ViewProperties {
*
* Default is true
*
* @type {boolean}
* @memberof ModalProps
*/
backdrop?: boolean;
@ -104,8 +86,6 @@ export interface ModalProps extends ViewProperties {
*
* Default is 0.5
*
* @type {number}
* @memberof ModalProps
*/
backdropOpacity?: number;
@ -114,8 +94,6 @@ export interface ModalProps extends ViewProperties {
*
* Default is black
*
* @type {string}
* @memberof ModalProps
*/
backdropColor?: string;
@ -124,8 +102,6 @@ export interface ModalProps extends ViewProperties {
*
* Default is null
*
* @type {JSX.Element}
* @memberof ModalProps
*/
backdropContent?: React.ReactNode;
@ -134,8 +110,6 @@ export interface ModalProps extends ViewProperties {
*
* Default is 400ms
*
* @type {number}
* @memberof ModalProps
*/
animationDuration?: number;
@ -144,16 +118,12 @@ export interface ModalProps extends ViewProperties {
*
* Default is false
*
* @type {boolean}
* @memberof ModalProps
*/
backButtonClose?: boolean;
/**
*
* Default is false
* @type {boolean}
* @memberof ModalProps
*/
coverScreen?: boolean;
@ -162,22 +132,18 @@ export interface ModalProps extends ViewProperties {
*
* Default is false
*
* @type {boolean}
* @memberof ModalProps
*/
startOpen?: boolean;
/**
* Event fired when the modal is closed and the animation is complete
*
* @memberof ModalProps
*/
onClosed?(): void;
/**
* Event fired when the modal is opened and the animation is complete
*
* @memberof ModalProps
*/
onOpened?(): void;
@ -185,9 +151,7 @@ export interface ModalProps extends ViewProperties {
* When the state of the swipe to close feature has changed
* (useful to change the content of the modal, display a message for example)
*
* @param {boolean} state
*
* @memberof ModalProps
*/
onClosingState?(state: boolean): void;
}
@ -196,18 +160,14 @@ export default class Modal extends React.Component<ModalProps> {
/**
* Open the modal
*
* @static
*
* @memberof Modal
*/
open(): void;
/**
* Close the modal
*
* @static
*
* @memberof Modal
*/
close(): void;
}

View File

@ -9,71 +9,57 @@ export interface SafariViewOptions {
/**
* A String containing the url you want to load in the Safari View
*
* @type {string}
* @memberof SafariViewOptions
*/
url: string;
/**
* A Boolean indicating to use Safari's Reader Mode if available
*
* @type {boolean}
* @memberof SafariViewOptions
*/
readerMode?: boolean;
/**
* A String containing a hex or rgba color to use for the browser controls
*
* @type {string}
* @memberof SafariViewOptions
*/
tintColor?: string;
/**
* A String containing a hex or rgba color to use for the background of the browser controls (only available on iOS 10 and higher)
*
* @type {string}
* @memberof SafariViewOptions
*/
barTintColor?: string;
/**
* A Boolean indicating to open the Safari View from the bottom
*
* @type {boolean}
* @memberof SafariViewOptions
*/
fromBottom?: boolean;
}
export default class SafariView {
declare namespace SafariView {
/**
* Displays a Safari View with the provided URL
*
* @param {SafariViewOptions} options
*/
static show(options: SafariViewOptions): Promise<boolean>;
function show(options: SafariViewOptions): Promise<boolean>;
/**
* Dismisses the currently active Safari View
*/
static dismiss(): void;
function dismiss(): void;
/**
* Checks if Safari View is available on the device
*/
static isAvailable(): Promise<boolean>;
function isAvailable(): Promise<boolean>;
/**
* @param {string} event
* @param {function} listener
*/
static addEventListener(event: string, listener: () => void): EmitterSubscription;
function addEventListener(event: string, listener: () => void): EmitterSubscription;
/**
* @param {string} event
* @param {function} listener
*/
static removeEventListener(event: string, listener: () => void): void;
function removeEventListener(event: string, listener: () => void): void;
}
export default SafariView;

View File

@ -14,8 +14,6 @@ export interface IconProps extends TextProperties {
* Size of the icon, can also be passed as fontSize in the style object.
*
* @default 12
* @type {string}
* @memberof IconProps
*/
size?: number;
@ -24,16 +22,12 @@ export interface IconProps extends TextProperties {
*
* See Icon Explorer app
* {@link https://github.com/oblador/react-native-vector-icons/tree/master/Examples/IconExplorer}
* @type {string}
* @memberof IconProps
*/
name: string;
/**
* Color of the icon
*
* @type {string}
* @memberof IconProps
*/
color?: string;
}
@ -44,8 +38,6 @@ export interface IconButtonProps extends IconProps, TouchableHighlightProperties
* Use iconStyle or nest a Text component if you need different colors.
*
* @default 'white'
* @type {string}
* @memberof IconButtonProps
*/
color?: string;
@ -54,8 +46,6 @@ export interface IconButtonProps extends IconProps, TouchableHighlightProperties
* Set to 0 to disable.
*
* @default 5
* @type {number}
* @memberof IconButtonProps
*/
borderRadius?: number;
@ -64,8 +54,6 @@ export interface IconButtonProps extends IconProps, TouchableHighlightProperties
* Good for setting margins or a different color.
*
* @default {marginRight: 10}
* @type {ViewStyle}
* @memberof IconButtonProps
*/
iconStyle?: ViewStyle;
@ -73,8 +61,6 @@ export interface IconButtonProps extends IconProps, TouchableHighlightProperties
* Style prop inherited from TextProperties and TouchableWithoutFeedbackProperties
* Only exist here so we can have ViewStyle or TextStyle
*
* @type {(ViewStyle | TextStyle)}
* @memberof IconButtonProps
*/
style?: ViewStyle | TextStyle;
@ -82,8 +68,6 @@ export interface IconButtonProps extends IconProps, TouchableHighlightProperties
* Background color of the button
*
* @default '#007AFF'
* @type {string}
* @memberof IconButtonProps
*/
backgroundColor?: string;
}
@ -95,8 +79,6 @@ export interface ToolbarAndroidProps extends ToolbarAndroidProperties {
* Name of the navigation logo icon
* (similar to ToolbarAndroid logo)
*
* @type {string}
* @memberof ToolbarAndroidProps
*/
logoName: string;
@ -104,8 +86,6 @@ export interface ToolbarAndroidProps extends ToolbarAndroidProperties {
* Name of the navigation icon
* (similar to ToolbarAndroid navIcon)
*
* @type {string}
* @memberof ToolbarAndroidProps
*/
navIconName: string;
@ -113,8 +93,6 @@ export interface ToolbarAndroidProps extends ToolbarAndroidProperties {
* Name of the overflow icon
* (similar to ToolbarAndroid overflowIcon)
*
* @type {string}
* @memberof ToolbarAndroidProps
*/
overflowIconName: string;
@ -122,8 +100,6 @@ export interface ToolbarAndroidProps extends ToolbarAndroidProperties {
* Size of the icons
*
* @default 24
* @type {number}
* @memberof ToolbarAndroidProps
*/
iconSize: number;
@ -131,8 +107,6 @@ export interface ToolbarAndroidProps extends ToolbarAndroidProperties {
* Color of the icons
*
* @default 'black'
* @type {string}
* @memberof ToolbarAndroidProps
*/
iconColor: string;
}
@ -141,8 +115,6 @@ export interface TabBarItemIOSProps extends TabBarItemProperties {
/**
* Name of the default icon (similar to TabBarIOS.Item icon)
*
* @type {string}
* @memberof TabBarIOSItemProps
*/
iconName: string;
@ -151,8 +123,6 @@ export interface TabBarItemIOSProps extends TabBarItemProperties {
*
* Defaults to iconName
*
* @type {string}
* @memberof TabBarIOSItemProps
*/
selectedIconName?: string;
@ -160,16 +130,12 @@ export interface TabBarItemIOSProps extends TabBarItemProperties {
* Size of the icon
*
* @default 30
* @type {number}
* @memberof TabBarIOSItemProps
*/
iconSize?: number;
/**
* Color of the icon
*
* @type {string}
* @memberof TabBarIOSItemProps
*/
iconColor?: string;
@ -178,8 +144,6 @@ export interface TabBarItemIOSProps extends TabBarItemProperties {
*
* Defaults to iconColor
*
* @type {string}
* @memberof TabBarIOSItemProps
*/
selectedIconColor?: string;
}

View File

@ -16,9 +16,6 @@ import { TextProperties } from 'react-native';
* Optionally pass the third fontFile argument for android support, it should be a path
* to the font file in you asset folder.
*
* @param glyphMap
* @param fontFamily
* @param fontFile
*/
export function createIconSet(
glyphMap: {},
@ -38,8 +35,6 @@ export function createIconSet(
*
* @see http://fontello.com
* @export
* @param {{}} config
* @returns {Icon}
*/
export function createIconSetFromFontello(config: {}): typeof Icon;
@ -56,7 +51,5 @@ export function createIconSetFromFontello(config: {}): typeof Icon;
*
* @see https://icomoon.io/app
* @export
* @param {{}} config
* @returns {Icon}
*/
export function createIconSetFromIcoMoon(config: {}): typeof Icon;

View File

@ -58,7 +58,7 @@ interface EventSubscription {
subscriber: EventSubscriptionVendor;
/**
* @param {EventSubscriptionVendor} subscriber the subscriber that controls
* @param subscriber the subscriber that controls
* this subscription.
*/
new(subscriber: EventSubscriptionVendor): EventSubscription
@ -80,15 +80,13 @@ interface EventSubscriptionVendor {
/**
* Adds a subscription keyed by an event type.
*
* @param {string} eventType
* @param {EventSubscription} subscription
*/
addSubscription(eventType: string, subscription: EventSubscription): EventSubscription
/**
* Removes a bulk set of the subscriptions.
*
* @param {?string} eventType - Optional name of the event type whose
* @param eventType - Optional name of the event type whose
* registered supscriptions to remove, if null remove all subscriptions.
*/
removeAllSubscriptions(eventType?: string): void
@ -97,7 +95,6 @@ interface EventSubscriptionVendor {
* Removes a specific subscription. Instead of calling this function, call
* `subscription.remove()` directly.
*
* @param {object} subscription
*/
removeSubscription(subscription: any): void
@ -108,8 +105,6 @@ interface EventSubscriptionVendor {
* Note: This array can be potentially sparse as subscriptions are deleted
* from it when they are removed.
*
* @param {string} eventType
* @returns {?array}
*/
getSubscriptionsForType(eventType: string): EventSubscription[]
}
@ -123,13 +118,13 @@ interface EmitterSubscription extends EventSubscription {
context: any
/**
* @param {EventEmitter} emitter - The event emitter that registered this
* @param emitter - The event emitter that registered this
* subscription
* @param {EventSubscriptionVendor} subscriber - The subscriber that controls
* @param subscriber - The subscriber that controls
* this subscription
* @param {function} listener - Function to invoke when the specified event is
* @param listener - Function to invoke when the specified event is
* emitted
* @param {*} context - Optional context object to use when invoking the
* @param context - Optional context object to use when invoking the
* listener
*/
new(emitter: EventEmitter, subscriber: EventSubscriptionVendor, listener: () => any, context: any): EmitterSubscription
@ -149,10 +144,10 @@ interface EventEmitterListener {
* emitted. An optional calling context may be provided. The data arguments
* emitted will be passed to the listener function.
*
* @param {string} eventType - Name of the event to listen to
* @param {function} listener - Function to invoke when the specified event is
* @param eventType - Name of the event to listen to
* @param listener - Function to invoke when the specified event is
* emitted
* @param {*} context - Optional context object to use when invoking the
* @param context - Optional context object to use when invoking the
* listener
*/
addListener(eventType: string, listener: (...args: any[]) => any, context?: any): EmitterSubscription
@ -160,9 +155,8 @@ interface EventEmitterListener {
interface EventEmitter extends EventEmitterListener {
/**
* @constructor
*
* @param {EventSubscriptionVendor} subscriber - Optional subscriber instance
* @param subscriber - Optional subscriber instance
* to use. If omitted, a new subscriber will be created for the emitter.
*/
new(subscriber?: EventSubscriptionVendor): EventEmitter
@ -171,10 +165,10 @@ interface EventEmitter extends EventEmitterListener {
* Similar to addListener, except that the listener is removed after it is
* invoked once.
*
* @param {string} eventType - Name of the event to listen to
* @param {function} listener - Function to invoke only once when the
* @param eventType - Name of the event to listen to
* @param listener - Function to invoke only once when the
* specified event is emitted
* @param {*} context - Optional context object to use when invoking the
* @param context - Optional context object to use when invoking the
* listener
*/
once(eventType: string, listener: (...args: any[]) => any, context: any): EmitterSubscription
@ -183,7 +177,7 @@ interface EventEmitter extends EventEmitterListener {
* Removes all of the registered listeners, including those registered as
* listener maps.
*
* @param {?string} eventType - Optional name of the event whose registered
* @param eventType - Optional name of the event whose registered
* listeners to remove
*/
removeAllListeners(eventType?: string): void
@ -221,8 +215,7 @@ interface EventEmitter extends EventEmitterListener {
* Returns an array of listeners that are currently registered for the given
* event.
*
* @param {string} eventType - Name of the event to query
* @returns {array}
* @param eventType - Name of the event to query
*/
listeners(eventType: string): EmitterSubscription[]
@ -230,8 +223,8 @@ interface EventEmitter extends EventEmitterListener {
* Emits an event of the given type with the given data. All handlers of that
* particular type will be notified.
*
* @param {string} eventType - Name of the event to emit
* @param {...*} Arbitrary arguments to be passed to each registered listener
* @param eventType - Name of the event to emit
* @param Arbitrary arguments to be passed to each registered listener
*
* @example
* emitter.addListener('someEvent', function(message) {
@ -245,8 +238,8 @@ interface EventEmitter extends EventEmitterListener {
/**
* 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
* @param eventType - Name of the event to emit
* @param listener - Function to invoke when the specified event is
* emitted
*
* @example
@ -468,18 +461,18 @@ export type AppConfig = {
* sure the JS execution environment is setup before other modules are
* `require`d.
*/
export class AppRegistry {
static registerConfig(config: AppConfig[]): void;
export namespace AppRegistry {
function registerConfig(config: AppConfig[]): void;
static registerComponent( appKey: string, getComponentFunc: ComponentProvider ): string;
function registerComponent( appKey: string, getComponentFunc: ComponentProvider ): string;
static registerRunnable(appKey: string, func: Runnable): string;
function registerRunnable(appKey: string, func: Runnable): string;
static getAppKeys(): string[];
function getAppKeys(): string[];
static unmountApplicationComponentAtRootTag(rootTag: number): void;
function unmountApplicationComponentAtRootTag(rootTag: number): void;
static runApplication(appKey: string, appParameters: any): void;
function runApplication(appKey: string, appParameters: any): void;
}
export interface LayoutAnimationTypes {
@ -929,8 +922,6 @@ export interface DocumentSelectionState extends EventEmitter {
* 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
@ -938,7 +929,6 @@ export interface DocumentSelectionState extends EventEmitter {
* 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
@ -1255,14 +1245,14 @@ interface TextInputState {
currentlyFocusedField(): number
/**
* @param {number} TextInputID id of the text field to focus
* @param 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
* @param textFieldID id of the text field to focus
* Unfocuses the specified text field
* noop if it wasn't focused
*/
@ -2216,13 +2206,11 @@ export interface SegmentedControlIOSProperties extends ViewProperties {
/**
* Callback that is called when the user taps a segment;
* passes the event as an argument
* @param event
*/
onChange?: (event: NativeSyntheticEvent<NativeSegmentedControlIOSChangeEvent>) => 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
@ -2582,7 +2570,6 @@ export interface DrawerLayoutAndroidProperties extends ViewProperties {
/**
* Function called whenever there is an interaction with the navigation view.
* @param event
*/
onDrawerSlide?: (event: DrawerSlideEvent) => void
@ -2596,7 +2583,6 @@ export interface DrawerLayoutAndroidProperties extends ViewProperties {
* - 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
@ -2710,8 +2696,6 @@ export interface PickerProperties extends PickerPropertiesIOS, PickerPropertiesA
* 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
@ -3035,13 +3019,11 @@ export interface SliderProperties extends SliderPropertiesIOS, SliderPropertiesA
/**
* 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
@ -4456,8 +4438,6 @@ export interface TouchableWithoutFeedbackAndroidProperties {
/**
* 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'
}
@ -4846,8 +4826,6 @@ export interface NavigatorProperties {
* corresponds to the current scene being rendered by the `Navigator` and
* `routeStack` is the set of currently mounted routes that the navigator
* could transition to. The function should return a scene configuration object.
* @param route
* @param routeStack
*/
configureScene?: (route: Route, routeStack: Route[]) => SceneConfig
/**
@ -4887,8 +4865,6 @@ export interface NavigatorProperties {
/**
* Required function which renders the scene for a given route.
* Will be invoked with the route and the navigator object
* @param route
* @param navigator
*/
renderScene: ( route: Route, navigator: Navigator ) => React.ReactElement<ViewProperties>
@ -4918,7 +4894,6 @@ interface InteractionMixin {
/**
* Schedule work for after all interactions have completed.
*
* @param {function} callback
*/
runAfterInteractions(callback: () => any): void
}
@ -4932,10 +4907,10 @@ interface SubscribableMixin {
* the subscription and therefore can guarantee it is retained in a way that
* will be cleaned up.
*
* @param {EventEmitter} eventEmitter emitter to subscribe to.
* @param {string} eventType Type of event to listen to.
* @param {function} listener Function to invoke when event occurs.
* @param {object} context Object to use as listener context.
* @param eventEmitter emitter to subscribe to.
* @param eventType Type of event to listen to.
* @param listener Function to invoke when event occurs.
* @param context Object to use as listener context.
*/
addListenerOn( eventEmitter: any, eventType: string, listener: () => any, context: any ): void
}
@ -4989,7 +4964,7 @@ export interface NavigatorStatic extends TimerMixin, InteractionMixin, Subscriba
/**
* Go back N scenes at once. When N=1, behavior matches `pop()`.
* When N is invalid(negative or bigger than current routes count), do nothing.
* @param {number} n The number of scenes to pop. Should be an integer.
* @param n The number of scenes to pop. Should be an integer.
*/
popN(n: number): void
@ -5298,8 +5273,6 @@ export interface SystraceStatic {
* Measures multiple methods of a class. For example, you can do:
* Systrace.measureMethods(JSON, 'JSON', ['parse', 'stringify']);
*
* @param object
* @param objectName
* @param methodNames Map from method names to method display names.
*/
measureMethods(object: any, objectName: string, methodNames: Array<string>): void
@ -5308,10 +5281,7 @@ export interface SystraceStatic {
* Returns an profiled version of the input function. For example, you can:
* JSON.parse = Systrace.measure('JSON', 'parse', JSON.parse);
*
* @param objName
* @param fnName
* @param {function} func
* @return {function} replacement function
* @return replacement function
*/
measure<T extends Function>(objName: string, fnName: string, func: T): T
}
@ -5589,7 +5559,6 @@ export interface PixelRatioStatic {
/**
* Converts a layout size (dp) to pixel size (px).
* Guaranteed to return an integer number.
* @param layoutSize
*/
getPixelSizeForLayoutSize(layoutSize: number): number
@ -5599,7 +5568,6 @@ export interface PixelRatioStatic {
* on a device with a PixelRatio of 3,
* PixelRatio.roundToNearestPixel(8.4) = 8.33,
* which corresponds to exactly (8.33 * 3) = 25 pixels.
* @param layoutSize
*/
roundToNearestPixel(layoutSize: number): number
@ -5659,8 +5627,8 @@ export interface ScaledSize {
*
* Example: `var {height, width} = Dimensions.get('window');`
*
* @param {string} dim Name of dimension as defined when calling `set`.
* @returns {Object?} Value for the dimension.
* @param dim Name of dimension as defined when calling `set`.
* @returns Value for the dimension.
* @see https://facebook.github.io/react-native/docs/dimensions.html#content
*/
export interface Dimensions {
@ -5675,30 +5643,30 @@ export interface Dimensions {
* example, using inline styles rather than setting a value in a
* StyleSheet).
* Example: var {height, width} = Dimensions.get('window');
@param {string} dim Name of dimension as defined when calling set.
@returns {Object?} Value for the dimension.
@param dim Name of dimension as defined when calling set.
@returns Value for the dimension.
*/
get(dim: "window" | "screen"): ScaledSize;
/**
* This should only be called from native code by sending the didUpdateDimensions event.
* @param {object} dims Simple string-keyed object of dimensions to set
* @param dims Simple string-keyed object of dimensions to set
*/
set( dims: {[key: string]: any} ): void;
/**
* Add an event listener for dimension changes
*
* @param {string} type the type of event to listen to
* @param {function} handler the event handler
* @param type the type of event to listen to
* @param handler the event handler
*/
addEventListener(type: "change", handler: () => void): void;
/**
* Remove an event listener
*
* @param {string} type the type of event
* @param {function} handler the event handler
* @param type the type of event
* @param handler the event handler
*/
removeEventListener(type: "change", handler: () => void): void;
}
@ -5723,7 +5691,6 @@ export interface InteractionManagerStatic extends EventEmitterListener {
/**
* Schedule a function to run after all interactions have completed.
* Returns a cancellable
* @param fn
*/
runAfterInteractions(task?: (() => any) | SimpleTask | PromiseTask): {
then: (onfulfilled?: () => any, onrejected?: () => any) => Promise<any>,
@ -5861,7 +5828,7 @@ interface ScrollResponderMixin extends SubscribableMixin {
/**
* Invoke this from an `onTouchEnd` event.
*
* @param {SyntheticEvent} e Event.
* @param e Event.
*/
scrollResponderHandleTouchEnd(e: ScrollResponderEvent): void
@ -5910,7 +5877,7 @@ interface ScrollResponderMixin extends SubscribableMixin {
* responder). The `onResponderReject` won't fire in that case - it only
* fires when a *current* responder rejects our request.
*
* @param {SyntheticEvent} e Touch Start event.
* @param e Touch Start event.
*/
scrollResponderHandleTouchStart(e: ScrollResponderEvent): void
@ -5923,7 +5890,7 @@ interface ScrollResponderMixin extends SubscribableMixin {
* responder). The `onResponderReject` won't fire in that case - it only
* fires when a *current* responder rejects our request.
*
* @param {SyntheticEvent} e Touch Start event.
* @param e Touch Start event.
*/
scrollResponderHandleTouchMove(e: ScrollResponderEvent): void
@ -5969,10 +5936,10 @@ interface ScrollResponderMixin extends SubscribableMixin {
* This method should be used as the callback to onFocus in a TextInputs'
* parent view. Note that any module using this mixin needs to return
* the parent view's ref in getScrollViewRef() in order to use this method.
* @param {any} nodeHandle The TextInput node handle
* @param {number} additionalOffset The scroll view's top "contentInset".
* @param nodeHandle The TextInput node handle
* @param additionalOffset The scroll view's top "contentInset".
* Default is 0.
* @param {bool} preventNegativeScrolling Whether to allow pulling the content
* @param preventNegativeScrolling Whether to allow pulling the content
* down to make it meet the keyboard's top. Default is false.
*/
scrollResponderScrollNativeHandleToKeyboard(nodeHandle: any, additionalOffset?: number, preventNegativeScrollOffset?: boolean): void
@ -5982,10 +5949,10 @@ interface ScrollResponderMixin extends SubscribableMixin {
* screen - even if has some content inset. We then measure the offsets of the
* keyboard, and compensate both for the scroll view's "contentInset".
*
* @param {number} left Position of input w.r.t. table view.
* @param {number} top Position of input w.r.t. table view.
* @param {number} width Width of the text input.
* @param {number} height Height of the text input.
* @param left Position of input w.r.t. table view.
* @param top Position of input w.r.t. table view.
* @param width Width of the text input.
* @param height Height of the text input.
*/
scrollResponderInputMeasureAndScrollToKeyboard(left: number, top: number, width: number, height: number): void
@ -6708,7 +6675,6 @@ export interface AlertIOSStatic {
/**
* Create and display a popup alert.
* @static
* @method alert
* @param title The dialog's title.
* @param message An optional message that appears below
@ -6726,7 +6692,6 @@ export interface AlertIOSStatic {
/**
* Create and display a prompt to enter some text.
* @static
* @method prompt
* @param title The dialog's title.
* @param message An optional message that appears above the text
@ -7016,7 +6981,7 @@ export interface CameraRollStatic {
/**
* Invokes callback with photo identifier objects from the local camera roll of the device matching shape defined by getPhotosReturnChecker.
*
* @param {object} params See getPhotosParamChecker.
* @param params See getPhotosParamChecker.
*/
getPhotos(params: GetPhotosParamType): Promise<GetPhotosReturnType>;
}
@ -7325,7 +7290,7 @@ export interface PanResponderInstance {
*/
export interface PanResponderStatic {
/**
* @param {PanResponderCallbacks} config Enhanced versions of all of the responder callbacks
* @param config Enhanced versions of all of the responder callbacks
* that provide not only the typical `ResponderSyntheticEvent`, but also the
* `PanResponder` gesture state. Simply replace the word `Responder` with
* `PanResponder` in each of the typical `onResponder*` callbacks. For
@ -7616,14 +7581,10 @@ export interface SettingsStatic {
}
/**
* @enum('default', 'light-content', 'dark-content')
*/
export type StatusBarStyle = "default" | "light-content" | "dark-content"
/**
* @enum('fade', 'slide')
*/
export type StatusBarAnimation = "none" | "fade" | "slide"
export interface StatusBarPropertiesIOS {

View File

@ -32,7 +32,7 @@ import {
// @todo when we split types into common, native and web,
// we can properly change Animated.Value to its real value
type AnimatedValue = any;
export type AnimatedValue = any;
export type HeaderMode = 'float' | 'screen' | 'none';
@ -67,7 +67,7 @@ export interface NavigationState {
* Index refers to the active child route in the routes array.
*/
index: number;
routes: Array<any>;
routes: any[];
}
export type NavigationRoute<Params> = NavigationLeafRoute<Params> | NavigationStateRoute<Params>;
@ -157,7 +157,7 @@ export interface NavigationScreenDetails<T> {
}
export interface NavigationScreenOptions {
title?: string,
title?: string;
}
export interface NavigationScreenConfigProps {
@ -189,7 +189,7 @@ export interface NavigationNavigator<T, State, Action, Options> extends React.Co
}
export interface NavigationParams {
[key: string]: any,
[key: string]: any;
}
export interface NavigationNavigateActionPayload {
@ -235,7 +235,7 @@ export interface NavigationInitAction extends NavigationInitActionPayload {
export interface NavigationResetActionPayload {
index: number;
key?: string | null;
actions: Array<NavigationNavigateAction>;
actions: NavigationNavigateAction[];
}
export interface NavigationResetAction extends NavigationResetActionPayload {
@ -319,7 +319,7 @@ export interface NavigationTabRouterConfig {
initialRouteName?: string;
paths?: NavigationPathsConfig;
navigationOptions?: NavigationScreenConfig<NavigationTabScreenOptions>;
order?: Array<string>; // todo: type these as the real route names rather than 'string'
order?: string[]; // todo: type these as the real route names rather than 'string'
// Does the back button cause the router to switch to the initial tab
backBehavior?: 'none' | 'initialRoute'; // defaults `initialRoute`
@ -422,7 +422,7 @@ export interface NavigationTransitionProps {
progress: AnimatedValue;
// All the scenes of the transitioner.
scenes: Array<NavigationScene>;
scenes: NavigationScene[];
// The active scene, corresponding to the route at
// `navigation.state.routes[navigation.state.index]`. When rendering
@ -486,12 +486,10 @@ export interface LayoutEvent {
* END FLOW TYPEDEFINITION.JS PORT
*/
/**
* BEGIN MANUAL DEFINITIONS OUTSIDE OF TYPEDEFINITION.JS
*/
// From navigators/NavigatorTypes.js
export type NavigatorType =
| 'react-navigation/STACK'
@ -502,7 +500,7 @@ export type NavigatorType =
export function addNavigationHelpers<S>(navigation: NavigationProp<S, NavigationAction>): NavigationScreenProp<S, NavigationAction>;
// From createNavigationContainer.js
interface NavigationContainerProps {
export interface NavigationContainerProps {
uriPrefix?: string | RegExp;
onNavigationStateChange?: (
prevNavigationState: NavigationState,
@ -522,11 +520,11 @@ export interface NavigationContainer extends React.ComponentClass<
}
export interface StackNavigatorConfig extends NavigationStackViewConfig, NavigationStackRouterConfig {
containerOptions?: any,
containerOptions?: any;
}
// Return createNavigationContainer
export function StackNavigator<T>(
export function StackNavigator(
routeConfigMap: NavigationRouteConfigMap,
stackConfig?: StackNavigatorConfig,
): NavigationContainer;
@ -534,7 +532,6 @@ export function StackNavigator<T>(
// DrawerItems
export const DrawerItems: React.ComponentClass<any>;
/**
* Drawer Navigator
*/
@ -557,7 +554,7 @@ export interface DrawerNavigatorConfig extends NavigationTabRouterConfig, Drawer
};
}
export function DrawerNavigator<T>(
export function DrawerNavigator(
routeConfigMap: NavigationRouteConfigMap,
drawerConfig?: DrawerNavigatorConfig,
): NavigationContainer;
@ -597,7 +594,7 @@ export interface TabViewConfig {
export interface TabNavigatorConfig extends NavigationTabRouterConfig, TabViewConfig { }
// From navigators/TabNavigator.js
export function TabNavigator<T>(
export function TabNavigator(
routeConfigMap: NavigationRouteConfigMap,
drawConfig?: TabNavigatorConfig,
): NavigationContainer;
@ -609,18 +606,18 @@ export const TabBarBottom: React.ComponentClass<any>;
* NavigationActions
*/
export namespace NavigationActions {
export function init(options?: NavigationInitActionPayload): NavigationInitAction;
export function navigate(options: NavigationNavigateActionPayload): NavigationNavigateAction;
export function reset(options: NavigationResetActionPayload): NavigationResetAction;
export function back(options?: NavigationBackActionPayload): NavigationBackAction;
export function setParams(options: NavigationSetParamsActionPayload): NavigationSetParamsAction;
function init(options?: NavigationInitActionPayload): NavigationInitAction;
function navigate(options: NavigationNavigateActionPayload): NavigationNavigateAction;
function reset(options: NavigationResetActionPayload): NavigationResetAction;
function back(options?: NavigationBackActionPayload): NavigationBackAction;
function setParams(options: NavigationSetParamsActionPayload): NavigationSetParamsAction;
}
/**
* Transitioner
* @desc From react-navigation/src/views/Transitioner.js
*/
interface TransitionerProps {
export interface TransitionerProps {
configureTransition: (
transitionProps: NavigationTransitionProps,
prevTransitionProps?: NavigationTransitionProps
@ -635,11 +632,11 @@ interface TransitionerProps {
style?: StyleProp<ViewStyle>;
}
interface TransitionerState {
export interface TransitionerState {
layout: NavigationLayout;
position: Animated.Value;
progress: Animated.Value;
scenes: Array<NavigationScene>;
scenes: NavigationScene[];
}
export class Transitioner extends React.Component<
@ -647,42 +644,37 @@ export class Transitioner extends React.Component<
TransitionerState
> { }
/**
* Tab Router
*
* @desc from react-navigation/src/routers/TabRouter.js
* @param routeConfigs
* @param config
*/
export function TabRouter(
routeConfigs: NavigationRouteConfigMap,
config: NavigationTabRouterConfig
): NavigationRouter<any, any, any>
): NavigationRouter<any, any, any>;
/**
* Stack Router
*
* @desc from react-navigation/src/routers/StackRouter.js
* @param routeConfigs
* @param config
*/
export function StackRouter(
routeConfigs: NavigationRouteConfigMap,
config: NavigationTabRouterConfig
): NavigationRouter<any, any, any>
): NavigationRouter<any, any, any>;
/**
* Create Navigator
*
* @see https://github.com/react-community/react-navigation/blob/master/src/navigators/createNavigator.js
*/
export function createNavigator<C, S, A, NavigatorConfig, Options>(
export function createNavigator<C, S, A, Options>(
router: NavigationRouter<S, A, Options>,
routeConfigs?: NavigationRouteConfigMap,
navigatorConfig?: NavigatorConfig,
navigatorConfig?: {} | null,
navigatorType?: NavigatorType
): (NavigationView: React.ComponentClass<C>) => NavigationNavigator<C, S, A, Options>
): (NavigationView: React.ComponentClass<C>) => NavigationNavigator<C, S, A, Options>;
/**
* Create an HOC that injects the navigation and manages the navigation state
@ -692,14 +684,13 @@ export function createNavigator<C, S, A, NavigatorConfig, Options>(
*
* @see https://github.com/react-community/react-navigation/blob/master/src/createNavigationContainer.js
*/
export function createNavigationContainer<S, O>(
Component: NavigationNavigator<any, S, any, O>
): React.Component<any, any>
export function createNavigationContainer(
Component: NavigationNavigator<any, any, any, any>
): React.Component<any, any>;
/**
* END MANUAL DEFINITIONS OUTSIDE OF TYPEDEFINITION.JS
*/
/**
* BEGIN CUSTOM CONVENIENCE INTERFACES
*/
@ -714,7 +705,6 @@ export interface NavigationScreenProps<Params> {
* END CUSTOM CONVENIENCE INTERFACES
*/
/*
* Header
*/

View File

@ -38,19 +38,17 @@ const viewStyle: ViewStyle = {
backgroundColor: "white",
};
/**
* @class StartScreen @extends React.Component
* @desc Simple screen component class with typed component props that should
* receive the navigation prop from the AppNavigator.
*/
const ROUTE_NAME_START_SCREEN = "StartScreen";
interface StartScreenNavigationParams {
id: number,
s: string,
id: number;
s: string;
}
interface StartScreenProps extends NavigationScreenProps<StartScreenNavigationParams> { }
/**
* @desc Simple screen component class with typed component props that should
* receive the navigation prop from the AppNavigator.
*/
class StartScreen extends React.Component<StartScreenProps> {
render() {
// Implicit type checks.
@ -65,24 +63,18 @@ class StartScreen extends React.Component<StartScreenProps> {
);
}
private navigateToNextScreen = (): void => {
this.props.navigation.navigate(
ROUTE_NAME_NEXT_SCREEN,
{
id: this.props.navigation.state.params.id,
name: this.props.navigation.state.params.s,
} as NextScreenNavigationParams,
);
const params: NextScreenNavigationParams = {
id: this.props.navigation.state.params.id,
name: this.props.navigation.state.params.s,
};
this.props.navigation.navigate(ROUTE_NAME_NEXT_SCREEN, params);
}
}
/**
* @class NextScreen @extends React.Component
*/
const ROUTE_NAME_NEXT_SCREEN = "NextScreen";
interface NextScreenNavigationParams {
id: number,
name: string,
id: number;
name: string;
}
interface NextScreenProps extends NavigationScreenProps<NextScreenNavigationParams> { }
class NextScreen extends React.Component<NextScreenProps> {
@ -138,7 +130,6 @@ const Router = (props: any) => (
/>
);
/**
* Tab navigator.
*/
@ -170,7 +161,6 @@ function renderBasicTabNavigator(): JSX.Element {
);
}
/**
* Stack navigator.
*/
@ -199,14 +189,12 @@ function renderBasicStackNavigator(): JSX.Element {
);
}
interface CustomTransitionerProps {
navigation: NavigationScreenProp<any, NavigationAction>;
}
/**
* @class CustomTransitioner @extends React.Component
* @desc Custom transitioner component. Follows react-navigation/src/views/CardStackTransitioner.js.
*/
interface CustomTransitionerProps {
navigation: NavigationScreenProp<any, NavigationAction>
}
class CustomTransitioner extends React.Component<CustomTransitionerProps, null> {
render() {
return (
@ -228,7 +216,7 @@ class CustomTransitioner extends React.Component<CustomTransitionerProps, null>
_transitionProps: NavigationTransitionProps,
_prevTransitionProps: NavigationTransitionProps
) => {
return {}
return {};
}
}
@ -257,12 +245,11 @@ function renderHeaderBackButton(schema: string): JSX.Element {
}
}
const initAction: NavigationInitAction = NavigationActions.init({
params: {
foo: "bar"
}
})
});
const navigateAction: NavigationNavigateAction = NavigationActions.navigate({
routeName: "FooScreen",
@ -270,7 +257,7 @@ const navigateAction: NavigationNavigateAction = NavigationActions.navigate({
foo: "bar"
},
action: NavigationActions.navigate({ routeName: "BarScreen" })
})
});
const resetAction: NavigationResetAction = NavigationActions.reset({
index: 0,
@ -278,15 +265,15 @@ const resetAction: NavigationResetAction = NavigationActions.reset({
actions: [
NavigationActions.navigate({ routeName: "FooScreen" })
]
})
});
const backAction: NavigationBackAction = NavigationActions.back({
key: "foo"
})
});
const setParamsAction: NavigationSetParamsAction = NavigationActions.setParams({
key: "foo",
params: {
foo: "bar"
}
})
});

View File

@ -1,23 +1 @@
{
"extends": "dtslint/dt.json",
"rules": {
// Lowercase `object` is available in TypeScript 2.2 only.
"ban-types": false,
// Below are all TODO
"align": false,
"array-type": false,
"comment-format": false,
"jsdoc-format": false,
"no-misused-new": false,
"no-consecutive-blank-lines": false,
"no-empty-interface": false,
"no-object-literal-type-assertion": false,
"no-padding": false,
"no-var": false,
"prefer-declare-function": false,
"prefer-method-signature": false,
"semicolon": false,
"strict-export-declare-modifiers": false,
"no-unnecessary-generics": false
}
}
{ "extends": "dtslint/dt.json" }

View File

@ -1 +1,7 @@
{ "extends": "dtslint/dt.json" }
{
"extends": "dtslint/dt.json",
"rules": {
// TODO
"no-unnecessary-class": false
}
}

View File

@ -11,7 +11,6 @@ declare class ReactTooltip extends React.Component<ReactTooltip.Props> { }
declare namespace ReactTooltip {
/**
* Hide the tooltip manually, the target is optional, if no target passed in, all existing tooltips will be hidden
* @param {Element} target
*/
function hide(target?: Element): void;

View File

@ -10,6 +10,7 @@
"prefer-method-signature": false,
"prefer-declare-function": false,
"no-padding": false,
"no-redundant-jsdoc-2": false,
"array-type": [true, "array"]
}
}