Skip to content

Commit

Permalink
fixes a bug where NavigationPropTypes.SceneRenderer was a plain object
Browse files Browse the repository at this point in the history
Summary:
... used as both a shape and plain object.

this splits them out so both parts can be used as needed.

NavigationPropTypes.SceneRenderer is a PropTypes shape
NavigationPropTypes.SceneRendererProps is the plain object that makes up the shape.
Closes #7518

Differential Revision: D3317322

Pulled By: ericvicenti

fbshipit-source-id: e8a31e05130e6647b63f68dbef31bc874550948c
  • Loading branch information
joenoon authored and Facebook Github Bot 7 committed May 18, 2016
1 parent 6796f13 commit 0e997c6
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class NavigationCard extends React.Component<any, Props, any> {
props: Props;

static propTypes = {
...NavigationPropTypes.SceneRenderer,
...NavigationPropTypes.SceneRendererProps,
onComponentRef: PropTypes.func.isRequired,
panHandlers: NavigationPropTypes.panHandlers,
pointerEvents: PropTypes.string.isRequired,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ class NavigationCardStack extends React.Component<DefaultProps, Props, void> {
static propTypes = {
direction: PropTypes.oneOf([Directions.HORIZONTAL, Directions.VERTICAL]),
navigationState: NavigationPropTypes.navigationParentState.isRequired,
onNavigate: NavigationPropTypes.SceneRenderer.onNavigate,
onNavigate: NavigationPropTypes.SceneRendererProps.onNavigate,
renderOverlay: PropTypes.func,
renderScene: PropTypes.func.isRequired,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ class NavigationHeader extends React.Component<DefaultProps, Props, any> {
};

static propTypes = {
...NavigationPropTypes.SceneRenderer,
...NavigationPropTypes.SceneRendererProps,
renderLeftComponent: PropTypes.func,
renderRightComponent: PropTypes.func,
renderTitleComponent: PropTypes.func,
Expand Down
7 changes: 5 additions & 2 deletions Libraries/NavigationExperimental/NavigationPropTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ const scene = PropTypes.shape({
});

/* NavigationSceneRendererProps */
const SceneRenderer = {
const SceneRendererProps = {
layout: layout.isRequired,
navigationState: navigationParentState.isRequired,
onNavigate: PropTypes.func.isRequired,
Expand All @@ -74,6 +74,8 @@ const SceneRenderer = {
scenes: PropTypes.arrayOf(scene).isRequired,
};

const SceneRenderer = PropTypes.shape(SceneRendererProps);

/* NavigationPanPanHandlers */
const panHandlers = PropTypes.shape({
onMoveShouldSetResponder: PropTypes.func.isRequired,
Expand Down Expand Up @@ -111,11 +113,12 @@ module.exports = {
extractSceneRendererProps,

// Bundled propTypes.
SceneRenderer,
SceneRendererProps,

// propTypes
action,
navigationParentState,
navigationState,
panHandlers,
SceneRenderer,
};

0 comments on commit 0e997c6

Please sign in to comment.