diff --git a/Examples/2048/Game2048.js b/Examples/2048/Game2048.js index a6e041ceb..9fd6052c9 100644 --- a/Examples/2048/Game2048.js +++ b/Examples/2048/Game2048.js @@ -150,7 +150,7 @@ class Game2048 extends React.Component { startX: number; startY: number; - constructor(props) { + constructor(props: {}) { super(props); this.state = { board: new GameBoard(), diff --git a/Examples/UIExplorer/ExampleTypes.js b/Examples/UIExplorer/ExampleTypes.js new file mode 100644 index 000000000..7f6ff08d8 --- /dev/null +++ b/Examples/UIExplorer/ExampleTypes.js @@ -0,0 +1,30 @@ +/** + * The examples provided by Facebook are for non-commercial testing and + * evaluation purposes only. + * + * Facebook reserves all rights not expressly granted. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL + * FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * @providesModule ExampleTypes + * @flow + */ + +export type Example = { + title: string, + render: () => ?ReactElement, + description?: string, +}; + +export type ExampleModule = { + title: string; + description: string; + examples: Array; + external?: bool; +}; + diff --git a/Examples/UIExplorer/MapViewExample.js b/Examples/UIExplorer/MapViewExample.js index ab6bd0717..e8dae25ac 100644 --- a/Examples/UIExplorer/MapViewExample.js +++ b/Examples/UIExplorer/MapViewExample.js @@ -168,7 +168,7 @@ var MapViewExample = React.createClass({ /> ); diff --git a/Examples/UIExplorer/PointerEventsExample.js b/Examples/UIExplorer/PointerEventsExample.js index 035f75814..cd402c471 100644 --- a/Examples/UIExplorer/PointerEventsExample.js +++ b/Examples/UIExplorer/PointerEventsExample.js @@ -181,7 +181,13 @@ var BoxOnlyExample = React.createClass({ } }); -var exampleClasses = [ +type ExampleClass = { + Component: ReactClass, + title: string, + description: string, +}; + +var exampleClasses: Array = [ { Component: NoneExample, title: '`none`', diff --git a/Examples/UIExplorer/UIExplorerList.js b/Examples/UIExplorer/UIExplorerList.js index dd2336df5..948ac6f08 100644 --- a/Examples/UIExplorer/UIExplorerList.js +++ b/Examples/UIExplorer/UIExplorerList.js @@ -30,6 +30,8 @@ var { var { TestModule } = React.addons; var Settings = require('Settings'); +import type { Example, ExampleModule } from 'ExampleTypes'; + var createExamplePage = require('./createExamplePage'); var COMPONENTS = [ @@ -107,9 +109,17 @@ COMPONENTS.concat(APIS).forEach((Example) => { } }); -class UIExplorerList extends React.Component { +type Props = { + navigator: Array<{title: string, component: ReactClass}>, + onExternalExampleRequested: Function, +}; - constructor(props) { + + +class UIExplorerList extends React.Component { + props: Props; + + constructor(props: Props) { super(props); this.state = { dataSource: ds.cloneWithRowsAndSections({ @@ -149,7 +159,7 @@ class UIExplorerList extends React.Component { ); } - _renderSectionHeader(data, section) { + _renderSectionHeader(data: any, section: string) { return ( @@ -159,7 +169,7 @@ class UIExplorerList extends React.Component { ); } - _renderRow(example, i) { + _renderRow(example: ExampleModule, i: number) { return ( this._onPressRow(example)}> @@ -177,7 +187,7 @@ class UIExplorerList extends React.Component { ); } - _search(text) { + _search(text: mixed) { var regex = new RegExp(text, 'i'); var filter = (component) => regex.test(component.title); @@ -191,7 +201,7 @@ class UIExplorerList extends React.Component { Settings.set({searchText: text}); } - _onPressRow(example) { + _onPressRow(example: ExampleModule) { if (example.external) { this.props.onExternalExampleRequested(example); return; diff --git a/Examples/UIExplorer/createExamplePage.js b/Examples/UIExplorer/createExamplePage.js index c65ea7bf3..3d5a1ac88 100644 --- a/Examples/UIExplorer/createExamplePage.js +++ b/Examples/UIExplorer/createExamplePage.js @@ -23,16 +23,7 @@ var UIExplorerPage = require('./UIExplorerPage'); var invariant = require('invariant'); -class Example extends React.Component { - title: string; - description: string; -} - -type ExampleModule = { - title: string; - description: string; - examples: Array; -}; +import type { Example, ExampleModule } from 'ExampleTypes'; var createExamplePage = function(title: ?string, exampleModule: ExampleModule) : ReactClass { @@ -44,7 +35,7 @@ var createExamplePage = function(title: ?string, exampleModule: ExampleModule) description: exampleModule.description, }, - getBlock: function(example, i) { + getBlock: function(example: Example, i) { // Hack warning: This is a hack because the www UI explorer requires // renderComponent to be called. var originalRender = React.render; diff --git a/Libraries/CameraRoll/CameraRoll.js b/Libraries/CameraRoll/CameraRoll.js index 6acc949e5..0d008ae75 100644 --- a/Libraries/CameraRoll/CameraRoll.js +++ b/Libraries/CameraRoll/CameraRoll.js @@ -92,6 +92,8 @@ var getPhotosReturnChecker = createStrictShapeTypeChecker({ }); class CameraRoll { + + static GroupTypesOptions: Array; /** * Saves the image with tag `tag` to the camera roll. * diff --git a/Libraries/Utilities/PixelRatio.js b/Libraries/Utilities/PixelRatio.js index e6c96b7fa..a3e4d9e77 100644 --- a/Libraries/Utilities/PixelRatio.js +++ b/Libraries/Utilities/PixelRatio.js @@ -67,9 +67,9 @@ class PixelRatio { static getPixelSizeForLayoutSize(layoutSize: number): number { return Math.round(layoutSize * PixelRatio.get()); } + + // No-op for iOS, but used on the web. Should not be documented. + static startDetecting() {} } -// No-op for iOS, but used on the web. Should not be documented. -PixelRatio.startDetecting = function() {}; - module.exports = PixelRatio;