remove createReactClass from RNTester/js/SwipeableFlatListExample.js (#21613)

Summary:
Related to #21581 .
Removed createReactClass from the RNTester/js/SwipeableFlatListExample.js

Test Plan
-----

 - [x]  npm run prettier
- [x]  npm run flow-check-ios
- [x]  npm run flow-check-android
- [x]  Run RNTester app, go to SwipeableFlatList component, everything works.

Release Notes
--------

[GENERAL] [ENHANCEMENT] [RNTester/js/SwipeableFlatListExample.js] - remove createReactClass dependency
Pull Request resolved: https://github.com/facebook/react-native/pull/21613

Differential Revision: D10275399

Pulled By: RSNara

fbshipit-source-id: 63030ca7da979a3d25bb94d52d4fd59994504aa3
This commit is contained in:
Himanshu Soni 2018-10-09 17:11:24 -07:00 committed by Facebook Github Bot
parent 80fd4bb2f5
commit b32029f346

View File

@ -10,7 +10,6 @@
'use strict'; 'use strict';
const React = require('react'); const React = require('react');
const createReactClass = require('create-react-class');
const ReactNative = require('react-native'); const ReactNative = require('react-native');
const { const {
Image, Image,
@ -24,6 +23,8 @@ const {
const RNTesterPage = require('./RNTesterPage'); const RNTesterPage = require('./RNTesterPage');
import type {RNTesterProps} from 'RNTesterTypes';
const data = [ const data = [
{ {
key: 'like', key: 'like',
@ -42,14 +43,11 @@ const data = [
}, },
]; ];
const SwipeableFlatListExample = createReactClass({ class SwipeableFlatListExample extends React.Component<RNTesterProps> {
displayName: 'SwipeableFlatListExample', static title = '<SwipeableFlatList>';
statics: { static description = 'Performant, scrollable, swipeable list of data.';
title: '<SwipeableFlatList>',
description: 'Performant, scrollable, swipeable list of data.',
},
render: function() { render() {
return ( return (
<RNTesterPage <RNTesterPage
title={this.props.navigator ? null : '<SwipeableListView>'} title={this.props.navigator ? null : '<SwipeableListView>'}
@ -64,9 +62,9 @@ const SwipeableFlatListExample = createReactClass({
/> />
</RNTesterPage> </RNTesterPage>
); );
}, }
_renderItem: function({item}): ?React.Element<any> { _renderItem({item}): ?React.Element<any> {
return ( return (
<View style={styles.row}> <View style={styles.row}>
<Image style={styles.rowIcon} source={item.icon} /> <Image style={styles.rowIcon} source={item.icon} />
@ -75,9 +73,9 @@ const SwipeableFlatListExample = createReactClass({
</View> </View>
</View> </View>
); );
}, }
_renderQuickActions: function({item}: Object): ?React.Element<any> { _renderQuickActions({item}: Object): ?React.Element<any> {
return ( return (
<View style={styles.actionsContainer}> <View style={styles.actionsContainer}>
<TouchableHighlight <TouchableHighlight
@ -102,8 +100,8 @@ const SwipeableFlatListExample = createReactClass({
</TouchableHighlight> </TouchableHighlight>
</View> </View>
); );
}, }
}); }
var styles = StyleSheet.create({ var styles = StyleSheet.create({
row: { row: {