fixes a bug where NavigationPropTypes.SceneRenderer was a plain object
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 https://github.com/facebook/react-native/pull/7518 Differential Revision: D3317322 Pulled By: ericvicenti fbshipit-source-id: e8a31e05130e6647b63f68dbef31bc874550948c
This commit is contained in:
Родитель
6796f136f1
Коммит
0e997c6eab
|
@ -92,7 +92,7 @@ class NavigationCard extends React.Component<any, Props, any> {
|
||||||
props: Props;
|
props: Props;
|
||||||
|
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
...NavigationPropTypes.SceneRenderer,
|
...NavigationPropTypes.SceneRendererProps,
|
||||||
onComponentRef: PropTypes.func.isRequired,
|
onComponentRef: PropTypes.func.isRequired,
|
||||||
panHandlers: NavigationPropTypes.panHandlers,
|
panHandlers: NavigationPropTypes.panHandlers,
|
||||||
pointerEvents: PropTypes.string.isRequired,
|
pointerEvents: PropTypes.string.isRequired,
|
||||||
|
|
|
@ -90,7 +90,7 @@ class NavigationCardStack extends React.Component<DefaultProps, Props, void> {
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
direction: PropTypes.oneOf([Directions.HORIZONTAL, Directions.VERTICAL]),
|
direction: PropTypes.oneOf([Directions.HORIZONTAL, Directions.VERTICAL]),
|
||||||
navigationState: NavigationPropTypes.navigationParentState.isRequired,
|
navigationState: NavigationPropTypes.navigationParentState.isRequired,
|
||||||
onNavigate: NavigationPropTypes.SceneRenderer.onNavigate,
|
onNavigate: NavigationPropTypes.SceneRendererProps.onNavigate,
|
||||||
renderOverlay: PropTypes.func,
|
renderOverlay: PropTypes.func,
|
||||||
renderScene: PropTypes.func.isRequired,
|
renderScene: PropTypes.func.isRequired,
|
||||||
};
|
};
|
||||||
|
|
|
@ -103,7 +103,7 @@ class NavigationHeader extends React.Component<DefaultProps, Props, any> {
|
||||||
};
|
};
|
||||||
|
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
...NavigationPropTypes.SceneRenderer,
|
...NavigationPropTypes.SceneRendererProps,
|
||||||
renderLeftComponent: PropTypes.func,
|
renderLeftComponent: PropTypes.func,
|
||||||
renderRightComponent: PropTypes.func,
|
renderRightComponent: PropTypes.func,
|
||||||
renderTitleComponent: PropTypes.func,
|
renderTitleComponent: PropTypes.func,
|
||||||
|
|
|
@ -65,7 +65,7 @@ const scene = PropTypes.shape({
|
||||||
});
|
});
|
||||||
|
|
||||||
/* NavigationSceneRendererProps */
|
/* NavigationSceneRendererProps */
|
||||||
const SceneRenderer = {
|
const SceneRendererProps = {
|
||||||
layout: layout.isRequired,
|
layout: layout.isRequired,
|
||||||
navigationState: navigationParentState.isRequired,
|
navigationState: navigationParentState.isRequired,
|
||||||
onNavigate: PropTypes.func.isRequired,
|
onNavigate: PropTypes.func.isRequired,
|
||||||
|
@ -74,6 +74,8 @@ const SceneRenderer = {
|
||||||
scenes: PropTypes.arrayOf(scene).isRequired,
|
scenes: PropTypes.arrayOf(scene).isRequired,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const SceneRenderer = PropTypes.shape(SceneRendererProps);
|
||||||
|
|
||||||
/* NavigationPanPanHandlers */
|
/* NavigationPanPanHandlers */
|
||||||
const panHandlers = PropTypes.shape({
|
const panHandlers = PropTypes.shape({
|
||||||
onMoveShouldSetResponder: PropTypes.func.isRequired,
|
onMoveShouldSetResponder: PropTypes.func.isRequired,
|
||||||
|
@ -111,11 +113,12 @@ module.exports = {
|
||||||
extractSceneRendererProps,
|
extractSceneRendererProps,
|
||||||
|
|
||||||
// Bundled propTypes.
|
// Bundled propTypes.
|
||||||
SceneRenderer,
|
SceneRendererProps,
|
||||||
|
|
||||||
// propTypes
|
// propTypes
|
||||||
action,
|
action,
|
||||||
navigationParentState,
|
navigationParentState,
|
||||||
navigationState,
|
navigationState,
|
||||||
panHandlers,
|
panHandlers,
|
||||||
|
SceneRenderer,
|
||||||
};
|
};
|
||||||
|
|
Загрузка…
Ссылка в новой задаче