Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Migrate away from React.createClass for non-auth structures. React 16 :D #3365

Merged
merged 1 commit into from
Sep 1, 2019
Merged
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
3 changes: 2 additions & 1 deletion src/components/structures/CompatibilityPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@ limitations under the License.
*/

import React from 'react';
import createReactClass from 'create-react-class';
import PropTypes from 'prop-types';
import { _t } from '../../languageHandler';

module.exports = React.createClass({
module.exports = createReactClass({
displayName: 'CompatibilityPage',
propTypes: {
onAccept: PropTypes.func,
Expand Down
3 changes: 2 additions & 1 deletion src/components/structures/FilePanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ limitations under the License.
*/

import React from 'react';
import createReactClass from 'create-react-class';
import PropTypes from 'prop-types';

import Matrix from 'matrix-js-sdk';
Expand All @@ -25,7 +26,7 @@ import { _t } from '../../languageHandler';
/*
* Component which shows the filtered file using a TimelinePanel
*/
const FilePanel = React.createClass({
const FilePanel = createReactClass({
displayName: 'FilePanel',

propTypes: {
Expand Down
11 changes: 6 additions & 5 deletions src/components/structures/GroupView.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ limitations under the License.
*/

import React from 'react';
import createReactClass from 'create-react-class';
import PropTypes from 'prop-types';
import Promise from 'bluebird';
import MatrixClientPeg from '../../MatrixClientPeg';
Expand Down Expand Up @@ -67,7 +68,7 @@ const UserSummaryType = PropTypes.shape({
}).isRequired,
});

const CategoryRoomList = React.createClass({
const CategoryRoomList = createReactClass({
displayName: 'CategoryRoomList',

props: {
Expand Down Expand Up @@ -156,7 +157,7 @@ const CategoryRoomList = React.createClass({
},
});

const FeaturedRoom = React.createClass({
const FeaturedRoom = createReactClass({
displayName: 'FeaturedRoom',

props: {
Expand Down Expand Up @@ -244,7 +245,7 @@ const FeaturedRoom = React.createClass({
},
});

const RoleUserList = React.createClass({
const RoleUserList = createReactClass({
displayName: 'RoleUserList',

props: {
Expand Down Expand Up @@ -327,7 +328,7 @@ const RoleUserList = React.createClass({
},
});

const FeaturedUser = React.createClass({
const FeaturedUser = createReactClass({
displayName: 'FeaturedUser',

props: {
Expand Down Expand Up @@ -399,7 +400,7 @@ const FeaturedUser = React.createClass({
const GROUP_JOINPOLICY_OPEN = "open";
const GROUP_JOINPOLICY_INVITE = "invite";

export default React.createClass({
export default createReactClass({
displayName: 'GroupView',

propTypes: {
Expand Down
3 changes: 2 additions & 1 deletion src/components/structures/InteractiveAuth.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,14 @@ import Matrix from 'matrix-js-sdk';
const InteractiveAuth = Matrix.InteractiveAuth;

import React from 'react';
import createReactClass from 'create-react-class';
import PropTypes from 'prop-types';

import {getEntryComponentForLoginType} from '../views/auth/InteractiveAuthEntryComponents';

import sdk from '../../index';

export default React.createClass({
export default createReactClass({
displayName: 'InteractiveAuth',

propTypes: {
Expand Down
5 changes: 2 additions & 3 deletions src/components/structures/LeftPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

'use strict';

import React from 'react';
import createReactClass from 'create-react-class';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { MatrixClient } from 'matrix-js-sdk';
Expand All @@ -30,7 +29,7 @@ import {_t} from "../../languageHandler";
import Analytics from "../../Analytics";


const LeftPanel = React.createClass({
const LeftPanel = createReactClass({
displayName: 'LeftPanel',

// NB. If you add props, don't forget to update
Expand Down
3 changes: 2 additions & 1 deletion src/components/structures/LoggedInView.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ limitations under the License.

import { MatrixClient } from 'matrix-js-sdk';
import React from 'react';
import createReactClass from 'create-react-class';
import PropTypes from 'prop-types';
import { DragDropContext } from 'react-beautiful-dnd';

Expand Down Expand Up @@ -58,7 +59,7 @@ function canElementReceiveInput(el) {
*
* Components mounted below us can access the matrix client via the react context.
*/
const LoggedInView = React.createClass({
const LoggedInView = createReactClass({
displayName: 'LoggedInView',

propTypes: {
Expand Down
3 changes: 2 additions & 1 deletion src/components/structures/MatrixChat.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ limitations under the License.
import Promise from 'bluebird';

import React from 'react';
import createReactClass from 'create-react-class';
import PropTypes from 'prop-types';
import Matrix from "matrix-js-sdk";

Expand Down Expand Up @@ -106,7 +107,7 @@ const ONBOARDING_FLOW_STARTERS = [
'view_create_group',
];

export default React.createClass({
export default createReactClass({
// we export this so that the integration tests can use it :-S
statics: {
VIEWS: VIEWS,
Expand Down
3 changes: 2 additions & 1 deletion src/components/structures/MessagePanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ limitations under the License.
/* global Velocity */

import React from 'react';
import createReactClass from 'create-react-class';
import ReactDOM from 'react-dom';
import PropTypes from 'prop-types';
import classNames from 'classnames';
Expand All @@ -35,7 +36,7 @@ const isMembershipChange = (e) => e.getType() === 'm.room.member' || e.getType()

/* (almost) stateless UI component which builds the event tiles in the room timeline.
*/
module.exports = React.createClass({
module.exports = createReactClass({
displayName: 'MessagePanel',

propTypes: {
Expand Down
3 changes: 2 additions & 1 deletion src/components/structures/MyGroups.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,15 @@ limitations under the License.
*/

import React from 'react';
import createReactClass from 'create-react-class';
import PropTypes from 'prop-types';
import { MatrixClient } from 'matrix-js-sdk';
import sdk from '../../index';
import { _t } from '../../languageHandler';
import dis from '../../dispatcher';
import AccessibleButton from '../views/elements/AccessibleButton';

export default React.createClass({
export default createReactClass({
displayName: 'MyGroups',

getInitialState: function() {
Expand Down
5 changes: 3 additions & 2 deletions src/components/structures/NotificationPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,16 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

const React = require('react');
import React from 'react';
import createReactClass from 'create-react-class';
import { _t } from '../../languageHandler';
const sdk = require('../../index');
const MatrixClientPeg = require("../../MatrixClientPeg");

/*
* Component which shows the global notification list using a TimelinePanel
*/
const NotificationPanel = React.createClass({
const NotificationPanel = createReactClass({
displayName: 'NotificationPanel',

propTypes: {
Expand Down
7 changes: 3 additions & 4 deletions src/components/structures/RoomDirectory.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

'use strict';

const React = require('react');
import React from 'react';
import createReactClass from 'create-react-class';

const MatrixClientPeg = require('../../MatrixClientPeg');
const ContentRepo = require("matrix-js-sdk").ContentRepo;
Expand All @@ -39,7 +38,7 @@ function track(action) {
Analytics.trackEvent('RoomDirectory', action);
}

module.exports = React.createClass({
module.exports = createReactClass({
displayName: 'RoomDirectory',

propTypes: {
Expand Down
5 changes: 2 additions & 3 deletions src/components/structures/RoomStatusBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,12 @@ limitations under the License.
*/

import React from 'react';
import createReactClass from 'create-react-class';
import PropTypes from 'prop-types';
import Matrix from 'matrix-js-sdk';
import { _t, _td } from '../../languageHandler';
import sdk from '../../index';
import WhoIsTyping from '../../WhoIsTyping';
import MatrixClientPeg from '../../MatrixClientPeg';
import MemberAvatar from '../views/avatars/MemberAvatar';
import Resend from '../../Resend';
import * as cryptodevices from '../../cryptodevices';
import dis from '../../dispatcher';
Expand All @@ -39,7 +38,7 @@ function getUnsentMessages(room) {
});
}

module.exports = React.createClass({
module.exports = createReactClass({
displayName: 'RoomStatusBar',

propTypes: {
Expand Down
3 changes: 2 additions & 1 deletion src/components/structures/RoomSubList.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ limitations under the License.
*/

import React from 'react';
import createReactClass from 'create-react-class';
import classNames from 'classnames';
import sdk from '../../index';
import dis from '../../dispatcher';
Expand All @@ -34,7 +35,7 @@ import {_t} from "../../languageHandler";
// turn this on for drop & drag console debugging galore
const debug = false;

const RoomSubList = React.createClass({
const RoomSubList = createReactClass({
displayName: 'RoomSubList',

debug: debug,
Expand Down
3 changes: 2 additions & 1 deletion src/components/structures/RoomView.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ limitations under the License.
import shouldHideEvent from '../../shouldHideEvent';

import React from 'react';
import createReactClass from 'create-react-class';
import ReactDOM from 'react-dom';
import PropTypes from 'prop-types';
import Promise from 'bluebird';
Expand Down Expand Up @@ -70,7 +71,7 @@ const RoomContext = PropTypes.shape({
room: PropTypes.instanceOf(Room),
});

module.exports = React.createClass({
module.exports = createReactClass({
displayName: 'RoomView',
propTypes: {
ConferenceHandler: PropTypes.any,
Expand Down
5 changes: 3 additions & 2 deletions src/components/structures/ScrollPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

const React = require("react");
import React from "react";
import createReactClass from 'create-react-class';
import PropTypes from 'prop-types';
import Promise from 'bluebird';
import { KeyCode } from '../../Keyboard';
Expand Down Expand Up @@ -84,7 +85,7 @@ if (DEBUG_SCROLL) {
* offset as normal.
*/

module.exports = React.createClass({
module.exports = createReactClass({
displayName: 'ScrollPanel',

propTypes: {
Expand Down
3 changes: 2 additions & 1 deletion src/components/structures/SearchBox.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,14 @@ limitations under the License.
*/

import React from 'react';
import createReactClass from 'create-react-class';
import PropTypes from 'prop-types';
import { KeyCode } from '../../Keyboard';
import dis from '../../dispatcher';
import { throttle } from 'lodash';
import AccessibleButton from '../../components/views/elements/AccessibleButton';

module.exports = React.createClass({
module.exports = createReactClass({
displayName: 'SearchBox',

propTypes: {
Expand Down
3 changes: 2 additions & 1 deletion src/components/structures/TagPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ limitations under the License.
*/

import React from 'react';
import createReactClass from 'create-react-class';
import PropTypes from 'prop-types';
import { MatrixClient } from 'matrix-js-sdk';
import TagOrderStore from '../../stores/TagOrderStore';
Expand All @@ -28,7 +29,7 @@ import { _t } from '../../languageHandler';
import { Droppable } from 'react-beautiful-dnd';
import classNames from 'classnames';

const TagPanel = React.createClass({
const TagPanel = createReactClass({
displayName: 'TagPanel',

contextTypes: {
Expand Down
3 changes: 2 additions & 1 deletion src/components/structures/TagPanelButtons.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,13 @@ limitations under the License.
*/

import React from 'react';
import createReactClass from 'create-react-class';
import sdk from '../../index';
import dis from '../../dispatcher';
import Modal from '../../Modal';
import { _t } from '../../languageHandler';

const TagPanelButtons = React.createClass({
const TagPanelButtons = createReactClass({
displayName: 'TagPanelButtons',


Expand Down
7 changes: 4 additions & 3 deletions src/components/structures/TimelinePanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ limitations under the License.

import SettingsStore from "../../settings/SettingsStore";

const React = require('react');
const ReactDOM = require("react-dom");
import React from 'react';
import createReactClass from 'create-react-class';
import ReactDOM from "react-dom";
import PropTypes from 'prop-types';
import Promise from 'bluebird';

Expand Down Expand Up @@ -58,7 +59,7 @@ if (DEBUG) {
*
* Also responsible for handling and sending read receipts.
*/
const TimelinePanel = React.createClass({
const TimelinePanel = createReactClass({
displayName: 'TimelinePanel',

propTypes: {
Expand Down
6 changes: 4 additions & 2 deletions src/components/structures/UploadBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,16 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

const React = require('react');
import React from 'react';
import createReactClass from 'create-react-class';
import PropTypes from 'prop-types';
import ContentMessages from '../../ContentMessages';
const dis = require('../../dispatcher');
const filesize = require('filesize');
import { _t } from '../../languageHandler';

module.exports = React.createClass({displayName: 'UploadBar',
module.exports = createReactClass({
displayName: 'UploadBar',
propTypes: {
room: PropTypes.object,
},
Expand Down
Loading