From 4330cf1bb998f25086a09f384cc61497dd3eb5eb Mon Sep 17 00:00:00 2001 From: Danny Cochran Date: Wed, 23 Nov 2016 06:47:28 -0800 Subject: [PATCH] update react typings to 0.37 adds the onMessage propType for webView added in 0.37 @bgrieder - not sure how to best check for other potential new types between 0.34 and 0.37, but this is one I'm sure is missing: https://facebook.github.io/react-native/docs/webview.html#onmessage --- react-native/index.d.ts | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/react-native/index.d.ts b/react-native/index.d.ts index e08bb9fcd9..e0cf07d271 100644 --- a/react-native/index.d.ts +++ b/react-native/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for react-native 0.34 +// Type definitions for react-native 0.37 // Project: https://github.com/facebook/react-native // Definitions by: Bruno Grieder // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -1922,6 +1922,16 @@ declare module "react" { [key: string]: any } + /** + * Passed data from WebView via window.postMessage. + */ + export interface WebViewMessageEventData { + /** + * The data sent from a WebView; can only be a string. + */ + data: string + } + export interface WebViewPropertiesAndroid { /** @@ -2080,6 +2090,11 @@ declare module "react" { */ onLoadStart?: (event: NavState) => void + /** + * Invoked when window.postMessage is called from WebView. + */ + onMessage?: ( event: NativeSyntheticEvent ) => void + /** * Function that is invoked when the `WebView` loading starts or ends. */