Skip to content

Commit 1b3df31

Browse files
committed
Merge remote-tracking branch 'origin/master'
2 parents e17d3b9 + b91eb56 commit 1b3df31

File tree

5 files changed

+18
-24
lines changed

5 files changed

+18
-24
lines changed

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-router-async",
3-
"version": "0.6.20",
3+
"version": "0.6.22",
44
"author": {
55
"name": "Oleg Martynov",
66
"email": "[email protected]"
@@ -16,8 +16,8 @@
1616
"url": "https://github.com/router-async/react-router-async.git"
1717
},
1818
"license": "MIT",
19-
"main": "lib/index.js",
20-
"typings": "lib/index.d.ts",
19+
"main": "index.js",
20+
"typings": "index.d.ts",
2121
"scripts": {
2222
"clean": "rm -rf lib",
2323
"watch": "yarn run clean && tsc -p . --watch",

src/browser-router.tsx

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import * as React from 'react';
2-
import * as PropTypes from 'prop-types';
32
import Router, { initParams, initResult } from './router';
43
import { Context, stringifyQuery } from 'router-async';
54
import * as serialize from 'serialize-javascript';
@@ -32,14 +31,6 @@ export default class BrowserRouter extends Router {
3231
Router: BrowserRouter
3332
};
3433
}
35-
static childContextTypes = {
36-
router: PropTypes.object
37-
};
38-
getChildContext() {
39-
return {
40-
router: this
41-
};
42-
}
4334
async navigate(path, ctx = new Context()) {
4435
// if (this.router.isRunning) this.router.cancel(false);
4536
const { redirect, error } = await this.router.resolve({ path, ctx });

src/router.tsx

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
import { Router as RouterAsync, Context } from 'router-async';
21
import * as React from 'react';
2+
import * as PropTypes from 'prop-types';
3+
import { Router as RouterAsync, Context } from 'router-async';
34
import { deepMap } from './helpers';
45

56
export interface Props {
@@ -19,7 +20,7 @@ export interface State {
1920
export interface Action {
2021
(): React.ReactElement<Props>;
2122
}
22-
interface Childs {
23+
export interface Childs {
2324
[index: number]: Route;
2425
}
2526
export interface Route {
@@ -48,6 +49,9 @@ export interface initResult {
4849
componentProps?: any,
4950
callback?: any
5051
}
52+
export interface childContext {
53+
router: PropTypes.object
54+
}
5155

5256
export default class Router extends React.Component<Props, State> {
5357
router: any;
@@ -170,4 +174,12 @@ export default class Router extends React.Component<Props, State> {
170174
getState() {
171175
return this.state;
172176
}
177+
static childContextTypes: childContext = {
178+
router: PropTypes.object
179+
}
180+
getChildContext(): childContext {
181+
return {
182+
router: this
183+
};
184+
}
173185
}

src/server-router.tsx

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import * as React from 'react';
2-
import * as PropTypes from 'prop-types';
32
import Router, { initParams, initResult } from './router';
43
import * as serialize from 'serialize-javascript';
54

@@ -11,14 +10,6 @@ export default class ServerRouter extends Router {
1110
Router: ServerRouter
1211
};
1312
}
14-
static childContextTypes = {
15-
router: PropTypes.object
16-
};
17-
getChildContext() {
18-
return {
19-
router: this
20-
};
21-
}
2213
render() {
2314
return (
2415
<div>

tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"target": "es5",
44
"module": "commonjs",
55
"outDir": "./lib",
6-
// "declaration": true,
6+
"declaration": true,
77
"jsx": "react"
88
},
99
"include": [

0 commit comments

Comments
 (0)