Skip to content

Commit 0b6c29d

Browse files
authored
Merge pull request element-hq#10480 from vector-im/t3chguy/react16
Switch to React 16
2 parents 89e9ac8 + 33c17a6 commit 0b6c29d

8 files changed

Lines changed: 93 additions & 95 deletions

File tree

‎package.json‎

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,9 @@
7878
"matrix-react-sdk": "1.5.1",
7979
"modernizr": "^3.6.0",
8080
"olm": "https://packages.matrix.org/npm/olm/olm-3.1.0.tgz",
81-
"prop-types": "^15.6.2",
82-
"react": "^15.6.0",
83-
"react-dom": "^15.6.0",
81+
"prop-types": "^15.7.2",
82+
"react": "^16.9.0",
83+
"react-dom": "^16.9.0",
8484
"sanitize-html": "^1.19.1",
8585
"ua-parser-js": "^0.7.19",
8686
"url": "^0.11.0"
@@ -144,8 +144,6 @@
144144
"postcss-scss": "^1.0.6",
145145
"postcss-simple-vars": "^4.1.0",
146146
"postcss-strip-inline-comments": "^0.1.5",
147-
"react-addons-perf": "^15.4.0",
148-
"react-addons-test-utils": "^15.6.0",
149147
"rimraf": "^2.4.3",
150148
"source-map-loader": "^0.2.4",
151149
"webpack": "^4.23.1",

‎src/components/views/auth/VectorAuthFooter.js‎

Lines changed: 31 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -15,45 +15,39 @@ See the License for the specific language governing permissions and
1515
limitations under the License.
1616
*/
1717

18-
'use strict';
19-
20-
const React = require('react');
18+
import React from 'react';
2119
import SdkConfig from 'matrix-react-sdk/lib/SdkConfig';
2220

2321
import { _t } from 'matrix-react-sdk/lib/languageHandler';
2422

25-
module.exports = React.createClass({
26-
displayName: 'VectorAuthFooter',
27-
statics: {
28-
replaces: 'AuthFooter',
29-
},
30-
31-
render: function() {
32-
const brandingConfig = SdkConfig.get().branding;
33-
let links = [
34-
{"text": "blog", "url": "https://medium.com/@RiotChat"},
35-
{"text": "twitter", "url": "https://twitter.com/@RiotChat"},
36-
{"text": "github", "url": "https://github.com/vector-im/riot-web"},
37-
];
38-
39-
if (brandingConfig && brandingConfig.authFooterLinks) {
40-
links = brandingConfig.authFooterLinks;
41-
}
42-
43-
const authFooterLinks = [];
44-
for (const linkEntry of links) {
45-
authFooterLinks.push(
46-
<a href={linkEntry.url} key={linkEntry.text} target="_blank" rel="noopener">
47-
{linkEntry.text}
48-
</a>,
49-
);
50-
}
51-
52-
return (
53-
<div className="mx_AuthFooter">
54-
{authFooterLinks}
55-
<a href="https://matrix.org" target="_blank" rel="noopener">{ _t('powered by Matrix') }</a>
56-
</div>
23+
module.exports = () => {
24+
const brandingConfig = SdkConfig.get().branding;
25+
let links = [
26+
{"text": "blog", "url": "https://medium.com/@RiotChat"},
27+
{"text": "twitter", "url": "https://twitter.com/@RiotChat"},
28+
{"text": "github", "url": "https://github.com/vector-im/riot-web"},
29+
];
30+
31+
if (brandingConfig && brandingConfig.authFooterLinks) {
32+
links = brandingConfig.authFooterLinks;
33+
}
34+
35+
const authFooterLinks = [];
36+
for (const linkEntry of links) {
37+
authFooterLinks.push(
38+
<a href={linkEntry.url} key={linkEntry.text} target="_blank" rel="noopener">
39+
{linkEntry.text}
40+
</a>,
5741
);
58-
},
59-
});
42+
}
43+
44+
return (
45+
<div className="mx_AuthFooter">
46+
{authFooterLinks}
47+
<a href="https://matrix.org" target="_blank" rel="noopener">{ _t('powered by Matrix') }</a>
48+
</div>
49+
);
50+
};
51+
module.exports.statics = {
52+
replaces: 'AuthFooter',
53+
};

‎src/components/views/auth/VectorCustomServerDialog.js‎

Lines changed: 30 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -15,44 +15,40 @@ See the License for the specific language governing permissions and
1515
limitations under the License.
1616
*/
1717

18-
const React = require("react");
18+
import React from "react";
1919
import { _t } from 'matrix-react-sdk/lib/languageHandler';
2020

2121
/**
2222
* This is identical to `CustomServerDialog` except for replacing "this app"
2323
* with "Riot".
2424
*/
25-
module.exports = React.createClass({
26-
displayName: 'VectorCustomServerDialog',
27-
statics: {
28-
replaces: 'CustomServerDialog',
29-
},
30-
31-
render: function() {
32-
return (
33-
<div className="mx_ErrorDialog">
34-
<div className="mx_Dialog_title">
35-
{ _t('Custom Server Options') }
36-
</div>
37-
<div className="mx_Dialog_content">
38-
<p>{_t(
39-
"You can use the custom server options to sign into other " +
40-
"Matrix servers by specifying a different homeserver URL. This " +
41-
"allows you to use Riot with an existing Matrix account on a " +
42-
"different homeserver.",
43-
)}</p>
44-
<p>{_t(
45-
"You can also set a custom identity server, but you won't be " +
46-
"able to invite users by email address, or be invited by email " +
47-
"address yourself.",
48-
)}</p>
49-
</div>
50-
<div className="mx_Dialog_buttons">
51-
<button onClick={this.props.onFinished} autoFocus={true}>
52-
{ _t('Dismiss') }
53-
</button>
54-
</div>
25+
module.exports = ({onFinished}) => {
26+
return (
27+
<div className="mx_ErrorDialog">
28+
<div className="mx_Dialog_title">
29+
{ _t('Custom Server Options') }
30+
</div>
31+
<div className="mx_Dialog_content">
32+
<p>{_t(
33+
"You can use the custom server options to sign into other " +
34+
"Matrix servers by specifying a different homeserver URL. This " +
35+
"allows you to use Riot with an existing Matrix account on a " +
36+
"different homeserver.",
37+
)}</p>
38+
<p>{_t(
39+
"You can also set a custom identity server, but you won't be " +
40+
"able to invite users by email address, or be invited by email " +
41+
"address yourself.",
42+
)}</p>
43+
</div>
44+
<div className="mx_Dialog_buttons">
45+
<button onClick={onFinished} autoFocus={true}>
46+
{ _t('Dismiss') }
47+
</button>
5548
</div>
56-
);
57-
},
58-
});
49+
</div>
50+
);
51+
};
52+
module.exports.statics = {
53+
replaces: 'CustomServerDialog',
54+
};

‎src/vector/index.js‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,6 @@ import React from 'react';
3333
// add React and ReactPerf to the global namespace, to make them easier to
3434
// access via the console
3535
global.React = React;
36-
if (process.env.NODE_ENV !== 'production') {
37-
global.Perf = require('react-addons-perf');
38-
}
3936

4037
import './modernizr';
4138
import ReactDOM from 'react-dom';

‎test/app-tests/joining.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ const RoomView = sdk.getComponent('structures.RoomView');
3434

3535
const React = require('react');
3636
const ReactDOM = require('react-dom');
37-
const ReactTestUtils = require('react-addons-test-utils');
37+
const ReactTestUtils = require('react-dom/test-utils');
3838
const expect = require('expect');
3939
import Promise from 'bluebird';
4040
import {makeType} from "matrix-react-sdk/lib/utils/TypeUtils";

‎test/app-tests/loading.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import 'skin-sdk';
2323

2424
import React from 'react';
2525
import ReactDOM from 'react-dom';
26-
import ReactTestUtils from 'react-addons-test-utils';
26+
import ReactTestUtils from 'react-dom/test-utils';
2727
import expect from 'expect';
2828
import Promise from 'bluebird';
2929
import MatrixReactTestUtils from 'matrix-react-test-utils';

‎webpack.config.js‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,6 @@ module.exports = {
152152
// using `npm link` / `yarn link`.
153153
"react": path.resolve('./node_modules/react'),
154154
"react-dom": path.resolve('./node_modules/react-dom'),
155-
"react-addons-perf": path.resolve('./node_modules/react-addons-perf'),
156155

157156
// same goes for js-sdk
158157
"matrix-js-sdk": path.resolve('./node_modules/matrix-js-sdk'),

‎yarn.lock‎

Lines changed: 27 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7348,19 +7348,6 @@ react-addons-css-transition-group@15.3.2:
73487348
resolved "https://registry.yarnpkg.com/react-addons-css-transition-group/-/react-addons-css-transition-group-15.3.2.tgz#d8fa52bec9bb61bdfde8b9e4652b80297cbff667"
73497349
integrity sha1-2PpSvsm7Yb396LnkZSuAKXy/9mc=
73507350

7351-
react-addons-perf@^15.4.0:
7352-
version "15.4.2"
7353-
resolved "https://registry.yarnpkg.com/react-addons-perf/-/react-addons-perf-15.4.2.tgz#110bdcf5c459c4f77cb85ed634bcd3397536383b"
7354-
integrity sha1-EQvc9cRZxPd8uF7WNLzTOXU2ODs=
7355-
dependencies:
7356-
fbjs "^0.8.4"
7357-
object-assign "^4.1.0"
7358-
7359-
react-addons-test-utils@^15.6.0:
7360-
version "15.6.2"
7361-
resolved "https://registry.yarnpkg.com/react-addons-test-utils/-/react-addons-test-utils-15.6.2.tgz#c12b6efdc2247c10da7b8770d185080a7b047156"
7362-
integrity sha1-wStu/cIkfBDae4dw0YUICnsEcVY=
7363-
73647351
react-beautiful-dnd@^4.0.1:
73657352
version "4.0.1"
73667353
resolved "https://registry.yarnpkg.com/react-beautiful-dnd/-/react-beautiful-dnd-4.0.1.tgz#3b0a49bf6be75af351176c904f012611dd292b81"
@@ -7397,6 +7384,16 @@ react-dom@^16.4.2:
73977384
prop-types "^15.6.2"
73987385
scheduler "^0.13.6"
73997386

7387+
react-dom@^16.9.0:
7388+
version "16.9.0"
7389+
resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-16.9.0.tgz#5e65527a5e26f22ae3701131bcccaee9fb0d3962"
7390+
integrity sha512-YFT2rxO9hM70ewk9jq0y6sQk8cL02xm4+IzYBz75CQGlClQQ1Bxq0nhHF6OtSbit+AIahujJgb/CPRibFkMNJQ==
7391+
dependencies:
7392+
loose-envify "^1.1.0"
7393+
object-assign "^4.1.1"
7394+
prop-types "^15.6.2"
7395+
scheduler "^0.15.0"
7396+
74007397
"react-gemini-scrollbar@github:matrix-org/react-gemini-scrollbar#5e97aef":
74017398
version "2.1.5"
74027399
resolved "https://codeload.github.com/matrix-org/react-gemini-scrollbar/tar.gz/5e97aef7e034efc8db1431f4b0efe3b26e249ae9"
@@ -7461,6 +7458,15 @@ react@^16.4.2:
74617458
prop-types "^15.6.2"
74627459
scheduler "^0.13.6"
74637460

7461+
react@^16.9.0:
7462+
version "16.9.0"
7463+
resolved "https://registry.yarnpkg.com/react/-/react-16.9.0.tgz#40ba2f9af13bc1a38d75dbf2f4359a5185c4f7aa"
7464+
integrity sha512-+7LQnFBwkiw+BobzOF6N//BdoNw0ouwmSJTEm9cglOOmsg/TMiFHZLe2sEoN5M7LgJTj9oHH0gxklfnQe66S1w==
7465+
dependencies:
7466+
loose-envify "^1.1.0"
7467+
object-assign "^4.1.1"
7468+
prop-types "^15.6.2"
7469+
74647470
read-cache@^1.0.0:
74657471
version "1.0.0"
74667472
resolved "https://registry.yarnpkg.com/read-cache/-/read-cache-1.0.0.tgz#e664ef31161166c9751cdbe8dbcf86b5fb58f774"
@@ -7895,6 +7901,14 @@ scheduler@^0.13.6:
78957901
loose-envify "^1.1.0"
78967902
object-assign "^4.1.1"
78977903

7904+
scheduler@^0.15.0:
7905+
version "0.15.0"
7906+
resolved "https://registry.yarnpkg.com/scheduler/-/scheduler-0.15.0.tgz#6bfcf80ff850b280fed4aeecc6513bc0b4f17f8e"
7907+
integrity sha512-xAefmSfN6jqAa7Kuq7LIJY0bwAPG3xlCj0HMEBQk1lxYiDKZscY2xJ5U/61ZTrYbmNQbXa+gc7czPkVo11tnCg==
7908+
dependencies:
7909+
loose-envify "^1.1.0"
7910+
object-assign "^4.1.1"
7911+
78987912
schema-utils@^0.4.0, schema-utils@^0.4.5:
78997913
version "0.4.7"
79007914
resolved "https://registry.yarnpkg.com/schema-utils/-/schema-utils-0.4.7.tgz#ba74f597d2be2ea880131746ee17d0a093c68187"

0 commit comments

Comments
 (0)