mirror of
https://github.com/zhigang1992/react-navigation.git
synced 2026-03-06 17:34:59 +08:00
Allow strings Component types through as screens (#2999)
In React Fiber (React 16), strings are used for intrinsics like 'div' and 'View'. As a result, if you use a View as a screen in an academic experience, you get a red error screen. This PR prevents that from happening.
This commit is contained in:
committed by
Spencer Carli
parent
e0704e48a1
commit
4e48d43f0f
@@ -35,7 +35,11 @@ function validateRouteConfigMap(routeConfigs: NavigationRouteConfigMap) {
|
||||
);
|
||||
}
|
||||
|
||||
if (routeConfig.screen && typeof routeConfig.screen !== 'function') {
|
||||
if (
|
||||
routeConfig.screen &&
|
||||
typeof routeConfig.screen !== 'function' &&
|
||||
typeof routeConfig.screen !== 'string'
|
||||
) {
|
||||
throw new Error(
|
||||
`The component for route '${routeName}' must be a ` +
|
||||
'React component. For example:\n\n' +
|
||||
|
||||
Reference in New Issue
Block a user