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

Commit

Permalink
Merge pull request #3405 from matrix-org/t3chguy/react16_11
Browse files Browse the repository at this point in the history
Switch to createReactClass: *everything else*. React 16 :D
  • Loading branch information
t3chguy authored Sep 6, 2019
2 parents 1325813 + b243004 commit 6dbc9ee
Show file tree
Hide file tree
Showing 35 changed files with 90 additions and 85 deletions.
3 changes: 2 additions & 1 deletion src/components/views/avatars/BaseAvatar.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,13 @@ limitations under the License.

import React from 'react';
import PropTypes from 'prop-types';
import createReactClass from 'create-react-class';
import { MatrixClient } from 'matrix-js-sdk';
import AvatarLogic from '../../../Avatar';
import SettingsStore from "../../../settings/SettingsStore";
import AccessibleButton from '../elements/AccessibleButton';

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

propTypes: {
Expand Down
3 changes: 2 additions & 1 deletion src/components/views/avatars/GroupAvatar.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 PropTypes from 'prop-types';
import createReactClass from 'create-react-class';
import sdk from '../../../index';
import MatrixClientPeg from '../../../MatrixClientPeg';

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

propTypes: {
Expand Down
7 changes: 3 additions & 4 deletions src/components/views/avatars/MemberAvatar.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,14 @@ 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 PropTypes from 'prop-types';
import createReactClass from 'create-react-class';
const Avatar = require('../../../Avatar');
const sdk = require("../../../index");
const dispatcher = require("../../../dispatcher");

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

propTypes: {
Expand Down
3 changes: 2 additions & 1 deletion src/components/views/avatars/RoomAvatar.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,14 @@ limitations under the License.
*/
import React from "react";
import PropTypes from 'prop-types';
import createReactClass from 'create-react-class';
import {ContentRepo} from "matrix-js-sdk";
import MatrixClientPeg from "../../../MatrixClientPeg";
import Modal from '../../../Modal';
import sdk from "../../../index";
import Avatar from '../../../Avatar';

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

// Room may be left unset here, but if it is,
Expand Down
3 changes: 2 additions & 1 deletion src/components/views/context_menus/MessageContextMenu.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 PropTypes from 'prop-types';
import createReactClass from 'create-react-class';
import {EventStatus} from 'matrix-js-sdk';

import MatrixClientPeg from '../../../MatrixClientPeg';
Expand All @@ -33,7 +34,7 @@ function canCancel(eventStatus) {
return eventStatus === EventStatus.QUEUED || eventStatus === EventStatus.NOT_SENT;
}

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

propTypes: {
Expand Down
5 changes: 3 additions & 2 deletions src/components/views/context_menus/RoomTileContextMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ limitations under the License.

import Promise from 'bluebird';
import React from 'react';
import classNames from 'classnames';
import PropTypes from 'prop-types';
import createReactClass from 'create-react-class';
import classNames from 'classnames';
import sdk from '../../../index';
import { _t, _td } from '../../../languageHandler';
import MatrixClientPeg from '../../../MatrixClientPeg';
Expand All @@ -31,7 +32,7 @@ import Modal from '../../../Modal';
import RoomListActions from '../../../actions/RoomListActions';
import RoomViewStore from '../../../stores/RoomViewStore';

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

propTypes: {
Expand Down
6 changes: 3 additions & 3 deletions src/components/views/create_room/CreateRoomButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

'use strict';

import React from 'react';
import PropTypes from 'prop-types';
import createReactClass from 'create-react-class';
import { _t } from '../../../languageHandler';
module.exports = React.createClass({

module.exports = createReactClass({
displayName: 'CreateRoomButton',
propTypes: {
onCreateRoom: PropTypes.func,
Expand Down
7 changes: 3 additions & 4 deletions src/components/views/create_room/Presets.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,9 @@ 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 PropTypes from 'prop-types';
import createReactClass from 'create-react-class';
import { _t } from '../../../languageHandler';

const Presets = {
Expand All @@ -26,7 +25,7 @@ const Presets = {
Custom: "custom",
};

module.exports = React.createClass({
module.exports = createReactClass({
displayName: 'CreateRoomPresets',
propTypes: {
onChange: PropTypes.func,
Expand Down
5 changes: 3 additions & 2 deletions src/components/views/create_room/RoomAlias.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

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

module.exports = React.createClass({
module.exports = createReactClass({
displayName: 'RoomAlias',
propTypes: {
// Specifying a homeserver will make magical things happen when you,
Expand Down
5 changes: 2 additions & 3 deletions src/components/views/globals/MatrixToolbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,13 @@ 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 { _t } from '../../../languageHandler';
import Notifier from '../../../Notifier';
import AccessibleButton from '../../../components/views/elements/AccessibleButton';

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

hideToolbar: function() {
Expand Down
3 changes: 2 additions & 1 deletion src/components/views/globals/NewVersionBar.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 PropTypes from 'prop-types';
import createReactClass from 'create-react-class';
import sdk from '../../../index';
import Modal from '../../../Modal';
import PlatformPeg from '../../../PlatformPeg';
Expand All @@ -31,7 +32,7 @@ function checkVersion(ver) {
return parts.length == 5 && parts[1] == 'react' && parts[3] == 'js';
}

export default React.createClass({
export default createReactClass({
propTypes: {
version: PropTypes.string.isRequired,
newVersion: PropTypes.string.isRequired,
Expand Down
3 changes: 2 additions & 1 deletion src/components/views/globals/PasswordNagBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@ limitations under the License.
*/

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

export default React.createClass({
export default createReactClass({
onUpdateClicked: function() {
const SetPasswordDialog = sdk.getComponent('dialogs.SetPasswordDialog');
Modal.createTrackedDialog('Set Password Dialog', 'Password Nag Bar', SetPasswordDialog);
Expand Down
3 changes: 2 additions & 1 deletion src/components/views/globals/ServerLimitBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@ limitations under the License.

import React from 'react';
import PropTypes from 'prop-types';
import createReactClass from 'create-react-class';
import classNames from 'classnames';
import { _td } from '../../../languageHandler';
import { messageForResourceLimitError } from '../../../utils/ErrorUtils';

export default React.createClass({
export default createReactClass({
propTypes: {
// 'hard' if the logged in user has been locked out, 'soft' if they haven't
kind: PropTypes.string,
Expand Down
3 changes: 2 additions & 1 deletion src/components/views/globals/UpdateCheckBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@ limitations under the License.

import React from 'react';
import PropTypes from 'prop-types';
import createReactClass from 'create-react-class';
import { _t } from '../../../languageHandler';
import PlatformPeg from '../../../PlatformPeg';
import AccessibleButton from '../../../components/views/elements/AccessibleButton';

export default React.createClass({
export default createReactClass({
propTypes: {
status: PropTypes.string.isRequired,
// Currently for error detail but will be usable for download progress
Expand Down
5 changes: 2 additions & 3 deletions src/components/views/messages/MFileBody.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,9 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

'use strict';

import React from 'react';
import PropTypes from 'prop-types';
import createReactClass from 'create-react-class';
import filesize from 'filesize';
import MatrixClientPeg from '../../../MatrixClientPeg';
import sdk from '../../../index';
Expand Down Expand Up @@ -195,7 +194,7 @@ function computedStyle(element) {
return cssText;
}

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

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

'use strict';

import React from 'react';
import PropTypes from 'prop-types';
import createReactClass from 'create-react-class';
import MFileBody from './MFileBody';
import MatrixClientPeg from '../../../MatrixClientPeg';
import { decryptFile } from '../../../utils/DecryptFile';
import Promise from 'bluebird';
import { _t } from '../../../languageHandler';
import SettingsStore from "../../../settings/SettingsStore";

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

propTypes: {
Expand Down
9 changes: 4 additions & 5 deletions src/components/views/messages/MessageEvent.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,12 @@ 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 PropTypes from 'prop-types';
const sdk = require('../../../index');
import createReactClass from 'create-react-class';
import sdk from '../../../index';

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

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

import React from 'react';
import PropTypes from 'prop-types';
import createReactClass from 'create-react-class';
import MatrixClientPeg from '../../../MatrixClientPeg';
import { _t } from '../../../languageHandler';
import sdk from '../../../index';
import Modal from '../../../Modal';
import AccessibleButton from '../elements/AccessibleButton';

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

propTypes: {
Expand Down
3 changes: 2 additions & 1 deletion src/components/views/messages/RoomCreate.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 PropTypes from 'prop-types';
import createReactClass from 'create-react-class';

import dis from '../../../dispatcher';
import { RoomPermalinkCreator } from '../../../matrix-to';
import { _t } from '../../../languageHandler';
import MatrixClientPeg from '../../../MatrixClientPeg';

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

propTypes: {
Expand Down
5 changes: 2 additions & 3 deletions src/components/views/messages/SenderProfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,16 @@
limitations under the License.
*/

'use strict';

import React from 'react';
import PropTypes from 'prop-types';
import createReactClass from 'create-react-class';
import {MatrixClient} from 'matrix-js-sdk';
import Flair from '../elements/Flair.js';
import FlairStore from '../../../stores/FlairStore';
import { _t } from '../../../languageHandler';
import {getUserNameColorClass} from '../../../utils/FormattingUtils';

export default React.createClass({
export default createReactClass({
displayName: 'SenderProfile',
propTypes: {
mxEvent: PropTypes.object.isRequired, // event whose sender we're showing
Expand Down
6 changes: 2 additions & 4 deletions src/components/views/messages/TextualBody.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,15 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

'use strict';

import React from 'react';
import ReactDOM from 'react-dom';
import PropTypes from 'prop-types';
import createReactClass from 'create-react-class';
import highlight from 'highlight.js';
import * as HtmlUtils from '../../../HtmlUtils';
import {formatDate} from '../../../DateUtils';
import sdk from '../../../index';
import Modal from '../../../Modal';
import SdkConfig from '../../../SdkConfig';
import dis from '../../../dispatcher';
import { _t } from '../../../languageHandler';
import * as ContextualMenu from '../../structures/ContextualMenu';
Expand All @@ -36,7 +34,7 @@ import {host as matrixtoHost} from '../../../matrix-to';
import {pillifyLinks} from '../../../utils/pillify';
import {IntegrationManagers} from "../../../integrations/IntegrationManagers";

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

propTypes: {
Expand Down
7 changes: 3 additions & 4 deletions src/components/views/messages/TextualEvent.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,13 @@ 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 PropTypes from 'prop-types';
import createReactClass from 'create-react-class';

const TextForEvent = require('../../../TextForEvent');

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

propTypes: {
Expand Down
Loading

0 comments on commit 6dbc9ee

Please sign in to comment.