Merge pull request #3347 from matrix-org/t3chguy/react16_5

Migrate away from React.createClass for views/dialogs. React 16 :D
This commit is contained in:
Michael Telatynski 2019-08-26 19:45:26 +01:00 committed by GitHub
commit 8bdc1e9446
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
20 changed files with 40 additions and 22 deletions

View file

@ -19,6 +19,7 @@ limitations under the License.
import React from 'react'; import React from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import createReactClass from 'create-react-class';
import { _t, _td } from '../../../languageHandler'; import { _t, _td } from '../../../languageHandler';
import sdk from '../../../index'; import sdk from '../../../index';
@ -39,7 +40,7 @@ const addressTypeName = {
}; };
module.exports = React.createClass({ module.exports = createReactClass({
displayName: "AddressPickerDialog", displayName: "AddressPickerDialog",
propTypes: { propTypes: {

View file

@ -16,12 +16,13 @@ limitations under the License.
import React from 'react'; import React from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import createReactClass from 'create-react-class';
import sdk from '../../../index'; import sdk from '../../../index';
import { _t } from '../../../languageHandler'; import { _t } from '../../../languageHandler';
import {SettingLevel} from "../../../settings/SettingsStore"; import {SettingLevel} from "../../../settings/SettingsStore";
import SettingsStore from "../../../settings/SettingsStore"; import SettingsStore from "../../../settings/SettingsStore";
export default React.createClass({ export default createReactClass({
propTypes: { propTypes: {
unknownProfileUsers: PropTypes.array.isRequired, // [ {userId, errorText}... ] unknownProfileUsers: PropTypes.array.isRequired, // [ {userId, errorText}... ]
onInviteAnyways: PropTypes.func.isRequired, onInviteAnyways: PropTypes.func.isRequired,

View file

@ -16,6 +16,7 @@ limitations under the License.
*/ */
import React from 'react'; import React from 'react';
import createReactClass from 'create-react-class';
import FocusTrap from 'focus-trap-react'; import FocusTrap from 'focus-trap-react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import classNames from 'classnames'; import classNames from 'classnames';
@ -32,7 +33,7 @@ import MatrixClientPeg from '../../../MatrixClientPeg';
* Includes a div for the title, and a keypress handler which cancels the * Includes a div for the title, and a keypress handler which cancels the
* dialog on escape. * dialog on escape.
*/ */
export default React.createClass({ export default createReactClass({
displayName: 'BaseDialog', displayName: 'BaseDialog',
propTypes: { propTypes: {

View file

@ -15,13 +15,14 @@ limitations under the License.
*/ */
import React from 'react'; import React from 'react';
import createReactClass from 'create-react-class';
import sdk from '../../../index'; import sdk from '../../../index';
import { _t } from '../../../languageHandler'; import { _t } from '../../../languageHandler';
/* /*
* A dialog for confirming a redaction. * A dialog for confirming a redaction.
*/ */
export default React.createClass({ export default createReactClass({
displayName: 'ConfirmRedactDialog', displayName: 'ConfirmRedactDialog',
render: function() { render: function() {

View file

@ -15,6 +15,7 @@ limitations under the License.
*/ */
import React from 'react'; import React from 'react';
import createReactClass from 'create-react-class';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { MatrixClient } from 'matrix-js-sdk'; import { MatrixClient } from 'matrix-js-sdk';
import sdk from '../../../index'; import sdk from '../../../index';
@ -29,7 +30,7 @@ import { GroupMemberType } from '../../../groups';
* to make it obvious what is going to happen. * to make it obvious what is going to happen.
* Also tweaks the style for 'dangerous' actions (albeit only with colour) * Also tweaks the style for 'dangerous' actions (albeit only with colour)
*/ */
export default React.createClass({ export default createReactClass({
displayName: 'ConfirmUserActionDialog', displayName: 'ConfirmUserActionDialog',
propTypes: { propTypes: {
// matrix-js-sdk (room) member object. Supply either this or 'groupMember' // matrix-js-sdk (room) member object. Supply either this or 'groupMember'

View file

@ -15,13 +15,14 @@ limitations under the License.
*/ */
import React from 'react'; import React from 'react';
import createReactClass from 'create-react-class';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import sdk from '../../../index'; import sdk from '../../../index';
import dis from '../../../dispatcher'; import dis from '../../../dispatcher';
import { _t } from '../../../languageHandler'; import { _t } from '../../../languageHandler';
import MatrixClientPeg from '../../../MatrixClientPeg'; import MatrixClientPeg from '../../../MatrixClientPeg';
export default React.createClass({ export default createReactClass({
displayName: 'CreateGroupDialog', displayName: 'CreateGroupDialog',
propTypes: { propTypes: {
onFinished: PropTypes.func.isRequired, onFinished: PropTypes.func.isRequired,

View file

@ -15,12 +15,13 @@ limitations under the License.
*/ */
import React from 'react'; import React from 'react';
import createReactClass from 'create-react-class';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import sdk from '../../../index'; import sdk from '../../../index';
import SdkConfig from '../../../SdkConfig'; import SdkConfig from '../../../SdkConfig';
import { _t } from '../../../languageHandler'; import { _t } from '../../../languageHandler';
export default React.createClass({ export default createReactClass({
displayName: 'CreateRoomDialog', displayName: 'CreateRoomDialog',
propTypes: { propTypes: {
onFinished: PropTypes.func.isRequired, onFinished: PropTypes.func.isRequired,

View file

@ -26,11 +26,12 @@ limitations under the License.
*/ */
import React from 'react'; import React from 'react';
import createReactClass from 'create-react-class';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import sdk from '../../../index'; import sdk from '../../../index';
import { _t } from '../../../languageHandler'; import { _t } from '../../../languageHandler';
export default React.createClass({ export default createReactClass({
displayName: 'ErrorDialog', displayName: 'ErrorDialog',
propTypes: { propTypes: {
title: PropTypes.string, title: PropTypes.string,

View file

@ -17,12 +17,13 @@ limitations under the License.
*/ */
import React from 'react'; import React from 'react';
import createReactClass from 'create-react-class';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import sdk from '../../../index'; import sdk from '../../../index';
import { _t } from '../../../languageHandler'; import { _t } from '../../../languageHandler';
import classNames from "classnames"; import classNames from "classnames";
export default React.createClass({ export default createReactClass({
displayName: 'InfoDialog', displayName: 'InfoDialog',
propTypes: { propTypes: {
className: PropTypes.string, className: PropTypes.string,

View file

@ -16,6 +16,7 @@ limitations under the License.
*/ */
import React from 'react'; import React from 'react';
import createReactClass from 'create-react-class';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import sdk from '../../../index'; import sdk from '../../../index';
@ -23,7 +24,7 @@ import { _t } from '../../../languageHandler';
import AccessibleButton from '../elements/AccessibleButton'; import AccessibleButton from '../elements/AccessibleButton';
export default React.createClass({ export default createReactClass({
displayName: 'InteractiveAuthDialog', displayName: 'InteractiveAuthDialog',
propTypes: { propTypes: {

View file

@ -16,6 +16,7 @@ limitations under the License.
import Modal from '../../../Modal'; import Modal from '../../../Modal';
import React from 'react'; import React from 'react';
import createReactClass from 'create-react-class';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import sdk from '../../../index'; import sdk from '../../../index';
@ -29,7 +30,7 @@ import { _t, _td } from '../../../languageHandler';
* should not, and `undefined` if the dialog is cancelled. (In other words: * should not, and `undefined` if the dialog is cancelled. (In other words:
* truthy: do the key share. falsy: don't share the keys). * truthy: do the key share. falsy: don't share the keys).
*/ */
export default React.createClass({ export default createReactClass({
propTypes: { propTypes: {
matrixClient: PropTypes.object.isRequired, matrixClient: PropTypes.object.isRequired,
userId: PropTypes.string.isRequired, userId: PropTypes.string.isRequired,

View file

@ -16,11 +16,12 @@ limitations under the License.
*/ */
import React from 'react'; import React from 'react';
import createReactClass from 'create-react-class';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import sdk from '../../../index'; import sdk from '../../../index';
import { _t } from '../../../languageHandler'; import { _t } from '../../../languageHandler';
export default React.createClass({ export default createReactClass({
displayName: 'QuestionDialog', displayName: 'QuestionDialog',
propTypes: { propTypes: {
title: PropTypes.string, title: PropTypes.string,

View file

@ -15,13 +15,14 @@ limitations under the License.
*/ */
import React from 'react'; import React from 'react';
import createReactClass from 'create-react-class';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import sdk from '../../../index'; import sdk from '../../../index';
import MatrixClientPeg from '../../../MatrixClientPeg'; import MatrixClientPeg from '../../../MatrixClientPeg';
import Modal from '../../../Modal'; import Modal from '../../../Modal';
import { _t } from '../../../languageHandler'; import { _t } from '../../../languageHandler';
export default React.createClass({ export default createReactClass({
displayName: 'RoomUpgradeDialog', displayName: 'RoomUpgradeDialog',
propTypes: { propTypes: {

View file

@ -16,6 +16,7 @@ limitations under the License.
*/ */
import React from 'react'; import React from 'react';
import createReactClass from 'create-react-class';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import sdk from '../../../index'; import sdk from '../../../index';
import SdkConfig from '../../../SdkConfig'; import SdkConfig from '../../../SdkConfig';
@ -23,7 +24,7 @@ import Modal from '../../../Modal';
import { _t } from '../../../languageHandler'; import { _t } from '../../../languageHandler';
export default React.createClass({ export default createReactClass({
displayName: 'SessionRestoreErrorDialog', displayName: 'SessionRestoreErrorDialog',
propTypes: { propTypes: {

View file

@ -16,6 +16,7 @@ limitations under the License.
*/ */
import React from 'react'; import React from 'react';
import createReactClass from 'create-react-class';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import sdk from '../../../index'; import sdk from '../../../index';
import Email from '../../../email'; import Email from '../../../email';
@ -29,7 +30,7 @@ import Modal from '../../../Modal';
* *
* On success, `onFinished(true)` is called. * On success, `onFinished(true)` is called.
*/ */
export default React.createClass({ export default createReactClass({
displayName: 'SetEmailDialog', displayName: 'SetEmailDialog',
propTypes: { propTypes: {
onFinished: PropTypes.func.isRequired, onFinished: PropTypes.func.isRequired,

View file

@ -17,6 +17,7 @@ limitations under the License.
import Promise from 'bluebird'; import Promise from 'bluebird';
import React from 'react'; import React from 'react';
import createReactClass from 'create-react-class';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import sdk from '../../../index'; import sdk from '../../../index';
import MatrixClientPeg from '../../../MatrixClientPeg'; import MatrixClientPeg from '../../../MatrixClientPeg';
@ -34,7 +35,7 @@ const USERNAME_CHECK_DEBOUNCE_MS = 250;
* *
* On success, `onFinished(true, newDisplayName)` is called. * On success, `onFinished(true, newDisplayName)` is called.
*/ */
export default React.createClass({ export default createReactClass({
displayName: 'SetMxIdDialog', displayName: 'SetMxIdDialog',
propTypes: { propTypes: {
onFinished: PropTypes.func.isRequired, onFinished: PropTypes.func.isRequired,

View file

@ -17,6 +17,7 @@ limitations under the License.
*/ */
import React from 'react'; import React from 'react';
import createReactClass from 'create-react-class';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import sdk from '../../../index'; import sdk from '../../../index';
import { _t } from '../../../languageHandler'; import { _t } from '../../../languageHandler';
@ -62,7 +63,7 @@ const WarmFuzzy = function(props) {
* *
* On success, `onFinished()` when finished * On success, `onFinished()` when finished
*/ */
export default React.createClass({ export default createReactClass({
displayName: 'SetPasswordDialog', displayName: 'SetPasswordDialog',
propTypes: { propTypes: {
onFinished: PropTypes.func.isRequired, onFinished: PropTypes.func.isRequired,

View file

@ -15,10 +15,11 @@ limitations under the License.
*/ */
import React from 'react'; import React from 'react';
import createReactClass from 'create-react-class';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import sdk from '../../../index'; import sdk from '../../../index';
export default React.createClass({ export default createReactClass({
displayName: 'TextInputDialog', displayName: 'TextInputDialog',
propTypes: { propTypes: {
title: PropTypes.string, title: PropTypes.string,

View file

@ -16,11 +16,10 @@ limitations under the License.
*/ */
import React from 'react'; import React from 'react';
import createReactClass from 'create-react-class';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import sdk from '../../../index'; import sdk from '../../../index';
import MatrixClientPeg from '../../../MatrixClientPeg'; import MatrixClientPeg from '../../../MatrixClientPeg';
import GeminiScrollbar from 'react-gemini-scrollbar';
import Resend from '../../../Resend';
import { _t } from '../../../languageHandler'; import { _t } from '../../../languageHandler';
import SettingsStore from "../../../settings/SettingsStore"; import SettingsStore from "../../../settings/SettingsStore";
import { markAllDevicesKnown } from '../../../cryptodevices'; import { markAllDevicesKnown } from '../../../cryptodevices';
@ -67,7 +66,7 @@ UnknownDeviceList.propTypes = {
}; };
export default React.createClass({ export default createReactClass({
displayName: 'UnknownDeviceDialog', displayName: 'UnknownDeviceDialog',
propTypes: { propTypes: {

View file

@ -15,6 +15,7 @@ limitations under the License.
*/ */
import React from 'react'; import React from 'react';
import createReactClass from 'create-react-class';
import sdk from '../../../../index'; import sdk from '../../../../index';
import MatrixClientPeg from '../../../../MatrixClientPeg'; import MatrixClientPeg from '../../../../MatrixClientPeg';
import Modal from '../../../../Modal'; import Modal from '../../../../Modal';
@ -29,7 +30,7 @@ const RESTORE_TYPE_RECOVERYKEY = 1;
/** /**
* Dialog for restoring e2e keys from a backup and the user's recovery key * Dialog for restoring e2e keys from a backup and the user's recovery key
*/ */
export default React.createClass({ export default createReactClass({
getInitialState: function() { getInitialState: function() {
return { return {
backupInfo: null, backupInfo: null,