Skip to content

Commit f8a1316

Browse files
committed
Remove onNavigation and onBeforeNavigation from getDefaultProps
Fixes #22.
1 parent 9972aef commit f8a1316

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

lib/RouterMixin.js

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,6 @@ var RouterMixin = {
1616
onNavigation: React.PropTypes.func
1717
},
1818

19-
getDefaultProps: function() {
20-
return {
21-
onBeforeNavigation: emptyFunction,
22-
onNavigation: emptyFunction
23-
};
24-
},
25-
2619
childContextTypes: {
2720
router: React.PropTypes.component
2821
},
@@ -156,13 +149,17 @@ var RouterMixin = {
156149
* @param {Callback} cb
157150
*/
158151
setPath: function(path, navigation, cb) {
159-
this.props.onBeforeNavigation(path, navigation);
152+
if (this.props.onBeforeNavigation) {
153+
this.props.onBeforeNavigation(path, navigation);
154+
}
160155
this.replaceState({
161156
match: matchRoutes(this.getRoutes(this.props), path),
162157
prefix: this.state.prefix,
163158
navigation: navigation
164159
}, function() {
165-
this.props.onNavigation();
160+
if (this.props.onNavigation) {
161+
this.props.onNavigation();
162+
}
166163
cb();
167164
}.bind(this));
168165
},

0 commit comments

Comments
 (0)