Skip to content

Commit 07a5a65

Browse files
committed
Fix crash with undefined state while loading
1 parent 3d021d5 commit 07a5a65

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ class Router extends React.Component {
323323
}
324324

325325
// Check for values provided to current route
326-
if (this.state.route.statusBarProps) {
326+
if (this.state.route && this.state.route.statusBarProps) {
327327
statusBarProps = _.defaults(this.state.route.statusBarProps, statusBarProps);
328328
}
329329

@@ -332,7 +332,7 @@ class Router extends React.Component {
332332
if (!_.has(statusBarProps, 'backgroundColor') && !_.has(statusBarProps, 'translucent')) {
333333
let backgroundColor;
334334

335-
if (this.state.route.headerStyle && this.state.router.headerStyle.backgroundColor) {
335+
if (this.state.route && this.state.route.headerStyle && this.state.router.headerStyle.backgroundColor) {
336336
// If current route has specific header style
337337
const stateHeaderStyle = StyleSheet.flatten(this.props.headerStyle);
338338

0 commit comments

Comments
 (0)