Skip to content

Commit 82fc0f3

Browse files
mojodnahramos
authored andcommitted
Replace React.createClass with create-react-class
Summary: This replaces all uses of `React.createClass` with `createReactClass` from the `create-react-class` package, attempting to match use of `var` and `const` according to local style. Fixes #14620 Refs #14712 Closes #14729 Differential Revision: D5321810 Pulled By: hramos fbshipit-source-id: ae7b40640b2773fd89c3fb727ec87f688bebf585
1 parent e76eb32 commit 82fc0f3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+50
-0
lines changed

IntegrationTests/LayoutEventsTest.js

+1
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ type State = {
6060
};
6161

6262
var LayoutEventsTest = createReactClass({
63+
displayName: 'LayoutEventsTest',
6364
getInitialState(): State {
6465
return {
6566
didAnimation: false,

IntegrationTests/ReactContentSizeUpdateTest.js

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ var newReactViewWidth = 201;
2626
var newReactViewHeight = 202;
2727

2828
var ReactContentSizeUpdateTest = createReactClass({
29+
displayName: 'ReactContentSizeUpdateTest',
2930
mixins: [Subscribable.Mixin,
3031
TimerMixin],
3132

IntegrationTests/SizeFlexibilityUpdateTest.js

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ var reactViewHeight = 222;
2424
var finalState = false;
2525

2626
var SizeFlexibilityUpdateTest = createReactClass({
27+
displayName: 'SizeFlexibilityUpdateTest',
2728
mixins: [Subscribable.Mixin],
2829

2930
componentWillMount: function() {

IntegrationTests/TimersTest.js

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ var {
2424
var { TestModule } = ReactNative.NativeModules;
2525

2626
var TimersTest = createReactClass({
27+
displayName: 'TimersTest',
2728
mixins: [TimerMixin],
2829

2930
_nextTest: () => {},

Libraries/Components/ActivityIndicator/ActivityIndicator.js

+1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ type DefaultProps = {
3838
* Displays a circular loading indicator.
3939
*/
4040
const ActivityIndicator = createReactClass({
41+
displayName: 'ActivityIndicator',
4142
mixins: [NativeMethodsMixin],
4243

4344
propTypes: {

Libraries/Components/DatePicker/DatePickerIOS.ios.js

+1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ type Event = Object;
3838
*/
3939
// $FlowFixMe(>=0.41.0)
4040
const DatePickerIOS = createReactClass({
41+
displayName: 'DatePickerIOS',
4142
// TOOD: Put a better type for _picker
4243
_picker: (undefined: ?$FlowFixMe),
4344

Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js

+1
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ var DRAWER_STATES = [
6969
* ```
7070
*/
7171
var DrawerLayoutAndroid = createReactClass({
72+
displayName: 'DrawerLayoutAndroid',
7273
statics: {
7374
positions: DrawerConsts.DrawerPosition,
7475
},

Libraries/Components/Keyboard/KeyboardAvoidingView.js

+1
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ const viewRef = 'VIEW';
5555
*/
5656
// $FlowFixMe(>=0.41.0)
5757
const KeyboardAvoidingView = createReactClass({
58+
displayName: 'KeyboardAvoidingView',
5859
mixins: [TimerMixin],
5960

6061
propTypes: {

Libraries/Components/LazyRenderer.js

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ var PropTypes = require('prop-types');
1616
var TimerMixin = require('react-timer-mixin');
1717

1818
var LazyRenderer = createReactClass({
19+
displayName: 'LazyRenderer',
1920
mixin: [TimerMixin],
2021

2122
propTypes: {

Libraries/Components/Navigation/NavigatorIOS.ios.js

+1
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,7 @@ type Event = Object;
306306
*
307307
*/
308308
var NavigatorIOS = createReactClass({
309+
displayName: 'NavigatorIOS',
309310

310311
propTypes: {
311312

Libraries/Components/Picker/PickerIOS.ios.js

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ var itemStylePropType = StyleSheetPropType(TextStylePropTypes);
2727
var requireNativeComponent = require('requireNativeComponent');
2828

2929
var PickerIOS = createReactClass({
30+
displayName: 'PickerIOS',
3031
mixins: [NativeMethodsMixin],
3132

3233
propTypes: {

Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.android.js

+1
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ var indeterminateType = function(props, propName, componentName, ...rest) {
6565
* ```
6666
*/
6767
var ProgressBarAndroid = createReactClass({
68+
displayName: 'ProgressBarAndroid',
6869
propTypes: {
6970
...ViewPropTypes,
7071
/**

Libraries/Components/ProgressViewIOS/ProgressViewIOS.ios.js

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ var requireNativeComponent = require('requireNativeComponent');
2626
*/
2727
// $FlowFixMe(>=0.41.0)
2828
var ProgressViewIOS = createReactClass({
29+
displayName: 'ProgressViewIOS',
2930
mixins: [NativeMethodsMixin],
3031

3132
propTypes: {

Libraries/Components/RefreshControl/RefreshControl.js

+1
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ if (Platform.OS === 'android') {
7474
*/
7575
// $FlowFixMe(>=0.41.0)
7676
const RefreshControl = createReactClass({
77+
displayName: 'RefreshControl',
7778
statics: {
7879
SIZE: RefreshLayoutConsts.SIZE,
7980
},

Libraries/Components/ScrollView/ScrollView.js

+1
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ const requireNativeComponent = require('requireNativeComponent');
7171
*/
7272
// $FlowFixMe(>=0.41.0)
7373
const ScrollView = createReactClass({
74+
displayName: 'ScrollView',
7475
propTypes: {
7576
...ViewPropTypes,
7677
/**

Libraries/Components/SegmentedControlIOS/SegmentedControlIOS.ios.js

+1
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ type Event = Object;
5151
*/
5252
// $FlowFixMe(>=0.41.0)
5353
var SegmentedControlIOS = createReactClass({
54+
displayName: 'SegmentedControlIOS',
5455
mixins: [NativeMethodsMixin],
5556

5657
propTypes: {

Libraries/Components/Slider/Slider.js

+1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ type Event = Object;
3131
*/
3232
// $FlowFixMe(>=0.41.0)
3333
var Slider = createReactClass({
34+
displayName: 'Slider',
3435
mixins: [NativeMethodsMixin],
3536

3637
propTypes: {

Libraries/Components/Switch/Switch.js

+1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ type DefaultProps = {
4040
*/
4141
// $FlowFixMe(>=0.41.0)
4242
var Switch = createReactClass({
43+
displayName: 'Switch',
4344
propTypes: {
4445
...ViewPropTypes,
4546
/**

Libraries/Components/TextInput/TextInput.js

+1
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ const DataDetectorTypes = [
170170
*/
171171
// $FlowFixMe(>=0.41.0)
172172
const TextInput = createReactClass({
173+
displayName: 'TextInput',
173174
statics: {
174175
/* TODO(brentvatne) docs are needed for this */
175176
State: TextInputState,

Libraries/Components/ToolbarAndroid/ToolbarAndroid.android.js

+1
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ var optionalImageSource = PropTypes.oneOfType([
6767
* [0]: https://developer.android.com/reference/android/support/v7/widget/Toolbar.html
6868
*/
6969
var ToolbarAndroid = createReactClass({
70+
displayName: 'ToolbarAndroid',
7071
mixins: [NativeMethodsMixin],
7172

7273
propTypes: {

Libraries/Components/Touchable/TouchableBounce.js

+1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ var PRESS_RETENTION_OFFSET = {top: 20, left: 20, right: 20, bottom: 30};
3737
*/
3838
// $FlowFixMe(>=0.41.0)
3939
var TouchableBounce = createReactClass({
40+
displayName: 'TouchableBounce',
4041
mixins: [Touchable.Mixin, NativeMethodsMixin],
4142

4243
propTypes: {

Libraries/Components/Touchable/TouchableHighlight.js

+1
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ var PRESS_RETENTION_OFFSET = {top: 20, left: 20, right: 20, bottom: 30};
7070
*/
7171

7272
var TouchableHighlight = createReactClass({
73+
displayName: 'TouchableHighlight',
7374
propTypes: {
7475
...TouchableWithoutFeedback.propTypes,
7576
/**

Libraries/Components/Touchable/TouchableNativeFeedback.android.js

+1
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ var PRESS_RETENTION_OFFSET = {top: 20, left: 20, right: 20, bottom: 30};
7272
*/
7373

7474
var TouchableNativeFeedback = createReactClass({
75+
displayName: 'TouchableNativeFeedback',
7576
propTypes: {
7677
...TouchableWithoutFeedback.propTypes,
7778

Libraries/Components/Touchable/TouchableOpacity.js

+1
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ var PRESS_RETENTION_OFFSET = {top: 20, left: 20, right: 20, bottom: 30};
5353
* ```
5454
*/
5555
var TouchableOpacity = createReactClass({
56+
displayName: 'TouchableOpacity',
5657
mixins: [TimerMixin, Touchable.Mixin, NativeMethodsMixin],
5758

5859
propTypes: {

Libraries/Components/Touchable/TouchableWithoutFeedback.js

+1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ const PRESS_RETENTION_OFFSET = {top: 20, left: 20, right: 20, bottom: 30};
3939
*/
4040
// $FlowFixMe(>=0.41.0)
4141
const TouchableWithoutFeedback = createReactClass({
42+
displayName: 'TouchableWithoutFeedback',
4243
mixins: [TimerMixin, Touchable.Mixin],
4344

4445
propTypes: {

Libraries/Components/View/View.js

+1
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ export type Props = ViewProps;
8686
*/
8787
// $FlowFixMe(>=0.41.0)
8888
const View = createReactClass({
89+
displayName: 'View',
8990
// TODO: We should probably expose the mixins, viewConfig, and statics publicly. For example,
9091
// one of the props is of type AccessibilityComponentType. That is defined as a const[] above,
9192
// but it is not rendered by the docs, since `statics` below is not rendered. So its Possible

Libraries/Experimental/SwipeableRow/SwipeableRow.js

+1
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ const RIGHT_SWIPE_THRESHOLD = 30 * SLOW_SPEED_SWIPE_FACTOR;
6363
* to use this component separately.
6464
*/
6565
const SwipeableRow = createReactClass({
66+
displayName: 'SwipeableRow',
6667
_panResponder: {},
6768
_previousLeft: CLOSED_LEFT_POSITION,
6869

Libraries/Image/Image.android.js

+1
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ var ViewStyleKeys = new Set(Object.keys(ViewStylePropTypes));
7878
var ImageSpecificStyleKeys = new Set(Object.keys(ImageStylePropTypes).filter(x => !ViewStyleKeys.has(x)));
7979

8080
var Image = createReactClass({
81+
displayName: 'Image',
8182
propTypes: {
8283
...ViewPropTypes,
8384
style: StyleSheetPropType(ImageStylePropTypes),

Libraries/Image/Image.ios.js

+1
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ const ImageViewManager = NativeModules.ImageViewManager;
128128
*/
129129
// $FlowFixMe(>=0.41.0)
130130
const Image = createReactClass({
131+
displayName: 'Image',
131132
propTypes: {
132133
/**
133134
* > `ImageResizeMode` is an `Enum` for different image resizing modes, set via the

Libraries/Lists/ListView/ListView.js

+1
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ var DEFAULT_SCROLL_CALLBACK_THROTTLE = 50;
8787
*/
8888

8989
var ListView = createReactClass({
90+
displayName: 'ListView',
9091
_childFrames: ([]: Array<Object>),
9192
_sentEndForContentLength: (null: ?number),
9293
_scrollComponent: (null: any),

Libraries/Text/Text.js

+1
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ const viewConfig = {
9898

9999
// $FlowFixMe(>=0.41.0)
100100
const Text = createReactClass({
101+
displayName: 'Text',
101102
propTypes: {
102103
/**
103104
* When `numberOfLines` is set, this prop defines how text will be truncated.

Libraries/Text/TextUpdateTest.js

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ var {
2424
var TestManager = NativeModules.TestManager || NativeModules.SnapshotTestManager;
2525

2626
var TextUpdateTest = createReactClass({
27+
displayName: 'TextUpdateTest',
2728
mixins: [TimerMixin],
2829
getInitialState: function() {
2930
return {seeMore: true};

RNTester/js/CameraRollView.js

+1
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ var propTypes = {
7373
};
7474

7575
var CameraRollView = createReactClass({
76+
displayName: 'CameraRollView',
7677
// $FlowFixMe(>=0.41.0)
7778
propTypes: propTypes,
7879

RNTester/js/ImageExample.js

+1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ const IMAGE_PREFETCH_URL = 'http://origami.design/public/images/bird-logo.png?r=
3131
var prefetchTask = Image.prefetch(IMAGE_PREFETCH_URL);
3232

3333
var NetworkImageCallbackExample = createReactClass({
34+
displayName: 'NetworkImageCallbackExample',
3435
getInitialState: function() {
3536
return {
3637
events: [],

RNTester/js/ListViewExample.js

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ var {
2626
var RNTesterPage = require('./RNTesterPage');
2727

2828
var ListViewSimpleExample = createReactClass({
29+
displayName: 'ListViewSimpleExample',
2930
statics: {
3031
title: '<ListView>',
3132
description: 'Performant, scrollable list of data.'

RNTester/js/ListViewGridLayoutExample.js

+1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ var THUMB_URLS = [
3939
];
4040

4141
var ListViewGridLayoutExample = createReactClass({
42+
displayName: 'ListViewGridLayoutExample',
4243

4344
statics: {
4445
title: '<ListView> - Grid Layout',

RNTester/js/PanResponderExample.js

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ var {
2323
var CIRCLE_SIZE = 80;
2424

2525
var PanResponderExample = createReactClass({
26+
displayName: 'PanResponderExample',
2627

2728
statics: {
2829
title: 'PanResponder Sample',

RNTester/js/ProgressBarAndroidExample.android.js

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ var RNTesterPage = require('RNTesterPage');
2020
var TimerMixin = require('react-timer-mixin');
2121

2222
var MovingBar = createReactClass({
23+
displayName: 'MovingBar',
2324
mixins: [TimerMixin],
2425

2526
getInitialState: function() {

RNTester/js/ProgressViewIOSExample.js

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ var {
2222
var TimerMixin = require('react-timer-mixin');
2323

2424
var ProgressViewExample = createReactClass({
25+
displayName: 'ProgressViewExample',
2526
mixins: [TimerMixin],
2627

2728
getInitialState() {

RNTester/js/SwipeableListViewExample.js

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ var {
2727
var RNTesterPage = require('./RNTesterPage');
2828

2929
var SwipeableListViewSimpleExample = createReactClass({
30+
displayName: 'SwipeableListViewSimpleExample',
3031
statics: {
3132
title: '<SwipeableListView>',
3233
description: 'Performant, scrollable, swipeable list of data.'

RNTester/js/TextExample.ios.js

+1
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ class AttributeToggler extends React.Component {
7474
}
7575

7676
var AdjustingFontSize = createReactClass({
77+
displayName: 'AdjustingFontSize',
7778
getInitialState: function() {
7879
return {dynamicText:'', shouldRender: true,};
7980
},

RNTester/js/TimerExample.js

+1
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ class RequestIdleCallbackTester extends React.Component {
113113
}
114114

115115
var TimerTester = createReactClass({
116+
displayName: 'TimerTester',
116117
mixins: [TimerMixin],
117118

118119
_ii: 0,

ReactAndroid/src/androidTest/js/ScrollViewTestModule.js

+2
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ var onItemPress = function(itemNumber) {
6666
};
6767

6868
var ScrollViewTestApp = createReactClass({
69+
displayName: 'ScrollViewTestApp',
6970
getInitialState: getInitialState,
7071
onScroll: onScroll,
7172
onItemPress: onItemPress,
@@ -92,6 +93,7 @@ var ScrollViewTestApp = createReactClass({
9293
});
9394

9495
var HorizontalScrollViewTestApp = createReactClass({
96+
displayName: 'HorizontalScrollViewTestApp',
9597
getInitialState: getInitialState,
9698
onScroll: onScroll,
9799
onItemPress: onItemPress,

ReactAndroid/src/androidTest/js/UIManagerTestModule.js

+6
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ var createReactClass = require('create-react-class');
2121
var renderApplication = require('renderApplication');
2222

2323
var FlexTestApp = createReactClass({
24+
displayName: 'FlexTestApp',
2425
_styles: StyleSheet.create({
2526
container: {
2627
width: 200,
@@ -49,6 +50,7 @@ var FlexTestApp = createReactClass({
4950
});
5051

5152
var FlexWithText = createReactClass({
53+
displayName: 'FlexWithText',
5254
_styles: StyleSheet.create({
5355
container: {
5456
flexDirection: 'column',
@@ -77,6 +79,7 @@ var FlexWithText = createReactClass({
7779
});
7880

7981
var AbsolutePositionTestApp = createReactClass({
82+
displayName: 'AbsolutePositionTestApp',
8083
_styles: StyleSheet.create({
8184
absolute: {
8285
position: 'absolute',
@@ -92,6 +95,7 @@ var AbsolutePositionTestApp = createReactClass({
9295
});
9396

9497
var AbsolutePositionBottomRightTestApp = createReactClass({
98+
displayName: 'AbsolutePositionBottomRightTestApp',
9599
_styles: StyleSheet.create({
96100
container: {
97101
width: 100,
@@ -115,6 +119,7 @@ var AbsolutePositionBottomRightTestApp = createReactClass({
115119
});
116120

117121
var CenteredTextView = createReactClass({
122+
displayName: 'CenteredTextView',
118123
_styles: StyleSheet.create({
119124
parent: {
120125
width: 200,
@@ -141,6 +146,7 @@ var CenteredTextView = createReactClass({
141146

142147
var flushUpdatePositionInList = null;
143148
var UpdatePositionInListTestApp = createReactClass({
149+
displayName: 'UpdatePositionInListTestApp',
144150
_styles: StyleSheet.create({
145151
element: {
146152
height: 10,

0 commit comments

Comments
 (0)