Skip to content
This repository was archived by the owner on Feb 25, 2020. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"hoist-non-react-statics": "^3.0.1",
"path-to-regexp": "^1.7.0",
"query-string": "^6.2.0",
"react-is": "^16.5.2",
"react-lifecycles-compat": "^3.0.4"
},
"devDependencies": {
Expand Down
4 changes: 3 additions & 1 deletion src/routers/getScreenForRouteName.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { isValidElementType } from 'react-is';

import invariant from '../utils/invariant';

/**
Expand All @@ -23,7 +25,7 @@ export default function getScreenForRouteName(routeConfigs, routeName) {
if (typeof routeConfig.getScreen === 'function') {
const screen = routeConfig.getScreen();
invariant(
typeof screen === 'function',
isValidElementType(screen),
`The getScreen defined for route '${routeName} didn't return a valid ` +
'screen or navigator.\n\n' +
'Please pass it like this:\n' +
Expand Down
6 changes: 3 additions & 3 deletions src/routers/validateRouteConfigMap.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { isValidElementType } from 'react-is';

import invariant from '../utils/invariant';

/**
Expand All @@ -17,9 +19,7 @@ function validateRouteConfigMap(routeConfigs) {

if (
!screenComponent ||
(typeof screenComponent !== 'function' &&
typeof screenComponent !== 'string' &&
!routeConfig.getScreen)
(!isValidElementType(screenComponent) && !routeConfig.getScreen)
) {
throw new Error(`The component for route '${routeName}' must be a React component. For example:

Expand Down