Skip to content

Commit 8f153f6

Browse files
committed
Merge pull request react-bootstrap#1319 from taion/r14-rc1
Update for React 0.14.0-rc1 and React Router 1.0.0-rc1
2 parents 2e9bcde + a8062d5 commit 8f153f6

7 files changed

Lines changed: 28 additions & 31 deletions

File tree

docs/build.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
/* eslint no-console: 0 */
22

33
import fsp from 'fs-promise';
4+
import createLocation from 'history/lib/createLocation';
45
import path from 'path';
56
import React from 'react';
67
import ReactDOMServer from 'react-dom/server';
7-
import Router from 'react-router';
8-
import Location from 'react-router/lib/Location';
8+
import {match, RoutingContext} from 'react-router';
99

1010
import Root from './src/Root';
1111
import routes from './src/Routes';
@@ -32,10 +32,11 @@ const readmeDest = path.join(docsBuilt, 'README.md');
3232
function generateHTML(fileName) {
3333
return new Promise( resolve => {
3434
const urlSlug = fileName === 'index.html' ? '/' : `/${fileName}`;
35+
const location = createLocation(urlSlug);
3536

36-
Router.run(routes, new Location(urlSlug), (error, initialState) => {
37+
match({routes, location}, (error, redirectLocation, renderProps) => {
3738
let html = ReactDOMServer.renderToString(
38-
<Router {...initialState} />
39+
<RoutingContext {...renderProps} />
3940
);
4041
html = '<!doctype html>' + html;
4142
let write = fsp.writeFile(path.join(docsBuilt, fileName), html);

docs/client.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ import CodeMirror from 'codemirror';
22
import 'codemirror/addon/runmode/runmode';
33
import 'codemirror/mode/htmlmixed/htmlmixed';
44
import 'codemirror/mode/javascript/javascript';
5+
import createBrowserHistory from 'history/lib/createBrowserHistory';
56
import React from 'react';
67
import ReactDOM from 'react-dom';
78
import {Router} from 'react-router';
8-
import {history} from 'react-router/lib/BrowserHistory';
99

1010
import Root from './src/Root';
1111
import routes from './src/Routes';
@@ -30,6 +30,8 @@ global.CodeMirror = CodeMirror;
3030
Root.assetBaseUrl = window.ASSET_BASE_URL;
3131
Root.propData = window.PROP_DATA;
3232

33+
const history = createBrowserHistory();
34+
3335
ReactDOM.render(
3436
<Router history={history} children={routes} />,
3537
document

docs/server.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22

33
import 'colors';
44
import express from 'express';
5+
import createLocation from 'history/lib/createLocation';
56
import httpProxy from 'http-proxy';
67
import ip from 'ip';
78
import path from 'path';
89
import React from 'react';
910
import ReactDOMServer from 'react-dom/server';
10-
import Router from 'react-router';
11-
import Location from 'react-router/lib/Location';
11+
import {match, RoutingContext} from 'react-router';
1212

1313
import Root from './src/Root';
1414
import routes from './src/Routes';
@@ -46,9 +46,10 @@ if (development) {
4646
res.header('Access-Control-Allow-Origin', target);
4747
res.header('Access-Control-Allow-Headers', 'X-Requested-With');
4848

49-
Router.run(routes, new Location(req.url), (error, initialState) => {
49+
const location = createLocation(req.url);
50+
match({routes, location}, (error, redirectLocation, renderProps) => {
5051
const html = ReactDOMServer.renderToString(
51-
<Router {...initialState} />
52+
<RoutingContext {...renderProps} />
5253
);
5354
res.send('<!doctype html>' + html);
5455
});

docs/src/Routes.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from 'react';
2-
import {Route} from 'react-router';
2+
import {IndexRoute, Route} from 'react-router';
33

44
import ComponentsPage from './ComponentsPage';
55
import GettingStartedPage from './GettingStartedPage';
@@ -10,12 +10,12 @@ import Root from './Root';
1010
import SupportPage from './SupportPage';
1111

1212
export default (
13-
<Route component={Root}>
14-
<Route path="/" component={HomePage} />
15-
<Route path="/introduction.html" component={IntroductionPage} />
16-
<Route path="/getting-started.html" component={GettingStartedPage} />
17-
<Route path="/components.html" component={ComponentsPage} />
18-
<Route path="/support.html" component={SupportPage} />
13+
<Route path="/" component={Root}>
14+
<IndexRoute component={HomePage} />
15+
<Route path="introduction.html" component={IntroductionPage} />
16+
<Route path="getting-started.html" component={GettingStartedPage} />
17+
<Route path="components.html" component={ComponentsPage} />
18+
<Route path="support.html" component={SupportPage} />
1919

2020
<Route path="*" component={NotFoundPage} />
2121
</Route>

package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
"docs": "babel-node docs/dev-run",
1919
"docs-prod": "npm run docs-build && NODE_ENV=production babel-node docs/server.js",
2020
"docs-prod-unoptimized": "npm run docs-build -- --dev && NODE_ENV=production babel-node docs/server.js",
21-
2221
"minor": "node ./tools/release minor",
2322
"patch": "node ./tools/release patch"
2423
},
@@ -42,8 +41,8 @@
4241
"author": "Stephen J. Collings <stevoland@gmail.com>",
4342
"license": "MIT",
4443
"peerDependencies": {
45-
"react": ">=0.14.0-beta3",
46-
"react-dom": ">=0.14.0-beta3"
44+
"react": ">=0.14.0-rc1",
45+
"react-dom": ">=0.14.0-rc1"
4746
},
4847
"devDependencies": {
4948
"babel": "^5.8.19",
@@ -70,6 +69,7 @@
7069
"fs-extra": "^0.23.0",
7170
"fs-promise": "^0.3.1",
7271
"glob": "^5.0.14",
72+
"history": "^1.9.0",
7373
"http-proxy": "^1.11.1",
7474
"ip": "^0.3.3",
7575
"isparta-loader": "^0.2.0",
@@ -96,11 +96,11 @@
9696
"output-file-sync": "^1.1.1",
9797
"phantomjs": "^1.9.17",
9898
"portfinder": "^0.4.0",
99-
"react": "^0.14.0-beta3",
99+
"react": "^0.14.0-rc1",
100100
"react-component-metadata": "^1.3.0",
101-
"react-dom": "^0.14.0-beta3",
101+
"react-dom": "^0.14.0-rc1",
102102
"react-hot-loader": "^1.2.8",
103-
"react-router": "^1.0.0-beta3",
103+
"react-router": "^1.0.0-rc1",
104104
"rimraf": "^2.4.2",
105105
"semver": "^5.0.1",
106106
"sinon": "^1.15.4",
@@ -117,7 +117,7 @@
117117
"dom-helpers": "^2.2.4",
118118
"keycode": "^2.0.0",
119119
"lodash": "^3.10.0",
120-
"react-overlays": "^0.50.0-alpha3",
120+
"react-overlays": "^0.50.0-alpha4",
121121
"uncontrollable": "^3.1.1",
122122
"warning": "^2.0.0"
123123
}

test/ModalSpec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ describe('Modal', function () {
196196
it('Should use dialogComponent', function () {
197197
let noOp = function () {};
198198

199-
class CustomDialog {
199+
class CustomDialog extends React.Component {
200200
render() { return <div {...this.props}/>; }
201201
}
202202

test/PanelGroupSpec.js

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import React from 'react';
22
import ReactTestUtils from 'react/lib/ReactTestUtils';
3-
import ReactDOM from 'react-dom';
43

54
import Panel from '../src/Panel';
65
import PanelGroup from '../src/PanelGroup';
@@ -98,11 +97,5 @@ describe('PanelGroup', function () {
9897
assert.equal(panelBodies[0].getAttribute('aria-hidden'), 'false');
9998
assert.equal(panelBodies[1].getAttribute('aria-hidden'), 'true');
10099
});
101-
102-
afterEach(function() {
103-
if (instance && ReactTestUtils.isCompositeComponent(instance) && instance.isMounted()) {
104-
ReactDOM.unmountComponentAtNode(ReactDOM.findDOMNode(instance));
105-
}
106-
});
107100
});
108101
});

0 commit comments

Comments
 (0)