Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[0.45] react@16 did away with PropTypes; require prop-types instead #14640

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Libraries/Components/AppleTV/TVViewPropTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* @flow
*/
'use strict';
var PropTypes = require('React').PropTypes;
var PropTypes = require('prop-types');

/**
* Additional View properties for Apple TV
Expand Down
5 changes: 2 additions & 3 deletions Libraries/Components/Picker/PickerAndroid.android.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

var ColorPropType = require('ColorPropType');
var React = require('React');
var ReactPropTypes = require('prop-types');
var StyleSheet = require('StyleSheet');
var StyleSheetPropType = require('StyleSheetPropType');
const ViewPropTypes = require('ViewPropTypes');
Expand All @@ -22,8 +23,6 @@ var ViewStylePropTypes = require('ViewStylePropTypes');
var processColor = require('processColor');
var requireNativeComponent = require('requireNativeComponent');

var ReactPropTypes = React.PropTypes;

var REF_PICKER = 'picker';
var MODE_DROPDOWN = 'dropdown';

Expand Down Expand Up @@ -53,7 +52,7 @@ class PickerAndroid extends React.Component {
static propTypes = {
...ViewPropTypes,
style: pickerStyleType,
selectedValue: React.PropTypes.any,
selectedValue: ReactPropTypes.any,
enabled: ReactPropTypes.bool,
mode: ReactPropTypes.oneOf(['dialog', 'dropdown']),
onValueChange: ReactPropTypes.func,
Expand Down
2 changes: 1 addition & 1 deletion Libraries/Components/View/ShadowPropTypesIOS.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
'use strict';

var ColorPropType = require('ColorPropType');
var ReactPropTypes = require('React').PropTypes;
var ReactPropTypes = require('prop-types');

var ShadowPropTypesIOS = {
/**
Expand Down
2 changes: 1 addition & 1 deletion Libraries/Components/View/ViewStylePropTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
'use strict';

var LayoutPropTypes = require('LayoutPropTypes');
var ReactPropTypes = require('React').PropTypes;
var ReactPropTypes = require('prop-types');
var ColorPropType = require('ColorPropType');
var ShadowPropTypesIOS = require('ShadowPropTypesIOS');
var TransformPropTypes = require('TransformPropTypes');
Expand Down
2 changes: 1 addition & 1 deletion Libraries/Image/ImageStylePropTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
var ImageResizeMode = require('ImageResizeMode');
var LayoutPropTypes = require('LayoutPropTypes');
var ColorPropType = require('ColorPropType');
var ReactPropTypes = require('prop-types');
var ShadowPropTypesIOS = require('ShadowPropTypesIOS');
var TransformPropTypes = require('TransformPropTypes');

var ReactPropTypes = require('React').PropTypes;

var ImageStylePropTypes = {
...LayoutPropTypes,
Expand Down
3 changes: 2 additions & 1 deletion Libraries/ReactNative/AppContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
'use strict';

const EmitterSubscription = require('EmitterSubscription');
const PropTypes = require('prop-types');
const RCTDeviceEventEmitter = require('RCTDeviceEventEmitter');
const React = require('React');
const ReactNative = require('ReactNative');
Expand Down Expand Up @@ -41,7 +42,7 @@ class AppContainer extends React.Component {
_subscription: ?EmitterSubscription = null;

static childContextTypes = {
rootTag: React.PropTypes.number,
rootTag: PropTypes.number,
};

getChildContext(): Context {
Expand Down
2 changes: 1 addition & 1 deletion Libraries/StyleSheet/LayoutPropTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
*/
'use strict';

var ReactPropTypes = require('React').PropTypes;
var ReactPropTypes = require('prop-types');

/**
* React Native's layout system is based on Flexbox and is powered both
Expand Down
2 changes: 1 addition & 1 deletion Libraries/StyleSheet/PointPropType.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
*/
'use strict';

var PropTypes = require('React').PropTypes;
var PropTypes = require('prop-types');

var createStrictShapeTypeChecker = require('createStrictShapeTypeChecker');

Expand Down
2 changes: 1 addition & 1 deletion Libraries/StyleSheet/TransformPropTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

var deprecatedPropType = require('deprecatedPropType');

var ReactPropTypes = require('React').PropTypes;
var ReactPropTypes = require('prop-types');

var TransformMatrixPropType = function(
props : Object,
Expand Down
2 changes: 1 addition & 1 deletion Libraries/Text/TextStylePropTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
*/
'use strict';

const ReactPropTypes = require('React').PropTypes;
const ReactPropTypes = require('prop-types');
const ColorPropType = require('ColorPropType');
const ViewStylePropTypes = require('ViewStylePropTypes');

Expand Down
4 changes: 2 additions & 2 deletions docs/NativeComponentsAndroid.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ The very final step is to create the JavaScript module that defines the interfac
```js
// ImageView.js

import { PropTypes } from 'react';
import PropTypes from 'prop-types';
import { requireNativeComponent, View } from 'react-native';

var iface = {
Expand Down Expand Up @@ -168,7 +168,7 @@ MyCustomView.propTypes = {
/**
* Callback that is called continuously when the user is dragging the map.
*/
onChangeMessage: React.PropTypes.func,
onChangeMessage: PropTypes.func,
...
};

Expand Down
17 changes: 9 additions & 8 deletions docs/NativeComponentsIOS.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ This isn't very well documented though - in order to know what properties are av

```javascript
// MapView.js
import PropTypes from 'prop-types';
import React from 'react';
import { requireNativeComponent } from 'react-native';

Expand All @@ -101,7 +102,7 @@ MapView.propTypes = {
* angle is ignored and the map is always displayed as if the user
* is looking straight down onto it.
*/
pitchEnabled: React.PropTypes.bool,
pitchEnabled: PropTypes.bool,
};

var RNTMap = requireNativeComponent('RNTMap', MapView);
Expand Down Expand Up @@ -177,27 +178,27 @@ MapView.propTypes = {
* angle is ignored and the map is always displayed as if the user
* is looking straight down onto it.
*/
pitchEnabled: React.PropTypes.bool,
pitchEnabled: PropTypes.bool,

/**
* The region to be displayed by the map.
*
* The region is defined by the center coordinates and the span of
* coordinates to display.
*/
region: React.PropTypes.shape({
region: PropTypes.shape({
/**
* Coordinates for the center of the map.
*/
latitude: React.PropTypes.number.isRequired,
longitude: React.PropTypes.number.isRequired,
latitude: PropTypes.number.isRequired,
longitude: PropTypes.number.isRequired,

/**
* Distance between the minimum and the maximum latitude/longitude
* to be displayed.
*/
latitudeDelta: React.PropTypes.number.isRequired,
longitudeDelta: React.PropTypes.number.isRequired,
latitudeDelta: PropTypes.number.isRequired,
longitudeDelta: PropTypes.number.isRequired,
}),
};

Expand Down Expand Up @@ -323,7 +324,7 @@ MapView.propTypes = {
/**
* Callback that is called continuously when the user is dragging the map.
*/
onChange: React.PropTypes.func,
onChange: PropTypes.func,
...
};

Expand Down