From 2e1fb4533c67e56bd4333d854b7d254d7083c929 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Fri, 30 Aug 2019 10:27:51 +0100 Subject: [PATCH] Migrate away from React.createClass for auth and views/auth. React 16 :D Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/components/structures/auth/ForgotPassword.js | 3 ++- src/components/structures/auth/Login.js | 5 ++--- src/components/structures/auth/PostRegistration.js | 5 ++--- src/components/structures/auth/Registration.js | 3 ++- src/components/views/auth/AuthFooter.js | 5 ++--- src/components/views/auth/AuthHeader.js | 7 +++---- src/components/views/auth/AuthPage.js | 7 +++---- src/components/views/auth/CaptchaForm.js | 5 ++--- src/components/views/auth/CustomServerDialog.js | 3 ++- .../views/auth/InteractiveAuthEntryComponents.js | 13 +++++++------ src/components/views/auth/RegistrationForm.js | 3 ++- 11 files changed, 29 insertions(+), 30 deletions(-) diff --git a/src/components/structures/auth/ForgotPassword.js b/src/components/structures/auth/ForgotPassword.js index 11c0ff8295..de1b964ff4 100644 --- a/src/components/structures/auth/ForgotPassword.js +++ b/src/components/structures/auth/ForgotPassword.js @@ -17,6 +17,7 @@ limitations under the License. */ import React from 'react'; +import createReactClass from 'create-react-class'; import PropTypes from 'prop-types'; import { _t } from '../../../languageHandler'; import sdk from '../../../index'; @@ -38,7 +39,7 @@ const PHASE_EMAIL_SENT = 3; // User has clicked the link in email and completed reset const PHASE_DONE = 4; -module.exports = React.createClass({ +module.exports = createReactClass({ displayName: 'ForgotPassword', propTypes: { diff --git a/src/components/structures/auth/Login.js b/src/components/structures/auth/Login.js index 31cb92d982..014fb4426d 100644 --- a/src/components/structures/auth/Login.js +++ b/src/components/structures/auth/Login.js @@ -16,9 +16,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 {_t, _td} from '../../../languageHandler'; import sdk from '../../../index'; @@ -54,7 +53,7 @@ _td("General failure"); /** * A wire component which glues together login UI components and Login logic */ -module.exports = React.createClass({ +module.exports = createReactClass({ displayName: 'Login', propTypes: { diff --git a/src/components/structures/auth/PostRegistration.js b/src/components/structures/auth/PostRegistration.js index 1e24d0920a..66075c80f7 100644 --- a/src/components/structures/auth/PostRegistration.js +++ b/src/components/structures/auth/PostRegistration.js @@ -14,15 +14,14 @@ 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 sdk from '../../../index'; import MatrixClientPeg from '../../../MatrixClientPeg'; import { _t } from '../../../languageHandler'; -module.exports = React.createClass({ +module.exports = createReactClass({ displayName: 'PostRegistration', propTypes: { diff --git a/src/components/structures/auth/Registration.js b/src/components/structures/auth/Registration.js index 2fd028ea1d..7af1eaae34 100644 --- a/src/components/structures/auth/Registration.js +++ b/src/components/structures/auth/Registration.js @@ -20,6 +20,7 @@ limitations under the License. import Matrix from 'matrix-js-sdk'; import Promise from 'bluebird'; import React from 'react'; +import createReactClass from 'create-react-class'; import PropTypes from 'prop-types'; import sdk from '../../../index'; import { _t, _td } from '../../../languageHandler'; @@ -40,7 +41,7 @@ const PHASE_REGISTRATION = 1; // Enable phases for registration const PHASES_ENABLED = true; -module.exports = React.createClass({ +module.exports = createReactClass({ displayName: 'Registration', propTypes: { diff --git a/src/components/views/auth/AuthFooter.js b/src/components/views/auth/AuthFooter.js index 98359b9650..39d636f9cc 100644 --- a/src/components/views/auth/AuthFooter.js +++ b/src/components/views/auth/AuthFooter.js @@ -15,12 +15,11 @@ See the License for the specific language governing permissions and limitations under the License. */ -'use strict'; - import { _t } from '../../../languageHandler'; import React from 'react'; +import createReactClass from 'create-react-class'; -module.exports = React.createClass({ +module.exports = createReactClass({ displayName: 'AuthFooter', render: function() { diff --git a/src/components/views/auth/AuthHeader.js b/src/components/views/auth/AuthHeader.js index f5e9e44167..193f347857 100644 --- a/src/components/views/auth/AuthHeader.js +++ b/src/components/views/auth/AuthHeader.js @@ -15,12 +15,11 @@ 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'; import sdk from '../../../index'; -module.exports = React.createClass({ +module.exports = createReactClass({ displayName: 'AuthHeader', render: function() { diff --git a/src/components/views/auth/AuthPage.js b/src/components/views/auth/AuthPage.js index 8cb8cf7d53..41098c9d6c 100644 --- a/src/components/views/auth/AuthPage.js +++ b/src/components/views/auth/AuthPage.js @@ -15,12 +15,11 @@ 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'; import sdk from '../../../index'; -module.exports = React.createClass({ +module.exports = createReactClass({ displayName: 'AuthPage', render: function() { diff --git a/src/components/views/auth/CaptchaForm.js b/src/components/views/auth/CaptchaForm.js index 90f8ebe6d3..2fdfedadcf 100644 --- a/src/components/views/auth/CaptchaForm.js +++ b/src/components/views/auth/CaptchaForm.js @@ -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 { _t } from '../../../languageHandler'; @@ -25,7 +24,7 @@ const DIV_ID = 'mx_recaptcha'; /** * A pure UI component which displays a captcha form. */ -module.exports = React.createClass({ +module.exports = createReactClass({ displayName: 'CaptchaForm', propTypes: { diff --git a/src/components/views/auth/CustomServerDialog.js b/src/components/views/auth/CustomServerDialog.js index cb0ee93de9..ae1054e0d9 100644 --- a/src/components/views/auth/CustomServerDialog.js +++ b/src/components/views/auth/CustomServerDialog.js @@ -15,9 +15,10 @@ limitations under the License. */ import React from 'react'; +import createReactClass from 'create-react-class'; import { _t } from '../../../languageHandler'; -module.exports = React.createClass({ +module.exports = createReactClass({ displayName: 'CustomServerDialog', render: function() { diff --git a/src/components/views/auth/InteractiveAuthEntryComponents.js b/src/components/views/auth/InteractiveAuthEntryComponents.js index 6e2c31fc55..d2eb21df23 100644 --- a/src/components/views/auth/InteractiveAuthEntryComponents.js +++ b/src/components/views/auth/InteractiveAuthEntryComponents.js @@ -17,6 +17,7 @@ limitations under the License. */ import React from 'react'; +import createReactClass from 'create-react-class'; import PropTypes from 'prop-types'; import url from 'url'; import classnames from 'classnames'; @@ -63,7 +64,7 @@ import SettingsStore from "../../../settings/SettingsStore"; * focus: set the input focus appropriately in the form. */ -export const PasswordAuthEntry = React.createClass({ +export const PasswordAuthEntry = createReactClass({ displayName: 'PasswordAuthEntry', statics: { @@ -162,7 +163,7 @@ export const PasswordAuthEntry = React.createClass({ }, }); -export const RecaptchaAuthEntry = React.createClass({ +export const RecaptchaAuthEntry = createReactClass({ displayName: 'RecaptchaAuthEntry', statics: { @@ -212,7 +213,7 @@ export const RecaptchaAuthEntry = React.createClass({ }, }); -export const TermsAuthEntry = React.createClass({ +export const TermsAuthEntry = createReactClass({ displayName: 'TermsAuthEntry', statics: { @@ -351,7 +352,7 @@ export const TermsAuthEntry = React.createClass({ }, }); -export const EmailIdentityAuthEntry = React.createClass({ +export const EmailIdentityAuthEntry = createReactClass({ displayName: 'EmailIdentityAuthEntry', statics: { @@ -393,7 +394,7 @@ export const EmailIdentityAuthEntry = React.createClass({ }, }); -export const MsisdnAuthEntry = React.createClass({ +export const MsisdnAuthEntry = createReactClass({ displayName: 'MsisdnAuthEntry', statics: { @@ -540,7 +541,7 @@ export const MsisdnAuthEntry = React.createClass({ }, }); -export const FallbackAuthEntry = React.createClass({ +export const FallbackAuthEntry = createReactClass({ displayName: 'FallbackAuthEntry', propTypes: { diff --git a/src/components/views/auth/RegistrationForm.js b/src/components/views/auth/RegistrationForm.js index d3f275ffc3..09d349dd20 100644 --- a/src/components/views/auth/RegistrationForm.js +++ b/src/components/views/auth/RegistrationForm.js @@ -18,6 +18,7 @@ limitations under the License. */ import React from 'react'; +import createReactClass from 'create-react-class'; import PropTypes from 'prop-types'; import sdk from '../../../index'; import Email from '../../../email'; @@ -40,7 +41,7 @@ const PASSWORD_MIN_SCORE = 3; // safely unguessable: moderate protection from of /** * A pure UI component which displays a registration form. */ -module.exports = React.createClass({ +module.exports = createReactClass({ displayName: 'RegistrationForm', propTypes: {