Permalink
Browse files

Convert from React.createClass to ES6 classes

Reviewed By: cpojer

Differential Revision: D3619143

fbshipit-source-id: e14e81468d467437ee3d79c34c34b7780a46ca1c
  • Loading branch information...
sophiebits authored and Facebook Github Bot 8 committed Jul 26, 2016
1 parent 857d2b8 commit a2fb703bbb988038323c55b29b40e8f5ff52966d
Showing with 2,125 additions and 2,192 deletions.
  1. +3 −3 Examples/Movies/MovieCell.js
  2. +12 −12 Examples/Movies/MovieScreen.js
  3. +3 −3 Examples/Movies/MoviesApp.android.js
  4. +3 −3 Examples/Movies/MoviesApp.ios.js
  5. +3 −3 Examples/Movies/SearchBar.android.js
  6. +3 −3 Examples/Movies/SearchBar.ios.js
  7. +3 −3 Examples/Movies/SearchScreen.js
  8. +10 −10 Examples/TicTacToe/TicTacToeApp.js
  9. +17 −22 Examples/UIExplorer/js/AccessibilityAndroidExample.android.js
  10. +3 −3 Examples/UIExplorer/js/AccessibilityIOSExample.js
  11. +32 −40 Examples/UIExplorer/js/ActionSheetIOSExample.js
  12. +17 −19 Examples/UIExplorer/js/AdSupportIOSExample.js
  13. +12 −13 Examples/UIExplorer/js/AlertExample.js
  14. +20 −17 Examples/UIExplorer/js/AppStateExample.js
  15. +6 −9 Examples/UIExplorer/js/AssetScaledImageExample.js
  16. +17 −19 Examples/UIExplorer/js/AsyncStorageExample.js
  17. +16 −19 Examples/UIExplorer/js/CameraRollExample.js
  18. +7 −9 Examples/UIExplorer/js/ClipboardExample.js
  19. +16 −21 Examples/UIExplorer/js/DatePickerAndroidExample.js
  20. +22 −26 Examples/UIExplorer/js/DatePickerIOSExample.js
  21. +12 −14 Examples/UIExplorer/js/GeolocationExample.js
  22. +3 −3 Examples/UIExplorer/js/ImageCapInsetsExample.js
  23. +13 −17 Examples/UIExplorer/js/KeyboardAvoidingViewExample.js
  24. +19 −25 Examples/UIExplorer/js/LayoutAnimationExample.js
  25. +27 −22 Examples/UIExplorer/js/LayoutEventsExample.js
  26. +12 −15 Examples/UIExplorer/js/LayoutExample.js
  27. +13 −17 Examples/UIExplorer/js/LinkingExample.js
  28. +37 −34 Examples/UIExplorer/js/ListViewPagingExample.js
  29. +35 −47 Examples/UIExplorer/js/MapViewExample.js
  30. +23 −27 Examples/UIExplorer/js/ModalExample.js
  31. +11 −12 Examples/UIExplorer/js/NativeAnimationsExample.js
  32. +4 −4 Examples/UIExplorer/js/NavigationExperimental/NavigationExampleRow.js
  33. +21 −25 Examples/UIExplorer/js/NavigationExperimental/NavigationExperimentalExample.js
  34. +8 −12 Examples/UIExplorer/js/Navigator/BreadcrumbNavSample.js
  35. +6 −6 Examples/UIExplorer/js/Navigator/JumpingNavSample.js
  36. +8 −10 Examples/UIExplorer/js/Navigator/NavigationBarSample.js
  37. +12 −16 Examples/UIExplorer/js/Navigator/NavigatorExample.js
  38. +10 −16 Examples/UIExplorer/js/NavigatorIOSColorsExample.js
  39. +23 −25 Examples/UIExplorer/js/NavigatorIOSExample.js
  40. +54 −48 Examples/UIExplorer/js/NetInfoExample.js
  41. +18 −20 Examples/UIExplorer/js/PermissionsExampleAndroid.android.js
  42. +18 −22 Examples/UIExplorer/js/PickerExample.js
  43. +16 −20 Examples/UIExplorer/js/PickerIOSExample.js
  44. +28 −27 Examples/UIExplorer/js/PointerEventsExample.js
  45. +6 −9 Examples/UIExplorer/js/ProgressBarAndroidExample.android.js
  46. +3 −3 Examples/UIExplorer/js/PushNotificationIOSExample.js
  47. +22 −25 Examples/UIExplorer/js/RefreshControlExample.js
  48. +6 −5 Examples/UIExplorer/js/ScrollViewExample.js
  49. +8 −9 Examples/UIExplorer/js/ScrollViewSimpleExample.js
  50. +24 −26 Examples/UIExplorer/js/SegmentedControlIOSExample.js
  51. +14 −20 Examples/UIExplorer/js/SliderExample.js
  52. +5 −7 Examples/UIExplorer/js/SliderIOSExample.js
  53. +8 −10 Examples/UIExplorer/js/SnapshotExample.js
  54. +62 −73 Examples/UIExplorer/js/StatusBarExample.js
  55. +25 −28 Examples/UIExplorer/js/SwitchExample.js
  56. +14 −20 Examples/UIExplorer/js/TabBarIOSExample.js
  57. +20 −20 Examples/UIExplorer/js/TextExample.android.js
  58. +14 −13 Examples/UIExplorer/js/TextExample.ios.js
  59. +15 −17 Examples/UIExplorer/js/TextInputExample.android.js
  60. +20 −22 Examples/UIExplorer/js/TextInputExample.ios.js
  61. +14 −22 Examples/UIExplorer/js/TimePickerAndroidExample.js
  62. +27 −30 Examples/UIExplorer/js/TimerExample.js
  63. +7 −13 Examples/UIExplorer/js/ToastAndroidExample.android.js
  64. +19 −20 Examples/UIExplorer/js/ToolbarAndroidExample.android.js
  65. +56 −56 Examples/UIExplorer/js/TouchableExample.js
  66. +8 −10 Examples/UIExplorer/js/TransformExample.js
  67. +4 −4 Examples/UIExplorer/js/TransparentHitTestExample.js
  68. +5 −4 Examples/UIExplorer/js/UIExplorerApp.ios.js
  69. +14 −9 Examples/UIExplorer/js/UIExplorerBlock.js
  70. +12 −7 Examples/UIExplorer/js/UIExplorerButton.js
  71. +15 −7 Examples/UIExplorer/js/UIExplorerPage.js
  72. +3 −3 Examples/UIExplorer/js/UIExplorerTitle.js
  73. +16 −20 Examples/UIExplorer/js/ViewExample.js
  74. +46 −48 Examples/UIExplorer/js/ViewPagerAndroidExample.android.js
  75. +42 −48 Examples/UIExplorer/js/WebViewExample.js
  76. +7 −9 Examples/UIExplorer/js/createExamplePage.js
  77. +11 −10 IntegrationTests/AppEventsTest.js
  78. +7 −9 IntegrationTests/AsyncStorageTest.js
  79. +5 −5 IntegrationTests/ImageSnapshotTest.js
  80. +15 −12 IntegrationTests/IntegrationTestHarnessTest.js
  81. +7 −8 IntegrationTests/IntegrationTestsApp.js
  82. +18 −17 IntegrationTests/PromiseTest.js
  83. +2 −3 IntegrationTests/PropertiesUpdateTest.js
  84. +7 −8 IntegrationTests/RCTRootViewIntegrationTestApp.js
  85. +5 −5 IntegrationTests/SimpleSnapshotTest.js
  86. +15 −25 Libraries/ART/ReactNativeART.js
  87. +2 −2 Libraries/Components/ActivityIndicator/ActivityIndicatorIOS.android.js
  88. +4 −4 Libraries/Components/DatePicker/DatePickerIOS.android.js
  89. +6 −6 Libraries/Components/Navigation/NavigatorIOS.ios.js
  90. +111 −95 Libraries/Components/Picker/Picker.js
  91. +34 −21 Libraries/Components/Picker/PickerAndroid.android.js
  92. +6 −6 Libraries/Components/Picker/PickerIOS.ios.js
  93. +4 −4 Libraries/Components/ProgressViewIOS/ProgressViewIOS.android.js
  94. +4 −4 Libraries/Components/SegmentedControlIOS/SegmentedControlIOS.android.js
  95. +13 −8 Libraries/Components/StaticRenderer.js
  96. +122 −111 Libraries/Components/StatusBar/StatusBar.js
  97. +4 −4 Libraries/Components/SwitchIOS/SwitchIOS.android.js
  98. +3 −3 Libraries/Components/TabBarIOS/TabBarIOS.android.js
  99. +18 −9 Libraries/Components/TabBarIOS/TabBarIOS.ios.js
  100. +3 −3 Libraries/Components/TabBarIOS/TabBarItemIOS.android.js
  101. +12 −14 Libraries/Components/TabBarIOS/TabBarItemIOS.ios.js
  102. +4 −4 Libraries/Components/Touchable/TouchableNativeFeedback.ios.js
  103. +7 −6 Libraries/Components/UnimplementedViews/UnimplementedView.js
  104. +32 −23 Libraries/Components/ViewPager/ViewPagerAndroid.android.js
  105. +35 −40 Libraries/Components/WebView/WebView.android.js
  106. +33 −37 Libraries/Components/WebView/WebView.ios.js
  107. +31 −33 Libraries/CustomComponents/Navigator/NavigatorBreadcrumbNavigationBar.js
  108. +28 −45 Libraries/CustomComponents/Navigator/NavigatorNavigationBar.js
  109. +42 −43 Libraries/Experimental/SwipeableRow/SwipeableListView.js
  110. +16 −5 Libraries/Experimental/SwipeableRow/SwipeableQuickActionButton.js
  111. +9 −5 Libraries/Experimental/SwipeableRow/SwipeableQuickActions.js
  112. +20 −7 Libraries/Inspector/ElementProperties.js
  113. +18 −9 Libraries/Inspector/InspectorOverlay.js
  114. +3 −3 Libraries/Inspector/PerformanceOverlay.js
  115. +18 −13 Libraries/RCTTest/SnapshotViewIOS.ios.js
  116. +7 −6 ReactAndroid/src/androidTest/js/CatalystRootViewTestModule.js
  117. +4 −4 ReactAndroid/src/androidTest/js/DatePickerDialogTestModule.js
  118. +6 −5 ReactAndroid/src/androidTest/js/InitialPropsTestApp.js
  119. +10 −8 ReactAndroid/src/androidTest/js/JSResponderTestApp.js
  120. +6 −6 ReactAndroid/src/androidTest/js/LayoutEventsTestApp.js
  121. +7 −6 ReactAndroid/src/androidTest/js/MeasureLayoutTestModule.js
  122. +16 −12 ReactAndroid/src/androidTest/js/MultitouchHandlingTestAppModule.js
  123. +17 −15 ReactAndroid/src/androidTest/js/PickerAndroidTestModule.js
  124. +6 −7 ReactAndroid/src/androidTest/js/ProgressBarTestModule.js
  125. +4 −4 ReactAndroid/src/androidTest/js/ScrollViewTestModule.js
  126. +4 −4 ReactAndroid/src/androidTest/js/ShareTestModule.js
  127. +28 −26 ReactAndroid/src/androidTest/js/SubviewsClippingTestModule.js
  128. +19 −22 ReactAndroid/src/androidTest/js/SwipeRefreshLayoutTestModule.js
  129. +4 −4 ReactAndroid/src/androidTest/js/TestIdTestModule.js
  130. +6 −6 ReactAndroid/src/androidTest/js/TextInputTestModule.js
  131. +4 −4 ReactAndroid/src/androidTest/js/TimePickerDialogTestModule.js
  132. +7 −6 ReactAndroid/src/androidTest/js/TouchBubblingTestAppModule.js
  133. +19 −20 ReactAndroid/src/androidTest/js/ViewRenderingTestModule.js
@@ -31,8 +31,8 @@ var getStyleFromScore = require('./getStyleFromScore');
var getImageSource = require('./getImageSource');
var getTextFromScore = require('./getTextFromScore');
var MovieCell = React.createClass({
render: function() {
class MovieCell extends React.Component {
render() {
var criticsScore = this.props.movie.ratings.critics_score;
var TouchableElement = TouchableHighlight;
if (Platform.OS === 'android') {
@@ -66,7 +66,7 @@ var MovieCell = React.createClass({
</View>
);
}
});
}
var styles = StyleSheet.create({
textContainer: {
@@ -29,8 +29,8 @@ var getImageSource = require('./getImageSource');
var getStyleFromScore = require('./getStyleFromScore');
var getTextFromScore = require('./getTextFromScore');
var MovieScreen = React.createClass({
render: function() {
class MovieScreen extends React.Component {
render() {
return (
<ScrollView contentContainerStyle={styles.contentContainer}>
<View style={styles.mainSection}>
@@ -57,11 +57,11 @@ var MovieScreen = React.createClass({
<Cast actors={this.props.movie.abridged_cast} />
</ScrollView>
);
},
});
}
}
var Ratings = React.createClass({
render: function() {
class Ratings extends React.Component {
render() {
var criticsScore = this.props.ratings.critics_score;
var audienceScore = this.props.ratings.audience_score;
@@ -81,11 +81,11 @@ var Ratings = React.createClass({
</View>
</View>
);
},
});
}
}
var Cast = React.createClass({
render: function() {
class Cast extends React.Component {
render() {
if (!this.props.actors) {
return null;
}
@@ -100,8 +100,8 @@ var Cast = React.createClass({
)}
</View>
);
},
});
}
}
var styles = StyleSheet.create({
contentContainer: {
@@ -65,8 +65,8 @@ var RouteMapper = function(route, navigationOperations, onComponentRef) {
}
};
var MoviesApp = React.createClass({
render: function() {
class MoviesApp extends React.Component {
render() {
var initialRoute = {name: 'search'};
return (
<Navigator
@@ -77,7 +77,7 @@ var MoviesApp = React.createClass({
/>
);
}
});
}
var styles = StyleSheet.create({
container: {
@@ -26,8 +26,8 @@ var {
var SearchScreen = require('./SearchScreen');
var MoviesApp = React.createClass({
render: function() {
class MoviesApp extends React.Component {
render() {
return (
<NavigatorIOS
style={styles.container}
@@ -38,7 +38,7 @@ var MoviesApp = React.createClass({
/>
);
}
});
}
var styles = StyleSheet.create({
container: {
@@ -30,8 +30,8 @@ var {
var IS_RIPPLE_EFFECT_SUPPORTED = Platform.Version >= 21;
var SearchBar = React.createClass({
render: function() {
class SearchBar extends React.Component {
render() {
var background = IS_RIPPLE_EFFECT_SUPPORTED ?
TouchableNativeFeedback.SelectableBackgroundBorderless() :
TouchableNativeFeedback.SelectableBackground();
@@ -67,7 +67,7 @@ var SearchBar = React.createClass({
</View>
);
}
});
}
var styles = StyleSheet.create({
searchBar: {
@@ -25,8 +25,8 @@ var {
View,
} = ReactNative;
var SearchBar = React.createClass({
render: function() {
class SearchBar extends React.Component {
render() {
return (
<View style={styles.searchBar}>
<TextInput
@@ -44,7 +44,7 @@ var SearchBar = React.createClass({
</View>
);
}
});
}
var styles = StyleSheet.create({
searchBar: {
@@ -318,8 +318,8 @@ var SearchScreen = React.createClass({
},
});
var NoMovies = React.createClass({
render: function() {
class NoMovies extends React.Component {
render() {
var text = '';
if (this.props.filter) {
text = `No results for "${this.props.filter}"`;
@@ -335,7 +335,7 @@ var NoMovies = React.createClass({
</View>
);
}
});
}
var styles = StyleSheet.create({
container: {
@@ -94,8 +94,8 @@ class Board {
}
}
var Cell = React.createClass({
cellStyle() {
class Cell extends React.Component {
cellStyle = () => {
switch (this.props.player) {
case 1:
return styles.cellX;
@@ -104,9 +104,9 @@ var Cell = React.createClass({
default:
return null;
}
},
};
textStyle() {
textStyle = () => {
switch (this.props.player) {
case 1:
return styles.cellTextX;
@@ -115,9 +115,9 @@ var Cell = React.createClass({
default:
return {};
}
},
};
textContents() {
textContents = () => {
switch (this.props.player) {
case 1:
return 'X';
@@ -126,7 +126,7 @@ var Cell = React.createClass({
default:
return '';
}
},
};
render() {
return (
@@ -142,9 +142,9 @@ var Cell = React.createClass({
</TouchableHighlight>
);
}
});
}
var GameEndOverlay = React.createClass({
class GameEndOverlay extends React.Component {
render() {
var board = this.props.board;
@@ -175,7 +175,7 @@ var GameEndOverlay = React.createClass({
</View>
);
}
});
}
var TicTacToeApp = React.createClass({
getInitialState() {
@@ -36,40 +36,35 @@ var UIExplorerPage = require('./UIExplorerPage');
var importantForAccessibilityValues = ['auto', 'yes', 'no', 'no-hide-descendants'];
var AccessibilityAndroidExample = React.createClass({
class AccessibilityAndroidExample extends React.Component {
static title = 'Accessibility';
static description = 'Examples of using Accessibility API.';
statics: {
title: 'Accessibility',
description: 'Examples of using Accessibility API.',
},
getInitialState: function() {
return {
count: 0,
backgroundImportantForAcc: 0,
forgroundImportantForAcc: 0,
};
},
state = {
count: 0,
backgroundImportantForAcc: 0,
forgroundImportantForAcc: 0,
};
_addOne: function() {
_addOne = () => {
this.setState({
count: ++this.state.count,
});
},
};
_changeBackgroundImportantForAcc: function() {
_changeBackgroundImportantForAcc = () => {
this.setState({
backgroundImportantForAcc: (this.state.backgroundImportantForAcc + 1) % 4,
});
},
};
_changeForgroundImportantForAcc: function() {
_changeForgroundImportantForAcc = () => {
this.setState({
forgroundImportantForAcc: (this.state.forgroundImportantForAcc + 1) % 4,
});
},
};
render: function() {
render() {
return (
<UIExplorerPage title={'Accessibility'}>
@@ -202,8 +197,8 @@ var AccessibilityAndroidExample = React.createClass({
</UIExplorerPage>
);
},
});
}
}
var styles = StyleSheet.create({
embedded: {
@@ -29,7 +29,7 @@ var {
View,
} = ReactNative;
var AccessibilityIOSExample = React.createClass({
class AccessibilityIOSExample extends React.Component {
render() {
return (
<View>
@@ -60,8 +60,8 @@ var AccessibilityIOSExample = React.createClass({
</View>
</View>
);
},
});
}
}
exports.title = 'AccessibilityIOS';
exports.description = 'Interface to show iOS\' accessibility samples';
Oops, something went wrong.

0 comments on commit a2fb703

Please sign in to comment.