Skip to content

Commit 696a706

Browse files
committed
[fixed] Use defaultProps of config components
Fixes #814
1 parent 67ecd77 commit 696a706

File tree

3 files changed

+10
-9
lines changed

3 files changed

+10
-9
lines changed

modules/Configuration.js

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
11
var invariant = require('react/lib/invariant');
2+
var RouteHandler = require('./RouteHandler');
23

34
var Configuration = {
45

5-
render: function () {
6+
getDefaultProps() {
7+
return {
8+
handler: RouteHandler
9+
};
10+
},
11+
12+
render() {
613
invariant(
714
false,
815
'%s elements are for router configuration only and should not be rendered',

modules/components/Route.js

+1-7
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
var React = require('react');
22
var Configuration = require('../Configuration');
33
var PropTypes = require('../PropTypes');
4-
var RouteHandler = require('./RouteHandler');
4+
55
/**
66
* <Route> components specify components that are rendered to the page when the
77
* URL matches a given pattern.
@@ -53,12 +53,6 @@ var Route = React.createClass({
5353
path: PropTypes.string,
5454
handler: PropTypes.func,
5555
ignoreScrollBehavior: PropTypes.bool
56-
},
57-
58-
getDefaultProps: function(){
59-
return {
60-
handler: RouteHandler
61-
};
6256
}
6357

6458
});

modules/createRoutesFromReactChildren.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ function createRouteFromReactElement(element) {
3737
return;
3838

3939
var type = element.type;
40-
var props = element.props;
40+
var props = assign({}, type.defaultProps, element.props);
4141

4242
if (type.propTypes)
4343
checkPropTypes(type.displayName, type.propTypes, props);

0 commit comments

Comments
 (0)