diff --git a/Examples/UIExplorer/js/FlatListExample.js b/Examples/UIExplorer/js/FlatListExample.js index cbb307e34..2dac3dd14 100644 --- a/Examples/UIExplorer/js/FlatListExample.js +++ b/Examples/UIExplorer/js/FlatListExample.js @@ -198,7 +198,7 @@ class FlatListExample extends React.PureComponent { this._listRef.getNode().recordInteraction(); pressItem(this, key); }; - _listRef: FlatList<*>; + _listRef: AnimatedFlatList; } diff --git a/Examples/UIExplorer/js/NativeAnimationsExample.js b/Examples/UIExplorer/js/NativeAnimationsExample.js index cbf0b7b39..d9550530e 100644 --- a/Examples/UIExplorer/js/NativeAnimationsExample.js +++ b/Examples/UIExplorer/js/NativeAnimationsExample.js @@ -49,7 +49,7 @@ class Tester extends React.Component { this.current && this.props.reverseConfig ? this.props.reverseConfig : this.props.config ); this.current = this.current ? 0 : 1; - const config = { + const config: Object = { ...animConfig, toValue: this.current, }; diff --git a/Examples/UIExplorer/js/ScrollViewExample.js b/Examples/UIExplorer/js/ScrollViewExample.js index 37aa60f5c..1435c0319 100644 --- a/Examples/UIExplorer/js/ScrollViewExample.js +++ b/Examples/UIExplorer/js/ScrollViewExample.js @@ -71,7 +71,7 @@ exports.examples = [ description: 'You can display \'s child components horizontally rather than vertically', render: function() { - function renderScrollView(title: string, addtionalStyles: StyleSheet) { + function renderScrollView(title: string, addtionalStyles: typeof StyleSheet) { var _scrollView: ScrollView; return ( diff --git a/Libraries/Components/Picker/Picker.js b/Libraries/Components/Picker/Picker.js index a85dd7a65..e5aa68939 100644 --- a/Libraries/Components/Picker/Picker.js +++ b/Libraries/Components/Picker/Picker.js @@ -33,6 +33,44 @@ var pickerStyleType = StyleSheetPropType({ var MODE_DIALOG = 'dialog'; var MODE_DROPDOWN = 'dropdown'; +/** + * Individual selectable item in a Picker. + */ +class PickerItem extends React.Component { + props: { + label: string, + value?: any, + color?: ColorPropType, + testID?: string, + }; + + static propTypes = { + /** + * Text to display for this item. + */ + label: React.PropTypes.string.isRequired, + /** + * The value to be passed to picker's `onValueChange` callback when + * this item is selected. Can be a string or an integer. + */ + value: React.PropTypes.any, + /** + * Color of this item's text. + * @platform android + */ + color: ColorPropType, + /** + * Used to locate the item in end-to-end tests. + */ + testID: React.PropTypes.string, + }; + + render() { + // The items are not rendered directly + throw null; + } +} + /** * Renders the native picker component on iOS and Android. Example: * @@ -65,6 +103,8 @@ class Picker extends React.Component { */ static MODE_DROPDOWN = MODE_DROPDOWN; + static Item = PickerItem; + static defaultProps = { mode: MODE_DIALOG, }; @@ -127,43 +167,4 @@ class Picker extends React.Component { } } -/** - * Individual selectable item in a Picker. - */ -// $FlowFixMe found when converting React.createClass to ES6 -Picker.Item = class extends React.Component { - props: { - label: string, - value?: any, - color?: ColorPropType, - testID?: string, - }; - - static propTypes = { - /** - * Text to display for this item. - */ - label: React.PropTypes.string.isRequired, - /** - * The value to be passed to picker's `onValueChange` callback when - * this item is selected. Can be a string or an integer. - */ - value: React.PropTypes.any, - /** - * Color of this item's text. - * @platform android - */ - color: ColorPropType, - /** - * Used to locate the item in end-to-end tests. - */ - testID: React.PropTypes.string, - }; - - render() { - // The items are not rendered directly - throw null; - } -}; - module.exports = Picker; diff --git a/Libraries/Experimental/SwipeableRow/SwipeableListView.js b/Libraries/Experimental/SwipeableRow/SwipeableListView.js index b62addd04..953810447 100644 --- a/Libraries/Experimental/SwipeableRow/SwipeableListView.js +++ b/Libraries/Experimental/SwipeableRow/SwipeableListView.js @@ -18,6 +18,11 @@ const SwipeableRow = require('SwipeableRow'); const {PropTypes} = React; +type DefaultProps = { + bounceFirstRowOnMount: boolean, + renderQuickActions: Function, +}; + type Props = { bounceFirstRowOnMount: boolean, dataSource: SwipeableListViewDataSource, @@ -49,7 +54,7 @@ type State = { * - It can bounce the 1st row of the list so users know it's swipeable * - More to come */ -class SwipeableListView extends React.Component { +class SwipeableListView extends React.Component { props: Props; state: State; diff --git a/Libraries/Image/Image.android.js b/Libraries/Image/Image.android.js index dea4fac54..4820d7570 100644 --- a/Libraries/Image/Image.android.js +++ b/Libraries/Image/Image.android.js @@ -194,7 +194,7 @@ var Image = React.createClass({ getSize( url: string, success: (width: number, height: number) => void, - failure: (error: any) => void, + failure?: (error: any) => void, ) { return ImageLoader.getSize(url) .then(function(sizes) { diff --git a/Libraries/Image/Image.ios.js b/Libraries/Image/Image.ios.js index 3177b1f5e..bba7a8999 100644 --- a/Libraries/Image/Image.ios.js +++ b/Libraries/Image/Image.ios.js @@ -304,7 +304,7 @@ const Image = React.createClass({ getSize: function( uri: string, success: (width: number, height: number) => void, - failure: (error: any) => void, + failure?: (error: any) => void, ) { ImageViewManager.getSize(uri, success, failure || function() { console.warn('Failed to get size for image: ' + uri); diff --git a/Libraries/react-native/react-native-implementation.js b/Libraries/react-native/react-native-implementation.js index d64353492..8f61726e7 100644 --- a/Libraries/react-native/react-native-implementation.js +++ b/Libraries/react-native/react-native-implementation.js @@ -7,24 +7,11 @@ * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule react-native-implementation - * @noflow - get/set properties not yet supported by flow. also `...require(x)` is broken #6560135 + * @flow */ 'use strict'; const invariant = require('fbjs/lib/invariant'); -const warning = require('fbjs/lib/warning'); - -if (__DEV__) { - var warningDedupe = {}; - var addonWarn = function(prevName, newPackageName) { - warning( - warningDedupe[prevName], - 'React.addons.' + prevName + ' is deprecated. Please import the "' + - newPackageName + '" package instead.' - ); - warningDedupe[prevName] = true; - }; -} // Export React, plus some native additions. const ReactNative = { @@ -118,6 +105,7 @@ const ReactNative = { get Platform() { return require('Platform'); }, get processColor() { return require('processColor'); }, get requireNativeComponent() { return require('requireNativeComponent'); }, + get takeSnapshot() { return require('takeSnapshot'); }, // Prop Types get ColorPropType() { return require('ColorPropType'); }, @@ -133,7 +121,6 @@ const ReactNative = { 'and imported from `react-native-deprecated-custom-components` instead of `react-native`. ' + 'Learn about alternative navigation solutions at http://facebook.github.io/react-native/docs/navigation.html' ); - return null; }, };