diff --git a/src/shared-element/ExNavigationSharedElement.js b/src/shared-element/ExNavigationSharedElement.js index 260f7fc..fa70004 100644 --- a/src/shared-element/ExNavigationSharedElement.js +++ b/src/shared-element/ExNavigationSharedElement.js @@ -7,11 +7,12 @@ import { UIManager, findNodeHandle, } from 'react-native'; +import invariant from 'invariant'; import type { TransitionProps, Metrics } from './ExNavigationSharedElementReducer'; type Props = { - children: () => React.Element<*>, + children?: () => React.Element<*>, id: string, // This is not part of the public API and is used by the overlay to pass down @@ -43,6 +44,7 @@ export default class SharedElement extends Component { ); } + invariant(childFn, 'Must pass a function as a child to `SharedElement`.'); const childEl = childFn(animationStyle); return cloneElement(childEl, {