mirror of
https://github.com/zhigang1992/react-navigation.git
synced 2026-04-29 12:55:21 +08:00
Throw error in development mode when title is not a string
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user