diff --git a/Examples/UIExplorer/NavigatorIOSExample.js b/Examples/UIExplorer/NavigatorIOSExample.js index 7b92346054..9f6065cbe9 100644 --- a/Examples/UIExplorer/NavigatorIOSExample.js +++ b/Examples/UIExplorer/NavigatorIOSExample.js @@ -1,5 +1,6 @@ /** * Copyright 2004-present Facebook. All Rights Reserved. + * @flow */ 'use strict'; @@ -150,7 +151,7 @@ var NavigatorIOSExample = React.createClass({ }); }, - _renderRow: function(title, onPress) { + _renderRow: function(title: string, onPress: Function) { return ( diff --git a/Examples/UIExplorer/NetInfoExample.js b/Examples/UIExplorer/NetInfoExample.js index 017da9921e..dabff174e9 100644 --- a/Examples/UIExplorer/NetInfoExample.js +++ b/Examples/UIExplorer/NetInfoExample.js @@ -1,5 +1,6 @@ /** * Copyright 2004-present Facebook. All Rights Reserved. + * @flow */ 'use strict'; @@ -120,16 +121,16 @@ exports.examples = [ { title: 'NetInfo.isConnected', description: 'Asyncronously load and observe connectivity', - render() { return ; } + render(): ReactElement { return ; } }, { title: 'NetInfo.reachabilityIOS', description: 'Asyncronously load and observe iOS reachability', - render() { return ; } + render(): ReactElement { return ; } }, { title: 'NetInfo.reachabilityIOS', description: 'Observed updates to iOS reachability', - render() { return ; } + render(): ReactElement { return ; } }, ]; diff --git a/Examples/UIExplorer/PickerExample.js b/Examples/UIExplorer/PickerExample.js index 53f717bf36..bbe1ca4fc6 100644 --- a/Examples/UIExplorer/PickerExample.js +++ b/Examples/UIExplorer/PickerExample.js @@ -1,5 +1,6 @@ /** * Copyright 2004-present Facebook. All Rights Reserved. + * @flow */ 'use strict'; @@ -105,7 +106,7 @@ exports.description = 'Render lists of selectable options with UIPickerView.'; exports.examples = [ { title: '', - render: function() { + render: function(): ReactElement { return ; }, }]; diff --git a/Examples/UIExplorer/PointerEventsExample.js b/Examples/UIExplorer/PointerEventsExample.js index be9f5a5215..e83d88d1de 100644 --- a/Examples/UIExplorer/PointerEventsExample.js +++ b/Examples/UIExplorer/PointerEventsExample.js @@ -1,5 +1,6 @@ /** * Copyright 2004-present Facebook. All Rights Reserved. + * @flow */ 'use strict'; diff --git a/Examples/UIExplorer/ScrollViewExample.js b/Examples/UIExplorer/ScrollViewExample.js index 0dca6b3be6..2e8045afb7 100644 --- a/Examples/UIExplorer/ScrollViewExample.js +++ b/Examples/UIExplorer/ScrollViewExample.js @@ -1,5 +1,6 @@ /** * Copyright 2004-present Facebook. All Rights Reserved. + * @flow */ 'use strict'; diff --git a/Examples/UIExplorer/SliderIOSExample.js b/Examples/UIExplorer/SliderIOSExample.js index bc58ccec71..b7db6bcdd8 100644 --- a/Examples/UIExplorer/SliderIOSExample.js +++ b/Examples/UIExplorer/SliderIOSExample.js @@ -1,5 +1,6 @@ /** * Copyright 2004-present Facebook. All Rights Reserved. + * @flow */ 'use strict'; @@ -50,6 +51,6 @@ exports.description = 'Slider input for numeric values'; exports.examples = [ { title: 'SliderIOS', - render() { return ; } + render(): ReactElement { return ; } } ]; diff --git a/Examples/UIExplorer/StatusBarIOSExample.js b/Examples/UIExplorer/StatusBarIOSExample.js index bca275501a..638883b995 100644 --- a/Examples/UIExplorer/StatusBarIOSExample.js +++ b/Examples/UIExplorer/StatusBarIOSExample.js @@ -1,5 +1,6 @@ /** * Copyright 2004-present Facebook. All Rights Reserved. + * @flow */ 'use strict'; diff --git a/Examples/UIExplorer/SwitchExample.js b/Examples/UIExplorer/SwitchExample.js index 23538e1698..2cee746628 100644 --- a/Examples/UIExplorer/SwitchExample.js +++ b/Examples/UIExplorer/SwitchExample.js @@ -1,5 +1,6 @@ /** * Copyright 2004-present Facebook. All Rights Reserved. + * @flow */ 'use strict'; @@ -118,22 +119,22 @@ exports.description = 'Native boolean input'; exports.examples = [ { title: 'Switches can be set to true or false', - render() { return ; } + render(): ReactElement { return ; } }, { title: 'Switches can be disabled', - render() { return ; } + render(): ReactElement { return ; } }, { title: 'Custom colors can be provided', - render() { return ; } + render(): ReactElement { return ; } }, { title: 'Change events can be detected', - render() { return ; } + render(): ReactElement { return ; } }, { title: 'Switches are controlled components', - render() { return ; } + render(): ReactElement { return ; } } ]; diff --git a/Examples/UIExplorer/TextExample.ios.js b/Examples/UIExplorer/TextExample.ios.js index 1894b31ff1..9c9826772d 100644 --- a/Examples/UIExplorer/TextExample.ios.js +++ b/Examples/UIExplorer/TextExample.ios.js @@ -1,5 +1,6 @@ /** * Copyright 2004-present Facebook. All Rights Reserved. + * @flow */ 'use strict'; @@ -199,7 +200,7 @@ exports.examples = [ }, }, { title: 'Toggling Attributes', - render: function() { + render: function(): ReactElement { return ; }, }, { diff --git a/Examples/UIExplorer/TextInputExample.js b/Examples/UIExplorer/TextInputExample.js index bce5de9d8c..fec6f84511 100644 --- a/Examples/UIExplorer/TextInputExample.js +++ b/Examples/UIExplorer/TextInputExample.js @@ -1,5 +1,6 @@ /** * Copyright 2004-present Facebook. All Rights Reserved. + * @flow */ 'use strict'; @@ -164,7 +165,7 @@ exports.examples = [ }, { title: 'Event handling', - render: () => , + render: function(): ReactElement { return }, }, { title: 'Colored input text', diff --git a/Examples/UIExplorer/TimerExample.js b/Examples/UIExplorer/TimerExample.js index 6d48738d4d..7cd576e6c4 100644 --- a/Examples/UIExplorer/TimerExample.js +++ b/Examples/UIExplorer/TimerExample.js @@ -1,5 +1,6 @@ /** * Copyright 2004-present Facebook. All Rights Reserved. + * @flow */ 'use strict'; @@ -31,6 +32,12 @@ var Button = React.createClass({ var TimerTester = React.createClass({ mixins: [TimerMixin], + _ii: 0, + _iters: 0, + _start: 0, + _timerFn: (null : ?(() => any)), + _handle: (null : any), + render: function() { var args = 'fn' + (this.props.dt !== undefined ? ', ' + this.props.dt : ''); return ( @@ -71,7 +78,7 @@ var TimerTester = React.createClass({ 'Elapsed time: ' + e + ' ms\n' + (e / this._ii) + ' ms / iter'; console.log(msg); AlertIOS.alert(msg); - this._start = null; + this._start = 0; this.forceUpdate(() => { this._ii = 0; }); return; } @@ -153,7 +160,7 @@ exports.examples = [ title: 'this.setInterval(fn, t)', description: 'Execute function fn every t milliseconds until cancelled ' + 'or component is unmounted.', - render: function() { + render: function(): ReactElement { var IntervalExample = React.createClass({ getInitialState: function() { return { diff --git a/Examples/UIExplorer/TouchableExample.js b/Examples/UIExplorer/TouchableExample.js index 4226ec18a9..01e8bbfb1b 100644 --- a/Examples/UIExplorer/TouchableExample.js +++ b/Examples/UIExplorer/TouchableExample.js @@ -1,5 +1,6 @@ /** * Copyright 2004-present Facebook. All Rights Reserved. + * @flow */ 'use strict'; @@ -53,14 +54,14 @@ exports.examples = [ }, }, { title: ' with highlight', - render: function() { + render: function(): ReactElement { return ; }, }, { title: 'Touchable feedback events', description: ' components accept onPress, onPressIn, ' + 'onPressOut, and onLongPress as props.', - render: function() { + render: function(): ReactElement { return ; }, }]; diff --git a/Examples/UIExplorer/UIExplorerApp.js b/Examples/UIExplorer/UIExplorerApp.js index c234d54b69..97da6d10f1 100644 --- a/Examples/UIExplorer/UIExplorerApp.js +++ b/Examples/UIExplorer/UIExplorerApp.js @@ -2,6 +2,7 @@ * Copyright 2004-present Facebook. All Rights Reserved. * * @providesModule UIExplorerApp + * @flow */ 'use strict'; diff --git a/Examples/UIExplorer/UIExplorerBlock.js b/Examples/UIExplorer/UIExplorerBlock.js index 4c96ce86d5..007c67afb8 100644 --- a/Examples/UIExplorer/UIExplorerBlock.js +++ b/Examples/UIExplorer/UIExplorerBlock.js @@ -2,6 +2,7 @@ * Copyright 2004-present Facebook. All Rights Reserved. * * @providesModule UIExplorerBlock + * @flow */ 'use strict'; @@ -19,7 +20,7 @@ var UIExplorerBlock = React.createClass({ }, getInitialState: function() { - return {description: null}; + return {description: (null: ?string)}; }, render: function() { diff --git a/Examples/UIExplorer/UIExplorerList.js b/Examples/UIExplorer/UIExplorerList.js index 5ca5254ec4..4640cecb2d 100644 --- a/Examples/UIExplorer/UIExplorerList.js +++ b/Examples/UIExplorer/UIExplorerList.js @@ -1,5 +1,6 @@ /** * Copyright 2004-present Facebook. All Rights Reserved. + * @flow */ 'use strict'; diff --git a/Examples/UIExplorer/UIExplorerPage.js b/Examples/UIExplorer/UIExplorerPage.js index 5d619dcec8..f74a8c7672 100644 --- a/Examples/UIExplorer/UIExplorerPage.js +++ b/Examples/UIExplorer/UIExplorerPage.js @@ -2,6 +2,7 @@ * Copyright 2004-present Facebook. All Rights Reserved. * * @providesModule UIExplorerPage + * @flow */ 'use strict'; diff --git a/Examples/UIExplorer/UIExplorerTitle.js b/Examples/UIExplorer/UIExplorerTitle.js index a8fb4ba8dd..2b9b718cb6 100644 --- a/Examples/UIExplorer/UIExplorerTitle.js +++ b/Examples/UIExplorer/UIExplorerTitle.js @@ -2,6 +2,7 @@ * Copyright 2004-present Facebook. All Rights Reserved. * * @providesModule UIExplorerTitle + * @flow */ 'use strict'; diff --git a/Examples/UIExplorer/VibrationIOSExample.js b/Examples/UIExplorer/VibrationIOSExample.js index bd768bcbbf..7d69bab2f3 100644 --- a/Examples/UIExplorer/VibrationIOSExample.js +++ b/Examples/UIExplorer/VibrationIOSExample.js @@ -1,5 +1,6 @@ /** * Copyright 2004-present Facebook. All Rights Reserved. + * @flow */ 'use strict'; diff --git a/Examples/UIExplorer/ViewExample.js b/Examples/UIExplorer/ViewExample.js index eb2288a493..dbd9bb5c5c 100644 --- a/Examples/UIExplorer/ViewExample.js +++ b/Examples/UIExplorer/ViewExample.js @@ -1,5 +1,6 @@ /** * Copyright 2004-present Facebook. All Rights Reserved. + * @flow */ 'use strict'; diff --git a/Examples/UIExplorer/WebViewExample.js b/Examples/UIExplorer/WebViewExample.js index 28246cdc3b..e1a5ee74a6 100644 --- a/Examples/UIExplorer/WebViewExample.js +++ b/Examples/UIExplorer/WebViewExample.js @@ -1,5 +1,6 @@ /** * Copyright 2004-present Facebook. All Rights Reserved. + * @flow */ 'use strict'; @@ -35,6 +36,8 @@ var WebViewExample = React.createClass({ }; }, + inputText: '', + handleTextInputChange: function(event) { this.inputText = event.nativeEvent.text; }, @@ -259,6 +262,6 @@ exports.description = 'Base component to display web content'; exports.examples = [ { title: 'WebView', - render() { return ; } + render(): ReactElement { return ; } } ]; diff --git a/Libraries/Components/StatusBar/StatusBarIOS.ios.js b/Libraries/Components/StatusBar/StatusBarIOS.ios.js index 55cb1608c9..e88f83c23e 100644 --- a/Libraries/Components/StatusBar/StatusBarIOS.ios.js +++ b/Libraries/Components/StatusBar/StatusBarIOS.ios.js @@ -21,7 +21,7 @@ var StatusBarIOS = { slide: RCTStatusBarManager.Animation.slide, }, - setStyle(style: number, animated: boolean) { + setStyle(style: number, animated?: boolean) { animated = animated || false; RCTStatusBarManager.setStyle(style, animated); }, diff --git a/Libraries/Utilities/AlertIOS.js b/Libraries/Utilities/AlertIOS.js index 3b2530f18f..0836bd0871 100644 --- a/Libraries/Utilities/AlertIOS.js +++ b/Libraries/Utilities/AlertIOS.js @@ -43,7 +43,7 @@ class AlertIOS { */ static alert( title: ?string, - message: ?string, + message?: ?string, buttons?: Array<{ text: ?string; onPress: ?Function;