Throw error in development mode when title is not a string

This commit is contained in:
Brent Vatne
2018-06-27 17:35:29 -07:00
parent cad3d70aed
commit bc01a4cd57
2 changed files with 10 additions and 0 deletions

View File

@@ -55,6 +55,15 @@ class Header extends React.PureComponent {
if (typeof options.headerTitle === 'string') {
return options.headerTitle;
}
if (options.title && typeof options.title !== 'string' && __DEV__) {
throw new Error(
`Invalid title for route "${
scene.route.routeName
}" - title must be string or null, instead it was of type ${typeof options.title}`
);
}
return options.title;
}