From 6564edce5e828685099957741db935cda029ca23 Mon Sep 17 00:00:00 2001 From: Brian Vaughn Date: Wed, 12 Apr 2017 16:09:48 -0700 Subject: [PATCH] Ran PropTypes -> prop-types codemod against Libraries/FBReactKit/js/react-native-github Reviewed By: acdlite Differential Revision: D4876709 fbshipit-source-id: 3a5e92bfc74287b7a9054546c438580bed0147af --- Examples/UIExplorer/js/CameraRollView.js | 11 ++++--- Examples/UIExplorer/js/LinkingExample.js | 3 +- Examples/UIExplorer/js/UIExplorerBlock.js | 5 +-- Examples/UIExplorer/js/UIExplorerButton.js | 3 +- Examples/UIExplorer/js/UIExplorerPage.js | 5 +-- .../IntegrationTestHarnessTest.js | 5 +-- Libraries/ART/ReactNativeART.js | 5 +-- .../ActivityIndicator/ActivityIndicator.js | 4 +-- Libraries/Components/Button.js | 11 ++++--- .../DatePicker/DatePickerIOS.ios.js | 4 +-- .../DrawerLayoutAndroid.android.js | 24 +++++++------- .../Keyboard/KeyboardAvoidingView.js | 4 +-- Libraries/Components/LazyRenderer.js | 3 +- .../Components/Navigation/NavigatorIOS.ios.js | 12 +++---- Libraries/Components/Picker/Picker.js | 19 ++++++----- Libraries/Components/Picker/PickerIOS.ios.js | 11 ++++--- .../ProgressBarAndroid.android.js | 13 ++++---- .../ProgressViewIOS/ProgressViewIOS.ios.js | 5 ++- .../RefreshControl/RefreshControl.js | 15 +++++---- .../SegmentedControlIOS.ios.js | 5 ++- Libraries/Components/Slider/Slider.js | 5 ++- Libraries/Components/StaticRenderer.js | 6 ++-- Libraries/Components/StatusBar/StatusBar.js | 13 ++++---- Libraries/Components/Switch/Switch.js | 3 +- .../Components/TabBarIOS/TabBarIOS.ios.js | 5 +-- .../Components/TabBarIOS/TabBarItemIOS.ios.js | 19 ++++++----- Libraries/Components/TextInput/TextInput.js | 11 +++---- .../ToolbarAndroid/ToolbarAndroid.android.js | 33 +++++++++---------- .../Components/Touchable/TouchableBounce.js | 13 ++++---- .../Touchable/TouchableHighlight.js | 11 ++++--- .../TouchableNativeFeedback.android.js | 7 ++-- .../Components/Touchable/TouchableOpacity.js | 7 ++-- .../Touchable/TouchableWithoutFeedback.js | 29 ++++++++-------- Libraries/Components/View/View.js | 3 +- .../ViewPager/ViewPagerAndroid.android.js | 5 ++- .../Components/WebView/WebView.android.js | 6 ++-- Libraries/Components/WebView/WebView.ios.js | 4 +-- Libraries/Experimental/Incremental.js | 6 ++-- Libraries/Experimental/IncrementalGroup.js | 6 ++-- .../Experimental/IncrementalPresenter.js | 13 ++++---- .../SwipeableQuickActionButton.js | 3 +- .../Experimental/SwipeableRow/SwipeableRow.js | 3 +- Libraries/Image/Image.android.js | 6 ++-- Libraries/Image/Image.ios.js | 3 +- Libraries/Inspector/ElementProperties.js | 3 +- Libraries/Inspector/InspectorOverlay.js | 3 +- Libraries/Inspector/InspectorPanel.js | 3 +- Libraries/Lists/ListView/ListView.js | 13 ++++---- Libraries/Modal/Modal.js | 5 ++- Libraries/RCTTest/SnapshotViewIOS.ios.js | 5 +-- .../__tests__/ReactNativeEvents-test.js | 2 +- .../ReactIncrementalErrorHandling-test.js | 6 ++-- Libraries/Text/Text.js | 3 +- .../components/KeyboardSpacer.js | 3 +- website/core/Header.js | 4 ++- website/core/HeaderWithGithub.js | 4 ++- website/core/SnackPlayer.js | 4 ++- website/layout/AutodocsLayout.js | 5 +-- website/layout/DocsLayout.js | 5 +-- website/layout/PageLayout.js | 3 +- website/src/react-native/support.js | 3 +- 61 files changed, 235 insertions(+), 226 deletions(-) diff --git a/Examples/UIExplorer/js/CameraRollView.js b/Examples/UIExplorer/js/CameraRollView.js index e3a9572e2..bf695d3a5 100644 --- a/Examples/UIExplorer/js/CameraRollView.js +++ b/Examples/UIExplorer/js/CameraRollView.js @@ -24,6 +24,7 @@ 'use strict'; var React = require('react'); +const PropTypes = require('prop-types'); var ReactNative = require('react-native'); var { ActivityIndicator, @@ -46,7 +47,7 @@ var propTypes = { * values are 'Album', 'All', 'Event', 'Faces', 'Library', 'PhotoStream' * and SavedPhotos. */ - groupTypes: React.PropTypes.oneOf([ + groupTypes: PropTypes.oneOf([ 'Album', 'All', 'Event', @@ -59,22 +60,22 @@ var propTypes = { /** * Number of images that will be fetched in one page. */ - batchSize: React.PropTypes.number, + batchSize: PropTypes.number, /** * A function that takes a single image as a parameter and renders it. */ - renderImage: React.PropTypes.func, + renderImage: PropTypes.func, /** * imagesPerRow: Number of images to be shown in each row. */ - imagesPerRow: React.PropTypes.number, + imagesPerRow: PropTypes.number, /** * The asset type, one of 'Photos', 'Videos' or 'All' */ - assetType: React.PropTypes.oneOf([ + assetType: PropTypes.oneOf([ 'Photos', 'Videos', 'All', diff --git a/Examples/UIExplorer/js/LinkingExample.js b/Examples/UIExplorer/js/LinkingExample.js index ae2de7b12..0bda4bb35 100644 --- a/Examples/UIExplorer/js/LinkingExample.js +++ b/Examples/UIExplorer/js/LinkingExample.js @@ -22,6 +22,7 @@ 'use strict'; var React = require('react'); +var PropTypes = require('prop-types'); var ReactNative = require('react-native'); var { Linking, @@ -34,7 +35,7 @@ var UIExplorerBlock = require('./UIExplorerBlock'); class OpenURLButton extends React.Component { static propTypes = { - url: React.PropTypes.string, + url: PropTypes.string, }; handleClick = () => { diff --git a/Examples/UIExplorer/js/UIExplorerBlock.js b/Examples/UIExplorer/js/UIExplorerBlock.js index 4002ab3e8..d71595a3d 100644 --- a/Examples/UIExplorer/js/UIExplorerBlock.js +++ b/Examples/UIExplorer/js/UIExplorerBlock.js @@ -24,6 +24,7 @@ 'use strict'; var React = require('react'); +var PropTypes = require('prop-types'); var ReactNative = require('react-native'); var { StyleSheet, @@ -38,8 +39,8 @@ class UIExplorerBlock extends React.Component { }; static propTypes = { - title: React.PropTypes.string, - description: React.PropTypes.string, + title: PropTypes.string, + description: PropTypes.string, }; state = {description: (null: ?string)}; diff --git a/Examples/UIExplorer/js/UIExplorerButton.js b/Examples/UIExplorer/js/UIExplorerButton.js index 45e90aaba..9bbf09d94 100644 --- a/Examples/UIExplorer/js/UIExplorerButton.js +++ b/Examples/UIExplorer/js/UIExplorerButton.js @@ -24,6 +24,7 @@ 'use strict'; var React = require('react'); +var PropTypes = require('prop-types'); var ReactNative = require('react-native'); var { StyleSheet, @@ -35,7 +36,7 @@ class UIExplorerButton extends React.Component { props: {onPress?: Function}; static propTypes = { - onPress: React.PropTypes.func, + onPress: PropTypes.func, }; render() { diff --git a/Examples/UIExplorer/js/UIExplorerPage.js b/Examples/UIExplorer/js/UIExplorerPage.js index c2f75858b..03be9105a 100644 --- a/Examples/UIExplorer/js/UIExplorerPage.js +++ b/Examples/UIExplorer/js/UIExplorerPage.js @@ -24,6 +24,7 @@ 'use strict'; var React = require('react'); +var PropTypes = require('prop-types'); var ReactNative = require('react-native'); var { ScrollView, @@ -40,8 +41,8 @@ class UIExplorerPage extends React.Component { }; static propTypes = { - noScroll: React.PropTypes.bool, - noSpacer: React.PropTypes.bool, + noScroll: PropTypes.bool, + noSpacer: PropTypes.bool, }; render() { diff --git a/IntegrationTests/IntegrationTestHarnessTest.js b/IntegrationTests/IntegrationTestHarnessTest.js index d93b4f2ea..5d01dc380 100644 --- a/IntegrationTests/IntegrationTestHarnessTest.js +++ b/IntegrationTests/IntegrationTestHarnessTest.js @@ -13,6 +13,7 @@ var requestAnimationFrame = require('fbjs/lib/requestAnimationFrame'); var React = require('react'); +var PropTypes = require('prop-types'); var ReactNative = require('react-native'); var { Text, @@ -27,8 +28,8 @@ class IntegrationTestHarnessTest extends React.Component { }; static propTypes = { - shouldThrow: React.PropTypes.bool, - waitOneFrame: React.PropTypes.bool, + shouldThrow: PropTypes.bool, + waitOneFrame: PropTypes.bool, }; state = { diff --git a/Libraries/ART/ReactNativeART.js b/Libraries/ART/ReactNativeART.js index 419fde983..dbf9d09b2 100644 --- a/Libraries/ART/ReactNativeART.js +++ b/Libraries/ART/ReactNativeART.js @@ -15,6 +15,7 @@ var Path = require('ARTSerializablePath'); var Transform = require('art/core/transform'); var React = require('React'); +var PropTypes = require('prop-types'); var ReactNativeViewAttributes = require('ReactNativeViewAttributes'); var createReactNativeComponentClass = require('createReactNativeComponentClass'); @@ -139,7 +140,7 @@ function childrenAsString(children) { class Surface extends React.Component { static childContextTypes = { - isInSurface: React.PropTypes.bool, + isInSurface: PropTypes.bool, }; getChildContext() { @@ -213,7 +214,7 @@ function extractOpacity(props) { class Group extends React.Component { static contextTypes = { - isInSurface: React.PropTypes.bool.isRequired, + isInSurface: PropTypes.bool.isRequired, }; render() { diff --git a/Libraries/Components/ActivityIndicator/ActivityIndicator.js b/Libraries/Components/ActivityIndicator/ActivityIndicator.js index 8676f897a..68dc82b39 100644 --- a/Libraries/Components/ActivityIndicator/ActivityIndicator.js +++ b/Libraries/Components/ActivityIndicator/ActivityIndicator.js @@ -15,15 +15,13 @@ const ColorPropType = require('ColorPropType'); const NativeMethodsMixin = require('NativeMethodsMixin'); const Platform = require('Platform'); const React = require('React'); +const PropTypes = require('prop-types'); const StyleSheet = require('StyleSheet'); const View = require('View'); - const ViewPropTypes = require('ViewPropTypes'); const requireNativeComponent = require('requireNativeComponent'); -const PropTypes = React.PropTypes; - const GRAY = '#999999'; type IndicatorSize = number | 'small' | 'large'; diff --git a/Libraries/Components/Button.js b/Libraries/Components/Button.js index eea0b1ffc..b6692afb2 100644 --- a/Libraries/Components/Button.js +++ b/Libraries/Components/Button.js @@ -14,6 +14,7 @@ const ColorPropType = require('ColorPropType'); const Platform = require('Platform'); const React = require('React'); +const PropTypes = require('prop-types'); const StyleSheet = require('StyleSheet'); const Text = require('Text'); const TouchableNativeFeedback = require('TouchableNativeFeedback'); @@ -62,11 +63,11 @@ class Button extends React.Component { /** * Text to display inside the button */ - title: React.PropTypes.string.isRequired, + title: PropTypes.string.isRequired, /** * Text to display for blindness accessibility features */ - accessibilityLabel: React.PropTypes.string, + accessibilityLabel: PropTypes.string, /** * Color of the text (iOS), or background color of the button (Android) */ @@ -74,15 +75,15 @@ class Button extends React.Component { /** * If true, disable all interactions for this component. */ - disabled: React.PropTypes.bool, + disabled: PropTypes.bool, /** * Handler to be called when the user taps the button */ - onPress: React.PropTypes.func.isRequired, + onPress: PropTypes.func.isRequired, /** * Used to locate this view in end-to-end tests. */ - testID: React.PropTypes.string, + testID: PropTypes.string, }; render() { diff --git a/Libraries/Components/DatePicker/DatePickerIOS.ios.js b/Libraries/Components/DatePicker/DatePickerIOS.ios.js index 1d8dfd5bc..ccab7293d 100644 --- a/Libraries/Components/DatePicker/DatePickerIOS.ios.js +++ b/Libraries/Components/DatePicker/DatePickerIOS.ios.js @@ -15,15 +15,13 @@ const NativeMethodsMixin = require('NativeMethodsMixin'); const React = require('React'); +const PropTypes = require('prop-types'); const StyleSheet = require('StyleSheet'); const View = require('View'); - const ViewPropTypes = require('ViewPropTypes'); const requireNativeComponent = require('requireNativeComponent'); -const PropTypes = React.PropTypes; - type DefaultProps = { mode: 'date' | 'time' | 'datetime', }; diff --git a/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js b/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js index 6fcca0f53..2f697587c 100644 --- a/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js +++ b/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js @@ -14,21 +14,19 @@ var ColorPropType = require('ColorPropType'); var NativeMethodsMixin = require('NativeMethodsMixin'); var Platform = require('Platform'); var React = require('React'); +var PropTypes = require('prop-types'); var ReactNative = require('ReactNative'); var StatusBar = require('StatusBar'); var StyleSheet = require('StyleSheet'); var UIManager = require('UIManager'); var View = require('View'); - -const ViewPropTypes = require('ViewPropTypes'); +var ViewPropTypes = require('ViewPropTypes'); var DrawerConsts = UIManager.AndroidDrawerLayout.Constants; var dismissKeyboard = require('dismissKeyboard'); var requireNativeComponent = require('requireNativeComponent'); -var ReactPropTypes = React.PropTypes; - var RK_DRAWER_REF = 'drawerlayout'; var INNERVIEW_REF = 'innerView'; @@ -81,7 +79,7 @@ var DrawerLayoutAndroid = React.createClass({ * - 'none' (the default), drags do not dismiss the keyboard. * - 'on-drag', the keyboard is dismissed when a drag begins. */ - keyboardDismissMode: ReactPropTypes.oneOf([ + keyboardDismissMode: PropTypes.oneOf([ 'none', // default 'on-drag', ]), @@ -100,7 +98,7 @@ var DrawerLayoutAndroid = React.createClass({ /** * Specifies the side of the screen from which the drawer will slide in. */ - drawerPosition: ReactPropTypes.oneOf([ + drawerPosition: PropTypes.oneOf([ DrawerConsts.DrawerPosition.Left, DrawerConsts.DrawerPosition.Right ]), @@ -108,7 +106,7 @@ var DrawerLayoutAndroid = React.createClass({ * Specifies the width of the drawer, more precisely the width of the view that be pulled in * from the edge of the window. */ - drawerWidth: ReactPropTypes.number, + drawerWidth: PropTypes.number, /** * Specifies the lock mode of the drawer. The drawer can be locked in 3 states: * - unlocked (default), meaning that the drawer will respond (open/close) to touch gestures. @@ -116,7 +114,7 @@ var DrawerLayoutAndroid = React.createClass({ * - locked-open, meaning that the drawer will stay opened and not respond to gestures. * The drawer may still be opened and closed programmatically (`openDrawer`/`closeDrawer`). */ - drawerLockMode: ReactPropTypes.oneOf([ + drawerLockMode: PropTypes.oneOf([ 'unlocked', 'locked-closed', 'locked-open' @@ -124,7 +122,7 @@ var DrawerLayoutAndroid = React.createClass({ /** * Function called whenever there is an interaction with the navigation view. */ - onDrawerSlide: ReactPropTypes.func, + onDrawerSlide: PropTypes.func, /** * Function called when the drawer state has changed. The drawer can be in 3 states: * - idle, meaning there is no interaction with the navigation view happening at the time @@ -132,19 +130,19 @@ var DrawerLayoutAndroid = React.createClass({ * - settling, meaning that there was an interaction with the navigation view, and the * navigation view is now finishing its closing or opening animation */ - onDrawerStateChanged: ReactPropTypes.func, + onDrawerStateChanged: PropTypes.func, /** * Function called whenever the navigation view has been opened. */ - onDrawerOpen: ReactPropTypes.func, + onDrawerOpen: PropTypes.func, /** * Function called whenever the navigation view has been closed. */ - onDrawerClose: ReactPropTypes.func, + onDrawerClose: PropTypes.func, /** * The navigation view that will be rendered to the side of the screen and can be pulled in. */ - renderNavigationView: ReactPropTypes.func.isRequired, + renderNavigationView: PropTypes.func.isRequired, /** * Make the drawer take the entire screen and draw the background of the diff --git a/Libraries/Components/Keyboard/KeyboardAvoidingView.js b/Libraries/Components/Keyboard/KeyboardAvoidingView.js index ad310e503..7d4db39dd 100644 --- a/Libraries/Components/Keyboard/KeyboardAvoidingView.js +++ b/Libraries/Components/Keyboard/KeyboardAvoidingView.js @@ -15,13 +15,11 @@ const Keyboard = require('Keyboard'); const LayoutAnimation = require('LayoutAnimation'); const Platform = require('Platform'); const React = require('React'); +const PropTypes = require('prop-types'); const TimerMixin = require('react-timer-mixin'); const View = require('View'); - const ViewPropTypes = require('ViewPropTypes'); -const PropTypes = React.PropTypes; - import type EmitterSubscription from 'EmitterSubscription'; type Rect = { diff --git a/Libraries/Components/LazyRenderer.js b/Libraries/Components/LazyRenderer.js index f3bfd6b1b..95cafbd16 100644 --- a/Libraries/Components/LazyRenderer.js +++ b/Libraries/Components/LazyRenderer.js @@ -11,13 +11,14 @@ 'use strict'; var React = require('React'); +var PropTypes = require('prop-types'); var TimerMixin = require('react-timer-mixin'); var LazyRenderer = React.createClass({ mixin: [TimerMixin], propTypes: { - render: React.PropTypes.func.isRequired, + render: PropTypes.func.isRequired, }, componentWillMount: function(): void { diff --git a/Libraries/Components/Navigation/NavigatorIOS.ios.js b/Libraries/Components/Navigation/NavigatorIOS.ios.js index 3b5697371..1cb90eeaf 100644 --- a/Libraries/Components/Navigation/NavigatorIOS.ios.js +++ b/Libraries/Components/Navigation/NavigatorIOS.ios.js @@ -15,13 +15,13 @@ var EventEmitter = require('EventEmitter'); var Image = require('Image'); var RCTNavigatorManager = require('NativeModules').NavigatorManager; var React = require('React'); +var PropTypes = require('prop-types'); var ReactNative = require('ReactNative'); var StaticContainer = require('StaticContainer.react'); var StyleSheet = require('StyleSheet'); var TVEventHandler = require('TVEventHandler'); var View = require('View'); - -const ViewPropTypes = require('ViewPropTypes'); +var ViewPropTypes = require('ViewPropTypes'); var invariant = require('fbjs/lib/invariant'); var logError = require('logError'); @@ -31,8 +31,6 @@ const keyMirror = require('fbjs/lib/keyMirror'); var TRANSITIONER_REF = 'transitionerRef'; -var PropTypes = React.PropTypes; - var __uid = 0; function getuid() { return __uid++; @@ -134,7 +132,7 @@ type Event = Object; * animations and behavior from UIKIt. * * As the name implies, it is only available on iOS. Take a look at - * [`React Navigation`](https://reactnavigation.org/) for a cross-platform + * [`React Navigation`](https://reactnavigation.org/) for a cross-platform * solution in JavaScript, or check out either of these components for native * solutions: [native-navigation](http://airbnb.io/native-navigation/), * [react-native-navigation](https://github.com/wix/react-native-navigation). @@ -589,8 +587,8 @@ var NavigatorIOS = React.createClass({ }, childContextTypes: { - onFocusRequested: React.PropTypes.func, - focusEmitter: React.PropTypes.instanceOf(EventEmitter), + onFocusRequested: PropTypes.func, + focusEmitter: PropTypes.instanceOf(EventEmitter), }, _tryLockNavigator: function(cb: () => void) { diff --git a/Libraries/Components/Picker/Picker.js b/Libraries/Components/Picker/Picker.js index e5aa68939..5fa62bdfa 100644 --- a/Libraries/Components/Picker/Picker.js +++ b/Libraries/Components/Picker/Picker.js @@ -17,6 +17,7 @@ var PickerIOS = require('PickerIOS'); var PickerAndroid = require('PickerAndroid'); var Platform = require('Platform'); var React = require('React'); +const PropTypes = require('prop-types'); var StyleSheetPropType = require('StyleSheetPropType'); var TextStylePropTypes = require('TextStylePropTypes'); var UnimplementedView = require('UnimplementedView'); @@ -48,12 +49,12 @@ class PickerItem extends React.Component { /** * Text to display for this item. */ - label: React.PropTypes.string.isRequired, + label: 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, + value: PropTypes.any, /** * Color of this item's text. * @platform android @@ -62,7 +63,7 @@ class PickerItem extends React.Component { /** * Used to locate the item in end-to-end tests. */ - testID: React.PropTypes.string, + testID: PropTypes.string, }; render() { @@ -116,19 +117,19 @@ class Picker extends React.Component { /** * Value matching value of one of the items. Can be a string or an integer. */ - selectedValue: React.PropTypes.any, + selectedValue: PropTypes.any, /** * Callback for when an item is selected. This is called with the following parameters: * - `itemValue`: the `value` prop of the item that was selected * - `itemPosition`: the index of the selected item in this picker */ - onValueChange: React.PropTypes.func, + onValueChange: PropTypes.func, /** * If set to false, the picker will be disabled, i.e. the user will not be able to make a * selection. * @platform android */ - enabled: React.PropTypes.bool, + enabled: PropTypes.bool, /** * On Android, specifies how to display the selection items when the user taps on the picker: * @@ -137,7 +138,7 @@ class Picker extends React.Component { * * @platform android */ - mode: React.PropTypes.oneOf(['dialog', 'dropdown']), + mode: PropTypes.oneOf(['dialog', 'dropdown']), /** * Style to apply to each of the item labels. * @platform ios @@ -147,11 +148,11 @@ class Picker extends React.Component { * Prompt string for this picker, used on Android in dialog mode as the title of the dialog. * @platform android */ - prompt: React.PropTypes.string, + prompt: PropTypes.string, /** * Used to locate this view in end-to-end tests. */ - testID: React.PropTypes.string, + testID: PropTypes.string, }; render() { diff --git a/Libraries/Components/Picker/PickerIOS.ios.js b/Libraries/Components/Picker/PickerIOS.ios.js index 9bdacdddd..ec617510d 100644 --- a/Libraries/Components/Picker/PickerIOS.ios.js +++ b/Libraries/Components/Picker/PickerIOS.ios.js @@ -14,6 +14,7 @@ var NativeMethodsMixin = require('NativeMethodsMixin'); var React = require('React'); +const PropTypes = require('prop-types'); var StyleSheet = require('StyleSheet'); var StyleSheetPropType = require('StyleSheetPropType'); var TextStylePropTypes = require('TextStylePropTypes'); @@ -30,8 +31,8 @@ var PickerIOS = React.createClass({ propTypes: { ...ViewPropTypes, itemStyle: itemStylePropType, - onValueChange: React.PropTypes.func, - selectedValue: React.PropTypes.any, // string or integer basically + onValueChange: PropTypes.func, + selectedValue: PropTypes.any, // string or integer basically }, getInitialState: function() { @@ -99,9 +100,9 @@ var PickerIOS = React.createClass({ PickerIOS.Item = class extends React.Component { static propTypes = { - value: React.PropTypes.any, // string or integer basically - label: React.PropTypes.string, - color: React.PropTypes.string, + value: PropTypes.any, // string or integer basically + label: PropTypes.string, + color: PropTypes.string, }; render() { diff --git a/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.android.js b/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.android.js index a38c25c46..e3b0b6ee7 100644 --- a/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.android.js +++ b/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.android.js @@ -12,13 +12,12 @@ var NativeMethodsMixin = require('NativeMethodsMixin'); var React = require('React'); -const ViewPropTypes = require('ViewPropTypes'); +var PropTypes = require('prop-types'); +var ViewPropTypes = require('ViewPropTypes'); var ColorPropType = require('ColorPropType'); var requireNativeComponent = require('requireNativeComponent'); -var ReactPropTypes = React.PropTypes; - var STYLE_ATTRIBUTES = [ 'Horizontal', 'Normal', @@ -38,7 +37,7 @@ var indeterminateType = function(props, propName, componentName) { } }; - return ReactPropTypes.bool(props, propName, componentName) || checker(); + return PropTypes.bool(props, propName, componentName) || checker(); }; /** @@ -78,7 +77,7 @@ var ProgressBarAndroid = React.createClass({ * - SmallInverse * - LargeInverse */ - styleAttr: ReactPropTypes.oneOf(STYLE_ATTRIBUTES), + styleAttr: PropTypes.oneOf(STYLE_ATTRIBUTES), /** * If the progress bar will show indeterminate progress. Note that this * can only be false if styleAttr is Horizontal. @@ -87,7 +86,7 @@ var ProgressBarAndroid = React.createClass({ /** * The progress value (between 0 and 1). */ - progress: ReactPropTypes.number, + progress: PropTypes.number, /** * Color of the progress bar. */ @@ -95,7 +94,7 @@ var ProgressBarAndroid = React.createClass({ /** * Used to locate this view in end-to-end tests. */ - testID: ReactPropTypes.string, + testID: PropTypes.string, }, getDefaultProps: function() { diff --git a/Libraries/Components/ProgressViewIOS/ProgressViewIOS.ios.js b/Libraries/Components/ProgressViewIOS/ProgressViewIOS.ios.js index a8287f8b4..3d996cbbe 100644 --- a/Libraries/Components/ProgressViewIOS/ProgressViewIOS.ios.js +++ b/Libraries/Components/ProgressViewIOS/ProgressViewIOS.ios.js @@ -14,13 +14,12 @@ var Image = require('Image'); var NativeMethodsMixin = require('NativeMethodsMixin'); var React = require('React'); +var PropTypes = require('prop-types'); var StyleSheet = require('StyleSheet'); -const ViewPropTypes = require('ViewPropTypes'); +var ViewPropTypes = require('ViewPropTypes'); var requireNativeComponent = require('requireNativeComponent'); -var PropTypes = React.PropTypes; - /** * Use `ProgressViewIOS` to render a UIProgressView on iOS. */ diff --git a/Libraries/Components/RefreshControl/RefreshControl.js b/Libraries/Components/RefreshControl/RefreshControl.js index 02db53302..7736b06b1 100644 --- a/Libraries/Components/RefreshControl/RefreshControl.js +++ b/Libraries/Components/RefreshControl/RefreshControl.js @@ -15,6 +15,7 @@ const ColorPropType = require('ColorPropType'); const NativeMethodsMixin = require('NativeMethodsMixin'); const Platform = require('Platform'); const React = require('React'); +const PropTypes = require('prop-types'); const ViewPropTypes = require('ViewPropTypes'); const requireNativeComponent = require('requireNativeComponent'); @@ -83,11 +84,11 @@ const RefreshControl = React.createClass({ /** * Called when the view starts refreshing. */ - onRefresh: React.PropTypes.func, + onRefresh: PropTypes.func, /** * Whether the view should be indicating an active refresh. */ - refreshing: React.PropTypes.bool.isRequired, + refreshing: PropTypes.bool.isRequired, /** * The color of the refresh indicator. * @platform ios @@ -102,17 +103,17 @@ const RefreshControl = React.createClass({ * The title displayed under the refresh indicator. * @platform ios */ - title: React.PropTypes.string, + title: PropTypes.string, /** * Whether the pull to refresh functionality is enabled. * @platform android */ - enabled: React.PropTypes.bool, + enabled: PropTypes.bool, /** * The colors (at least one) that will be used to draw the refresh indicator. * @platform android */ - colors: React.PropTypes.arrayOf(ColorPropType), + colors: PropTypes.arrayOf(ColorPropType), /** * The background color of the refresh indicator. * @platform android @@ -122,12 +123,12 @@ const RefreshControl = React.createClass({ * Size of the refresh indicator, see RefreshControl.SIZE. * @platform android */ - size: React.PropTypes.oneOf([RefreshLayoutConsts.SIZE.DEFAULT, RefreshLayoutConsts.SIZE.LARGE]), + size: PropTypes.oneOf([RefreshLayoutConsts.SIZE.DEFAULT, RefreshLayoutConsts.SIZE.LARGE]), /** * Progress view top offset * @platform android */ - progressViewOffset: React.PropTypes.number, + progressViewOffset: PropTypes.number, }, _nativeRef: (null: any), diff --git a/Libraries/Components/SegmentedControlIOS/SegmentedControlIOS.ios.js b/Libraries/Components/SegmentedControlIOS/SegmentedControlIOS.ios.js index 9ac6f3cef..4fd6d0d1e 100644 --- a/Libraries/Components/SegmentedControlIOS/SegmentedControlIOS.ios.js +++ b/Libraries/Components/SegmentedControlIOS/SegmentedControlIOS.ios.js @@ -13,13 +13,12 @@ var NativeMethodsMixin = require('NativeMethodsMixin'); var React = require('React'); +var PropTypes = require('prop-types'); var StyleSheet = require('StyleSheet'); -const ViewPropTypes = require('ViewPropTypes'); +var ViewPropTypes = require('ViewPropTypes'); var requireNativeComponent = require('requireNativeComponent'); -var PropTypes = React.PropTypes; - type DefaultProps = { values: Array, enabled: boolean, diff --git a/Libraries/Components/Slider/Slider.js b/Libraries/Components/Slider/Slider.js index a6e03e8e2..ce0c39dca 100644 --- a/Libraries/Components/Slider/Slider.js +++ b/Libraries/Components/Slider/Slider.js @@ -17,13 +17,12 @@ var NativeMethodsMixin = require('NativeMethodsMixin'); var ReactNativeViewAttributes = require('ReactNativeViewAttributes'); var Platform = require('Platform'); var React = require('React'); +var PropTypes = require('prop-types'); var StyleSheet = require('StyleSheet'); -const ViewPropTypes = require('ViewPropTypes'); +var ViewPropTypes = require('ViewPropTypes'); var requireNativeComponent = require('requireNativeComponent'); -var PropTypes = React.PropTypes; - type Event = Object; /** diff --git a/Libraries/Components/StaticRenderer.js b/Libraries/Components/StaticRenderer.js index f65131854..afea94ebc 100644 --- a/Libraries/Components/StaticRenderer.js +++ b/Libraries/Components/StaticRenderer.js @@ -13,6 +13,8 @@ var React = require('React'); +var PropTypes = require('prop-types'); + class StaticRenderer extends React.Component { props: { shouldUpdate: boolean, @@ -20,8 +22,8 @@ class StaticRenderer extends React.Component { }; static propTypes = { - shouldUpdate: React.PropTypes.bool.isRequired, - render: React.PropTypes.func.isRequired, + shouldUpdate: PropTypes.bool.isRequired, + render: PropTypes.func.isRequired, }; shouldComponentUpdate(nextProps: { shouldUpdate: boolean }): boolean { diff --git a/Libraries/Components/StatusBar/StatusBar.js b/Libraries/Components/StatusBar/StatusBar.js index 1a4eb6a97..aae3f9214 100644 --- a/Libraries/Components/StatusBar/StatusBar.js +++ b/Libraries/Components/StatusBar/StatusBar.js @@ -12,6 +12,7 @@ 'use strict'; const React = require('React'); +const PropTypes = require('prop-types'); const ColorPropType = require('ColorPropType'); const Platform = require('Platform'); @@ -253,12 +254,12 @@ class StatusBar extends React.Component { /** * If the status bar is hidden. */ - hidden: React.PropTypes.bool, + hidden: PropTypes.bool, /** * If the transition between status bar property changes should be animated. * Supported for backgroundColor, barStyle and hidden. */ - animated: React.PropTypes.bool, + animated: PropTypes.bool, /** * The background color of the status bar. * @platform android @@ -271,11 +272,11 @@ class StatusBar extends React.Component { * * @platform android */ - translucent: React.PropTypes.bool, + translucent: PropTypes.bool, /** * Sets the color of the status bar text. */ - barStyle: React.PropTypes.oneOf([ + barStyle: PropTypes.oneOf([ 'default', 'light-content', 'dark-content', @@ -285,14 +286,14 @@ class StatusBar extends React.Component { * * @platform ios */ - networkActivityIndicatorVisible: React.PropTypes.bool, + networkActivityIndicatorVisible: PropTypes.bool, /** * The transition effect when showing and hiding the status bar using the `hidden` * prop. Defaults to 'fade'. * * @platform ios */ - showHideTransition: React.PropTypes.oneOf([ + showHideTransition: PropTypes.oneOf([ 'fade', 'slide', ]), diff --git a/Libraries/Components/Switch/Switch.js b/Libraries/Components/Switch/Switch.js index 04ed872dc..7cad1ac14 100644 --- a/Libraries/Components/Switch/Switch.js +++ b/Libraries/Components/Switch/Switch.js @@ -15,13 +15,12 @@ var ColorPropType = require('ColorPropType'); var NativeMethodsMixin = require('NativeMethodsMixin'); var Platform = require('Platform'); var React = require('React'); +const PropTypes = require('prop-types'); var StyleSheet = require('StyleSheet'); const ViewPropTypes = require('ViewPropTypes'); var requireNativeComponent = require('requireNativeComponent'); -var { PropTypes } = React; - type DefaultProps = { value: boolean, disabled: boolean, diff --git a/Libraries/Components/TabBarIOS/TabBarIOS.ios.js b/Libraries/Components/TabBarIOS/TabBarIOS.ios.js index 3ccabc582..10f0c028a 100644 --- a/Libraries/Components/TabBarIOS/TabBarIOS.ios.js +++ b/Libraries/Components/TabBarIOS/TabBarIOS.ios.js @@ -13,6 +13,7 @@ var ColorPropType = require('ColorPropType'); var React = require('React'); +const PropTypes = require('prop-types'); var StyleSheet = require('StyleSheet'); var TabBarItemIOS = require('TabBarItemIOS'); const ViewPropTypes = require('ViewPropTypes'); @@ -55,7 +56,7 @@ class TabBarIOS extends React.Component { /** * A Boolean value that indicates whether the tab bar is translucent */ - translucent: React.PropTypes.bool, + translucent: PropTypes.bool, /** * Specifies tab bar item positioning. Available values are: * - fill - distributes items across the entire width of the tab bar @@ -65,7 +66,7 @@ class TabBarIOS extends React.Component { * this value defaults to `fill`, in a horizontally regular one (e.g. iPad) * it defaults to center. */ - itemPositioning: React.PropTypes.oneOf(['fill', 'center', 'auto']), + itemPositioning: PropTypes.oneOf(['fill', 'center', 'auto']), }; render() { diff --git a/Libraries/Components/TabBarIOS/TabBarItemIOS.ios.js b/Libraries/Components/TabBarIOS/TabBarItemIOS.ios.js index 39eb95ab2..215c4f27e 100644 --- a/Libraries/Components/TabBarIOS/TabBarItemIOS.ios.js +++ b/Libraries/Components/TabBarIOS/TabBarItemIOS.ios.js @@ -14,6 +14,7 @@ var ColorPropType = require('ColorPropType'); var Image = require('Image'); var React = require('React'); +const PropTypes = require('prop-types'); var StaticContainer = require('StaticContainer.react'); var StyleSheet = require('StyleSheet'); var View = require('View'); @@ -28,9 +29,9 @@ class TabBarItemIOS extends React.Component { /** * Little red bubble that sits at the top right of the icon. */ - badge: React.PropTypes.oneOfType([ - React.PropTypes.string, - React.PropTypes.number, + badge: PropTypes.oneOfType([ + PropTypes.string, + PropTypes.number, ]), /** * Background color for the badge. Available since iOS 10. @@ -41,7 +42,7 @@ class TabBarItemIOS extends React.Component { * using them, the title and selectedIcon will be overridden with the * system ones. */ - systemIcon: React.PropTypes.oneOf([ + systemIcon: PropTypes.oneOf([ 'bookmarks', 'contacts', 'downloads', @@ -68,17 +69,17 @@ class TabBarItemIOS extends React.Component { * Callback when this tab is being selected, you should change the state of your * component to set selected={true}. */ - onPress: React.PropTypes.func, + onPress: PropTypes.func, /** * If set to true it renders the image as original, * it defaults to being displayed as a template */ - renderAsOriginal: React.PropTypes.bool, + renderAsOriginal: PropTypes.bool, /** * It specifies whether the children are visible or not. If you see a * blank content, you probably forgot to add a selected one. */ - selected: React.PropTypes.bool, + selected: PropTypes.bool, /** * React style object. */ @@ -87,14 +88,14 @@ class TabBarItemIOS extends React.Component { * Text that appears under the icon. It is ignored when a system icon * is defined. */ - title: React.PropTypes.string, + title: PropTypes.string, /** *(Apple TV only)* When set to true, this view will be focusable * and navigable using the Apple TV remote. * * @platform ios */ - isTVSelectable: React.PropTypes.bool, + isTVSelectable: PropTypes.bool, }; state = { diff --git a/Libraries/Components/TextInput/TextInput.js b/Libraries/Components/TextInput/TextInput.js index 20a060f8d..1f15e5d2e 100644 --- a/Libraries/Components/TextInput/TextInput.js +++ b/Libraries/Components/TextInput/TextInput.js @@ -17,6 +17,7 @@ const EventEmitter = require('EventEmitter'); const NativeMethodsMixin = require('NativeMethodsMixin'); const Platform = require('Platform'); const React = require('React'); +const PropTypes = require('prop-types'); const ReactNative = require('ReactNative'); const StyleSheet = require('StyleSheet'); const Text = require('Text'); @@ -31,8 +32,6 @@ const invariant = require('fbjs/lib/invariant'); const requireNativeComponent = require('requireNativeComponent'); const warning = require('fbjs/lib/warning'); -const PropTypes = React.PropTypes; - const onlyMultiline = { onTextInput: true, children: true, @@ -336,7 +335,7 @@ const TextInput = React.createClass({ * The default value is `simple`. * @platform android */ - textBreakStrategy: React.PropTypes.oneOf(['simple', 'highQuality', 'balanced']), + textBreakStrategy: PropTypes.oneOf(['simple', 'highQuality', 'balanced']), /** * Callback that is called when the text input is blurred. */ @@ -549,8 +548,8 @@ const TextInput = React.createClass({ }, contextTypes: { - onFocusRequested: React.PropTypes.func, - focusEmitter: React.PropTypes.instanceOf(EventEmitter), + onFocusRequested: PropTypes.func, + focusEmitter: PropTypes.instanceOf(EventEmitter), }, _inputRef: (undefined: any), @@ -593,7 +592,7 @@ const TextInput = React.createClass({ }, childContextTypes: { - isInAParentText: React.PropTypes.bool + isInAParentText: PropTypes.bool }, /** diff --git a/Libraries/Components/ToolbarAndroid/ToolbarAndroid.android.js b/Libraries/Components/ToolbarAndroid/ToolbarAndroid.android.js index 201c9c3fc..675738217 100644 --- a/Libraries/Components/ToolbarAndroid/ToolbarAndroid.android.js +++ b/Libraries/Components/ToolbarAndroid/ToolbarAndroid.android.js @@ -14,21 +14,20 @@ var Image = require('Image'); var NativeMethodsMixin = require('NativeMethodsMixin'); var React = require('React'); +var PropTypes = require('prop-types'); var ReactNativeViewAttributes = require('ReactNativeViewAttributes'); var UIManager = require('UIManager'); -const ViewPropTypes = require('ViewPropTypes'); +var ViewPropTypes = require('ViewPropTypes'); var ColorPropType = require('ColorPropType'); var requireNativeComponent = require('requireNativeComponent'); var resolveAssetSource = require('resolveAssetSource'); -var ReactPropTypes = React.PropTypes; - -var optionalImageSource = ReactPropTypes.oneOfType([ +var optionalImageSource = PropTypes.oneOfType([ Image.propTypes.source, // Image.propTypes.source is required but we want it to be optional, so we OR // it with a nullable propType. - ReactPropTypes.oneOf([]), + PropTypes.oneOf([]), ]); /** @@ -84,11 +83,11 @@ var ToolbarAndroid = React.createClass({ * `ifRoom` or `never` * * `showWithText`: boolean, whether to show text alongside the icon or not */ - actions: ReactPropTypes.arrayOf(ReactPropTypes.shape({ - title: ReactPropTypes.string.isRequired, + actions: PropTypes.arrayOf(PropTypes.shape({ + title: PropTypes.string.isRequired, icon: optionalImageSource, - show: ReactPropTypes.oneOf(['always', 'ifRoom', 'never']), - showWithText: ReactPropTypes.bool + show: PropTypes.oneOf(['always', 'ifRoom', 'never']), + showWithText: PropTypes.bool })), /** * Sets the toolbar logo. @@ -102,11 +101,11 @@ var ToolbarAndroid = React.createClass({ * Callback that is called when an action is selected. The only argument that is passed to the * callback is the position of the action in the actions array. */ - onActionSelected: ReactPropTypes.func, + onActionSelected: PropTypes.func, /** * Callback called when the icon is selected. */ - onIconClicked: ReactPropTypes.func, + onIconClicked: PropTypes.func, /** * Sets the overflow icon. */ @@ -114,7 +113,7 @@ var ToolbarAndroid = React.createClass({ /** * Sets the toolbar subtitle. */ - subtitle: ReactPropTypes.string, + subtitle: PropTypes.string, /** * Sets the toolbar subtitle color. */ @@ -122,7 +121,7 @@ var ToolbarAndroid = React.createClass({ /** * Sets the toolbar title. */ - title: ReactPropTypes.string, + title: PropTypes.string, /** * Sets the toolbar title color. */ @@ -135,7 +134,7 @@ var ToolbarAndroid = React.createClass({ * these components and can be used to effectively align Toolbar content * along well-known gridlines. */ - contentInsetStart: ReactPropTypes.number, + contentInsetStart: PropTypes.number, /** * Sets the content inset for the toolbar ending edge. * @@ -144,7 +143,7 @@ var ToolbarAndroid = React.createClass({ * these components and can be used to effectively align Toolbar content * along well-known gridlines. */ - contentInsetEnd: ReactPropTypes.number, + contentInsetEnd: PropTypes.number, /** * Used to set the toolbar direction to RTL. * In addition to this property you need to add @@ -155,11 +154,11 @@ var ToolbarAndroid = React.createClass({ * `setLayoutDirection(LayoutDirection.RTL)` in your MainActivity * `onCreate` method. */ - rtl: ReactPropTypes.bool, + rtl: PropTypes.bool, /** * Used to locate this view in end-to-end tests. */ - testID: ReactPropTypes.string, + testID: PropTypes.string, }, render: function() { diff --git a/Libraries/Components/Touchable/TouchableBounce.js b/Libraries/Components/Touchable/TouchableBounce.js index ae861f5e1..bcc1695ba 100644 --- a/Libraries/Components/Touchable/TouchableBounce.js +++ b/Libraries/Components/Touchable/TouchableBounce.js @@ -15,6 +15,7 @@ var Animated = require('Animated'); var EdgeInsetsPropType = require('EdgeInsetsPropType'); var NativeMethodsMixin = require('NativeMethodsMixin'); var React = require('React'); +var PropTypes = require('prop-types'); var Touchable = require('Touchable'); type Event = Object; @@ -42,17 +43,17 @@ var TouchableBounce = React.createClass({ * When true, indicates that the view is an accessibility element. By default, * all the touchable elements are accessible. */ - accessible: React.PropTypes.bool, + accessible: PropTypes.bool, - onPress: React.PropTypes.func, - onPressIn: React.PropTypes.func, - onPressOut: React.PropTypes.func, + onPress: PropTypes.func, + onPressIn: PropTypes.func, + onPressOut: PropTypes.func, // The function passed takes a callback to start the animation which should // be run after this onPress handler is done. You can use this (for example) // to update UI before starting the animation. - onPressWithCompletion: React.PropTypes.func, + onPressWithCompletion: PropTypes.func, // the function passed is called after the animation is complete - onPressAnimationComplete: React.PropTypes.func, + onPressAnimationComplete: PropTypes.func, /** * When the scroll view is disabled, this defines how far your touch may * move off of the button, before deactivating the button. Once deactivated, diff --git a/Libraries/Components/Touchable/TouchableHighlight.js b/Libraries/Components/Touchable/TouchableHighlight.js index df821100c..8bd873189 100644 --- a/Libraries/Components/Touchable/TouchableHighlight.js +++ b/Libraries/Components/Touchable/TouchableHighlight.js @@ -16,6 +16,7 @@ var ColorPropType = require('ColorPropType'); var NativeMethodsMixin = require('NativeMethodsMixin'); var React = require('React'); +const PropTypes = require('prop-types'); var ReactNativeViewAttributes = require('ReactNativeViewAttributes'); var StyleSheet = require('StyleSheet'); var TimerMixin = require('react-timer-mixin'); @@ -74,7 +75,7 @@ var TouchableHighlight = React.createClass({ * Determines what the opacity of the wrapped view should be when touch is * active. */ - activeOpacity: React.PropTypes.number, + activeOpacity: PropTypes.number, /** * The color of the underlay that will show through when the touch is * active. @@ -84,17 +85,17 @@ var TouchableHighlight = React.createClass({ /** * Called immediately after the underlay is shown */ - onShowUnderlay: React.PropTypes.func, + onShowUnderlay: PropTypes.func, /** * Called immediately after the underlay is hidden */ - onHideUnderlay: React.PropTypes.func, + onHideUnderlay: PropTypes.func, /** * *(Apple TV only)* TV preferred focus (see documentation for the View component). * * @platform ios */ - hasTVPreferredFocus: React.PropTypes.bool, + hasTVPreferredFocus: PropTypes.bool, /** * *(Apple TV only)* Object with properties to control Apple TV parallax effects. * @@ -106,7 +107,7 @@ var TouchableHighlight = React.createClass({ * * @platform ios */ - tvParallaxProperties: React.PropTypes.object, + tvParallaxProperties: PropTypes.object, }, diff --git a/Libraries/Components/Touchable/TouchableNativeFeedback.android.js b/Libraries/Components/Touchable/TouchableNativeFeedback.android.js index 5707b61e3..3c2e7b005 100644 --- a/Libraries/Components/Touchable/TouchableNativeFeedback.android.js +++ b/Libraries/Components/Touchable/TouchableNativeFeedback.android.js @@ -12,6 +12,7 @@ var Platform = require('Platform'); var React = require('React'); +var PropTypes = require('prop-types'); var ReactNative = require('ReactNative'); var Touchable = require('Touchable'); var TouchableWithoutFeedback = require('TouchableWithoutFeedback'); @@ -20,16 +21,14 @@ var UIManager = require('UIManager'); var ensurePositiveDelayProps = require('ensurePositiveDelayProps'); var processColor = require('processColor'); -var PropTypes = React.PropTypes; - var rippleBackgroundPropType = PropTypes.shape({ - type: React.PropTypes.oneOf(['RippleAndroid']), + type: PropTypes.oneOf(['RippleAndroid']), color: PropTypes.number, borderless: PropTypes.bool, }); var themeAttributeBackgroundPropType = PropTypes.shape({ - type: React.PropTypes.oneOf(['ThemeAttrAndroid']), + type: PropTypes.oneOf(['ThemeAttrAndroid']), attribute: PropTypes.string.isRequired, }); diff --git a/Libraries/Components/Touchable/TouchableOpacity.js b/Libraries/Components/Touchable/TouchableOpacity.js index 0138fea92..861fd5f5a 100644 --- a/Libraries/Components/Touchable/TouchableOpacity.js +++ b/Libraries/Components/Touchable/TouchableOpacity.js @@ -17,6 +17,7 @@ var Animated = require('Animated'); var Easing = require('Easing'); var NativeMethodsMixin = require('NativeMethodsMixin'); var React = require('React'); +var PropTypes = require('prop-types'); var TimerMixin = require('react-timer-mixin'); var Touchable = require('Touchable'); var TouchableWithoutFeedback = require('TouchableWithoutFeedback'); @@ -59,12 +60,12 @@ var TouchableOpacity = React.createClass({ * Determines what the opacity of the wrapped view should be when touch is * active. Defaults to 0.2. */ - activeOpacity: React.PropTypes.number, - focusedOpacity: React.PropTypes.number, + activeOpacity: PropTypes.number, + focusedOpacity: PropTypes.number, /** * Apple TV parallax effects */ - tvParallaxProperties: React.PropTypes.object, + tvParallaxProperties: PropTypes.object, }, getDefaultProps: function() { diff --git a/Libraries/Components/Touchable/TouchableWithoutFeedback.js b/Libraries/Components/Touchable/TouchableWithoutFeedback.js index cd1f855ff..8c740ddfc 100755 --- a/Libraries/Components/Touchable/TouchableWithoutFeedback.js +++ b/Libraries/Components/Touchable/TouchableWithoutFeedback.js @@ -13,6 +13,7 @@ const EdgeInsetsPropType = require('EdgeInsetsPropType'); const React = require('React'); +const PropTypes = require('prop-types'); const TimerMixin = require('react-timer-mixin'); const Touchable = require('Touchable'); @@ -40,46 +41,46 @@ const TouchableWithoutFeedback = React.createClass({ mixins: [TimerMixin, Touchable.Mixin], propTypes: { - accessible: React.PropTypes.bool, - accessibilityComponentType: React.PropTypes.oneOf( + accessible: PropTypes.bool, + accessibilityComponentType: PropTypes.oneOf( AccessibilityComponentTypes ), - accessibilityTraits: React.PropTypes.oneOfType([ - React.PropTypes.oneOf(AccessibilityTraits), - React.PropTypes.arrayOf(React.PropTypes.oneOf(AccessibilityTraits)), + accessibilityTraits: PropTypes.oneOfType([ + PropTypes.oneOf(AccessibilityTraits), + PropTypes.arrayOf(PropTypes.oneOf(AccessibilityTraits)), ]), /** * If true, disable all interactions for this component. */ - disabled: React.PropTypes.bool, + disabled: PropTypes.bool, /** * Called when the touch is released, but not if cancelled (e.g. by a scroll * that steals the responder lock). */ - onPress: React.PropTypes.func, - onPressIn: React.PropTypes.func, - onPressOut: React.PropTypes.func, + onPress: PropTypes.func, + onPressIn: PropTypes.func, + onPressOut: PropTypes.func, /** * Invoked on mount and layout changes with * * `{nativeEvent: {layout: {x, y, width, height}}}` */ - onLayout: React.PropTypes.func, + onLayout: PropTypes.func, - onLongPress: React.PropTypes.func, + onLongPress: PropTypes.func, /** * Delay in ms, from the start of the touch, before onPressIn is called. */ - delayPressIn: React.PropTypes.number, + delayPressIn: PropTypes.number, /** * Delay in ms, from the release of the touch, before onPressOut is called. */ - delayPressOut: React.PropTypes.number, + delayPressOut: PropTypes.number, /** * Delay in ms, from onPressIn, before onLongPress is called. */ - delayLongPress: React.PropTypes.number, + delayLongPress: PropTypes.number, /** * When the scroll view is disabled, this defines how far your touch may * move off of the button, before deactivating the button. Once deactivated, diff --git a/Libraries/Components/View/View.js b/Libraries/Components/View/View.js index b054ef8cc..38c9daca8 100644 --- a/Libraries/Components/View/View.js +++ b/Libraries/Components/View/View.js @@ -15,6 +15,7 @@ const NativeMethodsMixin = require('NativeMethodsMixin'); const NativeModules = require('NativeModules'); const Platform = require('Platform'); const React = require('React'); +const PropTypes = require('prop-types'); const ReactNativeFeatureFlags = require('ReactNativeFeatureFlags'); const ReactNativeStyleAttributes = require('ReactNativeStyleAttributes'); const ReactNativeViewAttributes = require('ReactNativeViewAttributes'); @@ -112,7 +113,7 @@ const View = React.createClass({ }, contextTypes: { - isInAParentText: React.PropTypes.bool, + isInAParentText: PropTypes.bool, }, render: function() { diff --git a/Libraries/Components/ViewPager/ViewPagerAndroid.android.js b/Libraries/Components/ViewPager/ViewPagerAndroid.android.js index be70e5a12..cf0192c2b 100644 --- a/Libraries/Components/ViewPager/ViewPagerAndroid.android.js +++ b/Libraries/Components/ViewPager/ViewPagerAndroid.android.js @@ -12,15 +12,14 @@ 'use strict'; var React = require('React'); +var PropTypes = require('prop-types'); var ReactNative = require('ReactNative'); var UIManager = require('UIManager'); -const ViewPropTypes = require('ViewPropTypes'); +var ViewPropTypes = require('ViewPropTypes'); var dismissKeyboard = require('dismissKeyboard'); var requireNativeComponent = require('requireNativeComponent'); -var ReactPropTypes = React.PropTypes; - var VIEWPAGER_REF = 'viewPager'; type Event = Object; diff --git a/Libraries/Components/WebView/WebView.android.js b/Libraries/Components/WebView/WebView.android.js index 2ded46b1b..cd05617c8 100644 --- a/Libraries/Components/WebView/WebView.android.js +++ b/Libraries/Components/WebView/WebView.android.js @@ -13,20 +13,18 @@ var EdgeInsetsPropType = require('EdgeInsetsPropType'); var ActivityIndicator = require('ActivityIndicator'); var React = require('React'); +var PropTypes = require('prop-types'); var ReactNative = require('ReactNative'); var StyleSheet = require('StyleSheet'); var UIManager = require('UIManager'); var View = require('View'); - -const ViewPropTypes = require('ViewPropTypes'); +var ViewPropTypes = require('ViewPropTypes'); var deprecatedPropType = require('deprecatedPropType'); var keyMirror = require('fbjs/lib/keyMirror'); var requireNativeComponent = require('requireNativeComponent'); var resolveAssetSource = require('resolveAssetSource'); -var PropTypes = React.PropTypes; - var RCT_WEBVIEW_REF = 'webview'; var WebViewState = keyMirror({ diff --git a/Libraries/Components/WebView/WebView.ios.js b/Libraries/Components/WebView/WebView.ios.js index eae1ed6f6..21f4397c0 100644 --- a/Libraries/Components/WebView/WebView.ios.js +++ b/Libraries/Components/WebView/WebView.ios.js @@ -14,12 +14,13 @@ var ActivityIndicator = require('ActivityIndicator'); var EdgeInsetsPropType = require('EdgeInsetsPropType'); var React = require('React'); +var PropTypes = require('prop-types'); var ReactNative = require('ReactNative'); var StyleSheet = require('StyleSheet'); var Text = require('Text'); var UIManager = require('UIManager'); var View = require('View'); -const ViewPropTypes = require('ViewPropTypes'); +var ViewPropTypes = require('ViewPropTypes'); var ScrollView = require('ScrollView'); var deprecatedPropType = require('deprecatedPropType'); @@ -29,7 +30,6 @@ var processDecelerationRate = require('processDecelerationRate'); var requireNativeComponent = require('requireNativeComponent'); var resolveAssetSource = require('resolveAssetSource'); -var PropTypes = React.PropTypes; var RCTWebViewManager = require('NativeModules').WebViewManager; var BGWASH = 'rgba(255,255,255,0.8)'; diff --git a/Libraries/Experimental/Incremental.js b/Libraries/Experimental/Incremental.js index 8c5cf10cb..82682cbf7 100644 --- a/Libraries/Experimental/Incremental.js +++ b/Libraries/Experimental/Incremental.js @@ -14,6 +14,8 @@ const InteractionManager = require('InteractionManager'); const React = require('React'); +const PropTypes = require('prop-types'); + const infoLog = require('infoLog'); const DEBUG = false; @@ -110,8 +112,8 @@ class Incremental extends React.Component { }; static contextTypes = { - incrementalGroup: React.PropTypes.object, - incrementalGroupEnabled: React.PropTypes.bool, + incrementalGroup: PropTypes.object, + incrementalGroupEnabled: PropTypes.bool, }; constructor(props: Props, context: Context) { diff --git a/Libraries/Experimental/IncrementalGroup.js b/Libraries/Experimental/IncrementalGroup.js index a3c08ac59..bb44b1750 100644 --- a/Libraries/Experimental/IncrementalGroup.js +++ b/Libraries/Experimental/IncrementalGroup.js @@ -14,6 +14,8 @@ const Incremental = require('Incremental'); const React = require('React'); +const PropTypes = require('prop-types'); + const infoLog = require('infoLog'); let _groupCounter = -1; @@ -75,8 +77,8 @@ class IncrementalGroup extends React.Component { } } IncrementalGroup.contextTypes = { - incrementalGroup: React.PropTypes.object, - incrementalGroupEnabled: React.PropTypes.bool, + incrementalGroup: PropTypes.object, + incrementalGroupEnabled: PropTypes.bool, }; IncrementalGroup.childContextTypes = IncrementalGroup.contextTypes; diff --git a/Libraries/Experimental/IncrementalPresenter.js b/Libraries/Experimental/IncrementalPresenter.js index 90c31fda2..953690b2c 100644 --- a/Libraries/Experimental/IncrementalPresenter.js +++ b/Libraries/Experimental/IncrementalPresenter.js @@ -13,6 +13,7 @@ const IncrementalGroup = require('IncrementalGroup'); const React = require('React'); +const PropTypes = require('prop-types'); const View = require('View'); const ViewPropTypes = require('ViewPropTypes'); @@ -45,15 +46,15 @@ class IncrementalPresenter extends React.Component { _isDone: boolean; static propTypes = { - name: React.PropTypes.string, - disabled: React.PropTypes.bool, - onDone: React.PropTypes.func, - onLayout: React.PropTypes.func, + name: PropTypes.string, + disabled: PropTypes.bool, + onDone: PropTypes.func, + onLayout: PropTypes.func, style: ViewPropTypes.style, }; static contextTypes = { - incrementalGroup: React.PropTypes.object, - incrementalGroupEnabled: React.PropTypes.bool, + incrementalGroup: PropTypes.object, + incrementalGroupEnabled: PropTypes.bool, }; constructor(props: Props, context: Context) { diff --git a/Libraries/Experimental/SwipeableRow/SwipeableQuickActionButton.js b/Libraries/Experimental/SwipeableRow/SwipeableQuickActionButton.js index 64195eb7b..ec6780e9d 100644 --- a/Libraries/Experimental/SwipeableRow/SwipeableQuickActionButton.js +++ b/Libraries/Experimental/SwipeableRow/SwipeableQuickActionButton.js @@ -13,14 +13,13 @@ const Image = require('Image'); const React = require('React'); +const PropTypes = require('prop-types'); const Text = require('Text'); const TouchableHighlight = require('TouchableHighlight'); const View = require('View'); const ViewPropTypes = require('ViewPropTypes'); -const {PropTypes} = React; - import type {ImageSource} from 'ImageSource'; /** diff --git a/Libraries/Experimental/SwipeableRow/SwipeableRow.js b/Libraries/Experimental/SwipeableRow/SwipeableRow.js index 0e105c252..5a7c575c4 100644 --- a/Libraries/Experimental/SwipeableRow/SwipeableRow.js +++ b/Libraries/Experimental/SwipeableRow/SwipeableRow.js @@ -15,12 +15,11 @@ const Animated = require('Animated'); const I18nManager = require('I18nManager'); const PanResponder = require('PanResponder'); const React = require('React'); +const PropTypes = require('prop-types'); const StyleSheet = require('StyleSheet'); const TimerMixin = require('react-timer-mixin'); const View = require('View'); -const {PropTypes} = React; - const emptyFunction = require('fbjs/lib/emptyFunction'); const IS_RTL = I18nManager.isRTL; diff --git a/Libraries/Image/Image.android.js b/Libraries/Image/Image.android.js index 4820d7570..b358bf459 100644 --- a/Libraries/Image/Image.android.js +++ b/Libraries/Image/Image.android.js @@ -17,12 +17,13 @@ var NativeMethodsMixin = require('NativeMethodsMixin'); var NativeModules = require('NativeModules'); var PropTypes = require('react/lib/ReactPropTypes'); var React = require('React'); +var PropTypes = require('prop-types'); var ReactNativeViewAttributes = require('ReactNativeViewAttributes'); var Set = require('Set'); var StyleSheet = require('StyleSheet'); var StyleSheetPropType = require('StyleSheetPropType'); var View = require('View'); -const ViewPropTypes = require('ViewPropTypes'); +var ViewPropTypes = require('ViewPropTypes'); var ViewStylePropTypes = require('ViewStylePropTypes'); var filterObject = require('fbjs/lib/filterObject'); @@ -31,7 +32,6 @@ var merge = require('merge'); var requireNativeComponent = require('requireNativeComponent'); var resolveAssetSource = require('resolveAssetSource'); -var PropTypes = React.PropTypes; var { ImageLoader, } = NativeModules; @@ -276,7 +276,7 @@ var Image = React.createClass({ }, contextTypes: { - isInAParentText: React.PropTypes.bool + isInAParentText: PropTypes.bool }, render: function() { diff --git a/Libraries/Image/Image.ios.js b/Libraries/Image/Image.ios.js index bba7a8999..872e71428 100644 --- a/Libraries/Image/Image.ios.js +++ b/Libraries/Image/Image.ios.js @@ -18,6 +18,7 @@ const ImageStylePropTypes = require('ImageStylePropTypes'); const NativeMethodsMixin = require('NativeMethodsMixin'); const NativeModules = require('NativeModules'); const React = require('React'); +const PropTypes = require('prop-types'); const ReactNativeViewAttributes = require('ReactNativeViewAttributes'); const StyleSheet = require('StyleSheet'); const StyleSheetPropType = require('StyleSheetPropType'); @@ -26,8 +27,6 @@ const flattenStyle = require('flattenStyle'); const requireNativeComponent = require('requireNativeComponent'); const resolveAssetSource = require('resolveAssetSource'); -const PropTypes = React.PropTypes; - const ImageViewManager = NativeModules.ImageViewManager; /** diff --git a/Libraries/Inspector/ElementProperties.js b/Libraries/Inspector/ElementProperties.js index b2bcd0d68..7ca7ee1f3 100644 --- a/Libraries/Inspector/ElementProperties.js +++ b/Libraries/Inspector/ElementProperties.js @@ -13,6 +13,7 @@ const BoxInspector = require('BoxInspector'); const React = require('React'); +const PropTypes = require('prop-types'); const StyleInspector = require('StyleInspector'); const StyleSheet = require('StyleSheet'); const Text = require('Text'); @@ -24,8 +25,6 @@ const flattenStyle = require('flattenStyle'); const mapWithSeparator = require('mapWithSeparator'); const openFileInEditor = require('openFileInEditor'); -const PropTypes = React.PropTypes; - class ElementProperties extends React.Component { props: { hierarchy: Array<$FlowFixMe>, diff --git a/Libraries/Inspector/InspectorOverlay.js b/Libraries/Inspector/InspectorOverlay.js index 27589eb91..b7a72ae77 100644 --- a/Libraries/Inspector/InspectorOverlay.js +++ b/Libraries/Inspector/InspectorOverlay.js @@ -14,13 +14,12 @@ var Dimensions = require('Dimensions'); var InspectorUtils = require('InspectorUtils'); var React = require('React'); +var PropTypes = require('prop-types'); var StyleSheet = require('StyleSheet'); var UIManager = require('UIManager'); var View = require('View'); var ElementBox = require('ElementBox'); -var PropTypes = React.PropTypes; - type EventLike = { nativeEvent: Object, }; diff --git a/Libraries/Inspector/InspectorPanel.js b/Libraries/Inspector/InspectorPanel.js index 0704466b1..d2a4c3dbd 100644 --- a/Libraries/Inspector/InspectorPanel.js +++ b/Libraries/Inspector/InspectorPanel.js @@ -15,14 +15,13 @@ const ElementProperties = require('ElementProperties'); const NetworkOverlay = require('NetworkOverlay'); const PerformanceOverlay = require('PerformanceOverlay'); const React = require('React'); +const PropTypes = require('prop-types'); const ScrollView = require('ScrollView'); const StyleSheet = require('StyleSheet'); const Text = require('Text'); const TouchableHighlight = require('TouchableHighlight'); const View = require('View'); -const PropTypes = React.PropTypes; - class InspectorPanel extends React.Component { renderWaiting() { if (this.props.inspecting) { diff --git a/Libraries/Lists/ListView/ListView.js b/Libraries/Lists/ListView/ListView.js index afc38070c..2001888c8 100644 --- a/Libraries/Lists/ListView/ListView.js +++ b/Libraries/Lists/ListView/ListView.js @@ -14,6 +14,7 @@ var ListViewDataSource = require('ListViewDataSource'); var Platform = require('Platform'); var React = require('React'); +var PropTypes = require('prop-types'); var ReactNative = require('ReactNative'); var RCTScrollViewManager = require('NativeModules').ScrollViewManager; var ScrollView = require('ScrollView'); @@ -26,8 +27,6 @@ var cloneReferencedElement = require('react-clone-referenced-element'); var isEmpty = require('isEmpty'); var merge = require('merge'); -var PropTypes = React.PropTypes; - var DEFAULT_PAGE_SIZE = 1; var DEFAULT_INITIAL_ROWS = 10; var DEFAULT_SCROLL_RENDER_AHEAD = 1000; @@ -181,12 +180,12 @@ var ListView = React.createClass({ * A function that returns the scrollable component in which the list rows * are rendered. Defaults to returning a ScrollView with the given props. */ - renderScrollComponent: React.PropTypes.func.isRequired, + renderScrollComponent: PropTypes.func.isRequired, /** * How early to start rendering rows before they come on screen, in * pixels. */ - scrollRenderAheadDistance: React.PropTypes.number.isRequired, + scrollRenderAheadDistance: PropTypes.number.isRequired, /** * (visibleRows, changedRows) => void * @@ -196,13 +195,13 @@ var ListView = React.createClass({ * that have changed their visibility, with true indicating visible, and * false indicating the view has moved out of view. */ - onChangeVisibleRows: React.PropTypes.func, + onChangeVisibleRows: PropTypes.func, /** * A performance optimization for improving scroll perf of * large lists, used in conjunction with overflow: 'hidden' on the row * containers. This is enabled by default. */ - removeClippedSubviews: React.PropTypes.bool, + removeClippedSubviews: PropTypes.bool, /** * Makes the sections headers sticky. The sticky behavior means that it * will scroll with the content at the top of the section until it reaches @@ -211,7 +210,7 @@ var ListView = React.createClass({ * not supported in conjunction with `horizontal={true}`. Only enabled by * default on iOS because of typical platform standards. */ - stickySectionHeadersEnabled: React.PropTypes.bool, + stickySectionHeadersEnabled: PropTypes.bool, /** * An array of child indices determining which children get docked to the * top of the screen when scrolling. For example, passing diff --git a/Libraries/Modal/Modal.js b/Libraries/Modal/Modal.js index c601f6fce..2243da9d7 100644 --- a/Libraries/Modal/Modal.js +++ b/Libraries/Modal/Modal.js @@ -15,6 +15,7 @@ const AppContainer = require('AppContainer'); const I18nManager = require('I18nManager'); const Platform = require('Platform'); const React = require('React'); +const PropTypes = require('prop-types'); const StyleSheet = require('StyleSheet'); const View = require('View'); @@ -22,8 +23,6 @@ const deprecatedPropType = require('deprecatedPropType'); const requireNativeComponent = require('requireNativeComponent'); const RCTModalHostView = requireNativeComponent('RCTModalHostView', null); -const PropTypes = React.PropTypes; - /** * The Modal component is a simple way to present content above an enclosing view. * @@ -137,7 +136,7 @@ class Modal extends React.Component { }; static contextTypes = { - rootTag: React.PropTypes.number, + rootTag: PropTypes.number, }; render(): ?React.Element { diff --git a/Libraries/RCTTest/SnapshotViewIOS.ios.js b/Libraries/RCTTest/SnapshotViewIOS.ios.js index 892f1e2a7..07048b7eb 100644 --- a/Libraries/RCTTest/SnapshotViewIOS.ios.js +++ b/Libraries/RCTTest/SnapshotViewIOS.ios.js @@ -12,6 +12,7 @@ 'use strict'; var React = require('React'); +const PropTypes = require('prop-types'); var StyleSheet = require('StyleSheet'); var { TestModule } = require('NativeModules'); var UIManager = require('UIManager'); @@ -31,9 +32,9 @@ class SnapshotViewIOS extends React.Component { static propTypes = { ...ViewPropTypes, // A callback when the Snapshot view is ready to be compared - onSnapshotReady : React.PropTypes.func, + onSnapshotReady : PropTypes.func, // A name to identify the individual instance to the SnapshotView - testIdentifier : React.PropTypes.string, + testIdentifier : PropTypes.string, }; onDefaultAction = (event: Object) => { diff --git a/Libraries/Renderer/src/renderers/native/__tests__/ReactNativeEvents-test.js b/Libraries/Renderer/src/renderers/native/__tests__/ReactNativeEvents-test.js index 56206149a..39e4ca720 100644 --- a/Libraries/Renderer/src/renderers/native/__tests__/ReactNativeEvents-test.js +++ b/Libraries/Renderer/src/renderers/native/__tests__/ReactNativeEvents-test.js @@ -97,7 +97,7 @@ it('handles events on text nodes', () => { }); class ContextHack extends React.Component { - static childContextTypes = {isInAParentText: React.PropTypes.bool}; + static childContextTypes = {isInAParentText: PropTypes.bool}; getChildContext() { return {isInAParentText: true}; } diff --git a/Libraries/Renderer/src/renderers/shared/fiber/__tests__/ReactIncrementalErrorHandling-test.js b/Libraries/Renderer/src/renderers/shared/fiber/__tests__/ReactIncrementalErrorHandling-test.js index 4b4b415cc..91a09c648 100644 --- a/Libraries/Renderer/src/renderers/shared/fiber/__tests__/ReactIncrementalErrorHandling-test.js +++ b/Libraries/Renderer/src/renderers/shared/fiber/__tests__/ReactIncrementalErrorHandling-test.js @@ -679,8 +679,8 @@ describe('ReactIncrementalErrorHandling', () => { it('unwinds the context stack correctly on error', () => { class Provider extends React.Component { - static childContextTypes = {message: React.PropTypes.string}; - static contextTypes = {message: React.PropTypes.string}; + static childContextTypes = {message: PropTypes.string}; + static contextTypes = {message: PropTypes.string}; getChildContext() { return { message: (this.context.message || '') + this.props.message, @@ -696,7 +696,7 @@ describe('ReactIncrementalErrorHandling', () => { } Connector.contextTypes = { - message: React.PropTypes.string, + message: PropTypes.string, }; function BadRender() { diff --git a/Libraries/Text/Text.js b/Libraries/Text/Text.js index 986f69590..9b26ac0e2 100644 --- a/Libraries/Text/Text.js +++ b/Libraries/Text/Text.js @@ -16,6 +16,7 @@ const EdgeInsetsPropType = require('EdgeInsetsPropType'); const NativeMethodsMixin = require('NativeMethodsMixin'); const Platform = require('Platform'); const React = require('React'); +const PropTypes = require('prop-types'); const ReactNativeViewAttributes = require('ReactNativeViewAttributes'); const StyleSheetPropType = require('StyleSheetPropType'); const TextStylePropTypes = require('TextStylePropTypes'); @@ -25,8 +26,6 @@ const createReactNativeComponentClass = require('createReactNativeComponentClass const mergeFast = require('mergeFast'); const processColor = require('processColor'); -const { PropTypes } = React; - const stylePropType = StyleSheetPropType(TextStylePropTypes); const viewConfig = { diff --git a/local-cli/templates/HelloNavigation/components/KeyboardSpacer.js b/local-cli/templates/HelloNavigation/components/KeyboardSpacer.js index f720d65c1..cc272e82a 100644 --- a/local-cli/templates/HelloNavigation/components/KeyboardSpacer.js +++ b/local-cli/templates/HelloNavigation/components/KeyboardSpacer.js @@ -2,7 +2,8 @@ /* @flow */ -import React, { PropTypes, Component } from 'react'; +import React, { Component } from 'react'; +import PropTypes from 'prop-types'; import { Platform, View, diff --git a/website/core/Header.js b/website/core/Header.js index 082deeac9..6b68a96f7 100644 --- a/website/core/Header.js +++ b/website/core/Header.js @@ -12,11 +12,13 @@ var React = require('React'); +var PropTypes = require('prop-types'); + var slugify = require('slugify'); var Header = React.createClass({ contextTypes: { - permalink: React.PropTypes.string + permalink: PropTypes.string }, render: function() { diff --git a/website/core/HeaderWithGithub.js b/website/core/HeaderWithGithub.js index af488f6d4..9588d3799 100644 --- a/website/core/HeaderWithGithub.js +++ b/website/core/HeaderWithGithub.js @@ -13,6 +13,8 @@ var H = require('Header'); var React = require('React'); +var PropTypes = require('prop-types'); + function getGitHubPath(path) { return 'https://github.com/facebook/react-native/blob/master/' + path; } @@ -20,7 +22,7 @@ function getGitHubPath(path) { var HeaderWithGithub = React.createClass({ contextTypes: { - version: React.PropTypes.string + version: PropTypes.string }, render: function() { diff --git a/website/core/SnackPlayer.js b/website/core/SnackPlayer.js index 18cb262f7..8fc2a6621 100644 --- a/website/core/SnackPlayer.js +++ b/website/core/SnackPlayer.js @@ -13,6 +13,8 @@ var Prism = require('Prism'); var React = require('React'); +const PropTypes = require('prop-types'); + const LatestSDKVersion = '15.0.0'; var ReactNativeToExpoSDKVersionMap = { '0.42': '15.0.0', @@ -39,7 +41,7 @@ var ReactNativeToExpoSDKVersionMap = { */ var SnackPlayer = React.createClass({ contextTypes: { - version: React.PropTypes.number.isRequired, + version: PropTypes.number.isRequired, }, componentDidMount() { diff --git a/website/layout/AutodocsLayout.js b/website/layout/AutodocsLayout.js index 39a66eca2..07ec34d08 100644 --- a/website/layout/AutodocsLayout.js +++ b/website/layout/AutodocsLayout.js @@ -19,6 +19,7 @@ var Marked = require('Marked'); var Metadata = require('Metadata'); var Prism = require('Prism'); var React = require('React'); +const PropTypes = require('prop-types'); var Site = require('Site'); var slugify = require('slugify'); @@ -836,8 +837,8 @@ var Modal = React.createClass({ var Autodocs = React.createClass({ childContextTypes: { - permalink: React.PropTypes.string, - version: React.PropTypes.string + permalink: PropTypes.string, + version: PropTypes.string }, getChildContext: function() { diff --git a/website/layout/DocsLayout.js b/website/layout/DocsLayout.js index 7845ed0f6..dc064fcee 100644 --- a/website/layout/DocsLayout.js +++ b/website/layout/DocsLayout.js @@ -16,12 +16,13 @@ var Header = require('Header'); var Marked = require('Marked'); var Metadata = require('Metadata'); var React = require('React'); +var PropTypes = require('prop-types'); var Site = require('Site'); var DocsLayout = React.createClass({ childContextTypes: { - permalink: React.PropTypes.string, - version: React.PropTypes.string + permalink: PropTypes.string, + version: PropTypes.string }, getChildContext: function() { diff --git a/website/layout/PageLayout.js b/website/layout/PageLayout.js index a7d97ba8d..fb9b0e2f1 100644 --- a/website/layout/PageLayout.js +++ b/website/layout/PageLayout.js @@ -12,11 +12,12 @@ var Marked = require('Marked'); var React = require('React'); +var PropTypes = require('prop-types'); var Site = require('Site'); var support = React.createClass({ childContextTypes: { - permalink: React.PropTypes.string + permalink: PropTypes.string }, getChildContext: function() { diff --git a/website/src/react-native/support.js b/website/src/react-native/support.js index c788f352a..b256d64c6 100644 --- a/website/src/react-native/support.js +++ b/website/src/react-native/support.js @@ -9,11 +9,12 @@ 'use strict'; var React = require('React'); +var PropTypes = require('prop-types'); var Site = require('Site'); var support = React.createClass({ childContextTypes: { - permalink: React.PropTypes.string + permalink: PropTypes.string }, getChildContext: function() {