Skip to content

Commit ec93479

Browse files
janicduplessismbifulco
authored andcommitted
Fix flow for children prop
Flow doesn't understand jsx + children (facebook/flow#1964) so this makes the prop optional and adds an invariant to make sure it was actually passed. Closes expo#301 fbshipit-source-id: 76ea6d7
1 parent ae86d3b commit ec93479

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/shared-element/ExNavigationSharedElement.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,12 @@ import {
77
UIManager,
88
findNodeHandle,
99
} from 'react-native';
10+
import invariant from 'invariant';
1011

1112
import type { TransitionProps, Metrics } from './ExNavigationSharedElementReducer';
1213

1314
type Props = {
14-
children: () => React.Element<*>,
15+
children?: () => React.Element<*>,
1516
id: string,
1617

1718
// 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 {
4344
);
4445
}
4546

47+
invariant(childFn, 'Must pass a function as a child to `SharedElement`.');
4648
const childEl = childFn(animationStyle);
4749

4850
return cloneElement(childEl, {

0 commit comments

Comments
 (0)