From 6ca038a08fe6969ea14308faed8df8f67a987b8e Mon Sep 17 00:00:00 2001 From: Ashish Shubham Date: Mon, 22 May 2017 23:31:00 -0700 Subject: [PATCH 01/13] update rangy definitions Update type definitions for the Rangy Module. --- types/rangy/index.d.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/types/rangy/index.d.ts b/types/rangy/index.d.ts index 1edb9c3c23..ea784d9b7e 100644 --- a/types/rangy/index.d.ts +++ b/types/rangy/index.d.ts @@ -39,6 +39,7 @@ interface RangySelection extends Selection { refresh(checkForChanges?:boolean):any; toHtml():string; getAllRanges():RangyRange[]; + getRangeAt(idx:number):RangyRange; getNativeTextRange():any; setSingleRange(range:RangyRange):any; setRanges(ranges:RangyRange[]):any; @@ -46,6 +47,8 @@ interface RangySelection extends Selection { moveToBookmark(bookmark:Object):any; saveRanges():Object; restoreRanges(saved:Object):any; + saveCharacterRanges(containerNode:Node): Object; + restoreCharacterRanges(containerNode:Node, characterRanges:Object); detach():any; inspect():string; } @@ -62,5 +65,7 @@ interface RangyStatic { initialized:boolean; supported:boolean; } - +declare module 'rangy' { + export = rangy; +} declare var rangy:RangyStatic; From 688ba5fea60ae72bda6cb6aa1cb7875f1d942def Mon Sep 17 00:00:00 2001 From: Ashish Shubham Date: Tue, 23 May 2017 01:22:35 -0700 Subject: [PATCH 02/13] Update rangy definitions --- types/rangy/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/rangy/index.d.ts b/types/rangy/index.d.ts index ea784d9b7e..84dcd88320 100644 --- a/types/rangy/index.d.ts +++ b/types/rangy/index.d.ts @@ -48,7 +48,7 @@ interface RangySelection extends Selection { saveRanges():Object; restoreRanges(saved:Object):any; saveCharacterRanges(containerNode:Node): Object; - restoreCharacterRanges(containerNode:Node, characterRanges:Object); + restoreCharacterRanges(containerNode:Node, characterRanges:Object):any; detach():any; inspect():string; } From bcc2eec9227882c077f3c2c60717b563bb5130da Mon Sep 17 00:00:00 2001 From: Ashish Shubham Date: Tue, 23 May 2017 02:07:40 -0700 Subject: [PATCH 03/13] Update rangy-tests.ts --- types/rangy/rangy-tests.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/types/rangy/rangy-tests.ts b/types/rangy/rangy-tests.ts index fac44c868c..5febe59cf0 100644 --- a/types/rangy/rangy-tests.ts +++ b/types/rangy/rangy-tests.ts @@ -94,4 +94,8 @@ function testSelection() { selection.setRanges(ranges); selection.setSingleRange(getRangyRange()); assertString(selection.toHtml()); + var node:Node = new Node(); + object = selection.saveCharacterRanges(node); + selection.restoreCharacterRanges(node, object); + assertString(selection.toHtml()); } From dceac2d5c127626f0e24344546b518a9fd91fe37 Mon Sep 17 00:00:00 2001 From: Ashish Shubham Date: Tue, 23 May 2017 03:04:26 -0700 Subject: [PATCH 04/13] Update rangy-tests.ts --- types/rangy/rangy-tests.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/rangy/rangy-tests.ts b/types/rangy/rangy-tests.ts index 5febe59cf0..de2ec468f0 100644 --- a/types/rangy/rangy-tests.ts +++ b/types/rangy/rangy-tests.ts @@ -81,6 +81,7 @@ function testSelection() { selection.detach(); let ranges:RangyRange[] = selection.getAllRanges(); + let range:RangyRange = selection.getRangeAt(0); selection.getBookmark(new Node); let nativeTextRange:TextRange = selection.getNativeTextRange(); assertString(selection.inspect()); From e657a632ad7d6bd2b9d4761fe222f8ad7f6af135 Mon Sep 17 00:00:00 2001 From: Ashish Shubham Date: Tue, 23 May 2017 03:05:24 -0700 Subject: [PATCH 05/13] Update index.d.ts --- types/rangy/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/rangy/index.d.ts b/types/rangy/index.d.ts index 84dcd88320..b6615b9aad 100644 --- a/types/rangy/index.d.ts +++ b/types/rangy/index.d.ts @@ -47,7 +47,7 @@ interface RangySelection extends Selection { moveToBookmark(bookmark:Object):any; saveRanges():Object; restoreRanges(saved:Object):any; - saveCharacterRanges(containerNode:Node): Object; + saveCharacterRanges(containerNode:Node):Object; restoreCharacterRanges(containerNode:Node, characterRanges:Object):any; detach():any; inspect():string; From c350fb666dacdcff9def2543c7d256ca8fc9905c Mon Sep 17 00:00:00 2001 From: Jeremi Stadler Date: Sun, 28 May 2017 14:30:26 +0200 Subject: [PATCH 06/13] [React-Native] Add global ErrorUtils & __BUNDLE_START_TIME__ Source: https://github.com/facebook/react-native/blob/master/packager/src/Resolver/polyfills/error-guard.js https://github.com/facebook/react-native/blob/master/packager/src/Resolver/polyfills/prelude.js --- types/react-native/index.d.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/types/react-native/index.d.ts b/types/react-native/index.d.ts index 07f2dd1741..490c27dcff 100644 --- a/types/react-native/index.d.ts +++ b/types/react-native/index.d.ts @@ -8822,6 +8822,13 @@ export function processColor(color: any): number; export function __spread(target: any, ...sources: any[]): any; +type ErrorHandlerCallback = (error: any, isFatal?: boolean) => void; + +export interface ErrorUtils { + setGlobalHandler: (callback: ErrorHandlerCallback) => void; + getGlobalHandler: () => ErrorHandlerCallback; +} + export interface GlobalStatic { /** @@ -8842,6 +8849,9 @@ export interface GlobalStatic { */ originalXMLHttpRequest: Object; XMLHttpRequest: Object; + + __BUNDLE_START_TIME__: number; + ErrorUtils: ErrorUtils; } // From 72b17113979a5a2905cad123fee8349f3358a9bf Mon Sep 17 00:00:00 2001 From: Jeremi Stadler Date: Mon, 29 May 2017 11:34:18 +0200 Subject: [PATCH 07/13] [React-Navigation] Add TabBarTop & TabBarBottom types --- types/react-navigation/index.d.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/types/react-navigation/index.d.ts b/types/react-navigation/index.d.ts index ffa936f6d0..083139a165 100644 --- a/types/react-navigation/index.d.ts +++ b/types/react-navigation/index.d.ts @@ -621,3 +621,6 @@ export interface NavgationComponentProps { }, } } + +export const TabBarTop: React.ReactElement; +export const TabBarBottom: React.ReactElement; From f113c7a5e76e35076c93a808d96950146a6044b4 Mon Sep 17 00:00:00 2001 From: Jeremi Stadler Date: Mon, 29 May 2017 14:34:58 +0200 Subject: [PATCH 08/13] [React-Navigation] Add tabConfig tests Specifically to test the tabBarComponent property --- types/react-navigation/react-navigation-tests.tsx | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/types/react-navigation/react-navigation-tests.tsx b/types/react-navigation/react-navigation-tests.tsx index a88a5d3a0b..2493d92f84 100644 --- a/types/react-navigation/react-navigation-tests.tsx +++ b/types/react-navigation/react-navigation-tests.tsx @@ -3,7 +3,10 @@ import { View } from 'react-native'; import { addNavigationHelpers, StackNavigator, - TabNavigatorScreenOptions + TabNavigatorScreenOptions, + TabNavigatorConfig, + TabBarTop, + TabBarBottom, } from 'react-navigation'; const Start = ( @@ -34,5 +37,10 @@ const tabNavigatorScreenOptions: TabNavigatorScreenOptions = { title: 'title', tabBarVisible: true, tabBarIcon: , - tabBarLabel: 'label' + tabBarLabel: 'label', +} + +const tabNavigatorConfig: TabNavigatorConfig = { + lazy: true, + tabBarComponent: TabBarTop, } From 11e05d59480ddddd7bfe3370d5afe4feddb98e2f Mon Sep 17 00:00:00 2001 From: Jeremi Stadler Date: Mon, 29 May 2017 15:08:56 +0200 Subject: [PATCH 09/13] [React-Native] Add missing props for `Text` & `TextInput` https://facebook.github.io/react-native/docs/text.html#selectioncolor https://facebook.github.io/react-native/docs/text.html#textbreakstrategy https://facebook.github.io/react-native/docs/textinput.html#spellcheck --- types/react-native/index.d.ts | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/types/react-native/index.d.ts b/types/react-native/index.d.ts index 490c27dcff..135d6e7a4d 100644 --- a/types/react-native/index.d.ts +++ b/types/react-native/index.d.ts @@ -804,6 +804,17 @@ export interface TextPropertiesAndroid { * Lets the user select text, to use the native copy and paste functionality. */ selectable?: boolean + + /** + * The highlight color of the text. + */ + selectionColor?: string + + /** + * Set text break strategy on Android API Level 23+ + * default is `highQuality`. + */ + textBreakStrategy?: "simple" | "highQuality" | "balanced" } // https://facebook.github.io/react-native/docs/text.html#props @@ -993,7 +1004,10 @@ export interface TextInputIOSProperties { */ selectionState?: DocumentSelectionState - + /** + * If false, disables spell-check style (i.e. red underlines). The default value is inherited from autoCorrect + */ + spellCheck?: boolean } /** From 8a8bb937ea4ff4a70cf2ffe4ee49514d75f5d1e2 Mon Sep 17 00:00:00 2001 From: Jeremi Stadler Date: Mon, 29 May 2017 15:12:33 +0200 Subject: [PATCH 10/13] [React-Native] Add myself to maintainers list --- types/react-native/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react-native/index.d.ts b/types/react-native/index.d.ts index 135d6e7a4d..4db13a47e0 100644 --- a/types/react-native/index.d.ts +++ b/types/react-native/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for react-native 0.44 // Project: https://github.com/facebook/react-native -// Definitions by: Eloy Durán , Fedor Nezhivoi , HuHuanming +// Definitions by: Eloy Durán , Fedor Nezhivoi , HuHuanming , Jeremi Stadler // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.1 From 4e4890ccc88561afcd2064dab10195db58e65929 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Tue, 30 May 2017 00:53:43 -0700 Subject: [PATCH 11/13] Added tests for 'children' set to both elements and functions to elements in 'react-router'. --- types/react-router/test/Children.tsx | 22 ++++++++++++++++++++++ types/react-router/tsconfig.json | 1 + 2 files changed, 23 insertions(+) create mode 100644 types/react-router/test/Children.tsx diff --git a/types/react-router/test/Children.tsx b/types/react-router/test/Children.tsx new file mode 100644 index 0000000000..8e4faad089 --- /dev/null +++ b/types/react-router/test/Children.tsx @@ -0,0 +1,22 @@ +import * as React from 'react'; +import { Route } from 'react-router'; + +function RouteWithFunctionChildrenAttribute() { + return
Hello!
} /> +} + +function RouteWithFunctionJsxChildren() { + return + {() =>
Hello!
} +
+} + +function RouteWithElementChildrenAttribute() { + return Hello!} /> +} + +function RouteWithElementJsxChildren() { + return + {
Hello!
} +
+} \ No newline at end of file diff --git a/types/react-router/tsconfig.json b/types/react-router/tsconfig.json index df074843df..f3a225ece1 100644 --- a/types/react-router/tsconfig.json +++ b/types/react-router/tsconfig.json @@ -18,6 +18,7 @@ "test/Animation.tsx", "test/Auth.tsx", "test/Basic.tsx", + "test/Children.tsx", "test/CustomLink.tsx", "test/ModalGallery.tsx", "test/NavigateWithContext.tsx", From 65cfdaef9429d61b2d6a65581980946fdaac45eb Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Tue, 30 May 2017 01:01:22 -0700 Subject: [PATCH 12/13] Fixed the type of 'children' for 'Route' in 'react-router'. --- types/react-router/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react-router/index.d.ts b/types/react-router/index.d.ts index d5bc7240c7..384cb2289e 100644 --- a/types/react-router/index.d.ts +++ b/types/react-router/index.d.ts @@ -65,7 +65,7 @@ export interface RouteProps { location?: H.Location; component?: React.SFC | undefined> | React.ComponentClass | undefined>; render?: ((props: RouteComponentProps) => React.ReactNode); - children?: ((props: RouteComponentProps) => React.ReactNode | React.ReactNode); + children?: ((props: RouteComponentProps) => React.ReactNode) | React.ReactNode; path?: string; exact?: boolean; strict?: boolean; From 3b8b7625b71efa6cfcd06787ef37c848a28fa508 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Tue, 30 May 2017 01:17:26 -0700 Subject: [PATCH 13/13] Lints. --- types/react-router/test/Children.tsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/types/react-router/test/Children.tsx b/types/react-router/test/Children.tsx index 8e4faad089..c3dea4f482 100644 --- a/types/react-router/test/Children.tsx +++ b/types/react-router/test/Children.tsx @@ -2,21 +2,21 @@ import * as React from 'react'; import { Route } from 'react-router'; function RouteWithFunctionChildrenAttribute() { - return
Hello!
} /> + return
Hello!
} />; } function RouteWithFunctionJsxChildren() { return {() =>
Hello!
} -
+
; } function RouteWithElementChildrenAttribute() { - return Hello!} /> + return Hello!} />; } function RouteWithElementJsxChildren() { return {
Hello!
} -
-} \ No newline at end of file +
; +}