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:
Ashoat Tevosyan
2017-11-19 13:04:33 -08:00
committed by Spencer Carli
parent e0704e48a1
commit 4e48d43f0f

View File

@@ -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' +