move propTypes, defaultProps, and childContextTypes into class.

Summary: This will make the code more readable.

Reviewed By: ericvicenti

Differential Revision: D3096663

fb-gh-sync-id: 540d2107ea3cd4c60aabdf7a6503c8c22bc4a985
fbshipit-source-id: 540d2107ea3cd4c60aabdf7a6503c8c22bc4a985
This commit is contained in:
Hedger Wang
2016-03-28 16:45:18 -07:00
committed by Facebook Github Bot 2
parent a7e5312aeb
commit a28e59bd97
4 changed files with 82 additions and 77 deletions

View File

@@ -32,7 +32,6 @@
*/
'use strict';
const Animated = require('Animated');
const NavigationAnimatedView = require('NavigationAnimatedView');
const NavigationCard = require('NavigationCard');
const NavigationCardStackStyleInterpolator = require('NavigationCardStackStyleInterpolator');
@@ -49,7 +48,6 @@ const {PropTypes} = React;
const {Directions} = NavigationCardStackPanResponder;
import type {
NavigationAnimatedValue,
NavigationParentState,
NavigationSceneRenderer,
NavigationSceneRendererProps,
@@ -66,18 +64,6 @@ type Props = {
renderScene: NavigationSceneRenderer,
};
const propTypes = {
direction: PropTypes.oneOf([Directions.HORIZONTAL, Directions.VERTICAL]),
navigationState: NavigationPropTypes.navigationParentState.isRequired,
renderOverlay: PropTypes.func,
renderScene: PropTypes.func.isRequired,
};
const defaultProps = {
direction: Directions.HORIZONTAL,
renderOverlay: emptyFunction.thatReturnsNull,
};
/**
* A controlled navigation view that renders a stack of cards.
*
@@ -95,6 +81,18 @@ const defaultProps = {
class NavigationCardStack extends React.Component {
_renderScene : NavigationSceneRenderer;
static propTypes = {
direction: PropTypes.oneOf([Directions.HORIZONTAL, Directions.VERTICAL]),
navigationState: NavigationPropTypes.navigationParentState.isRequired,
renderOverlay: PropTypes.func,
renderScene: PropTypes.func.isRequired,
};
static defaultProps = {
direction: Directions.HORIZONTAL,
renderOverlay: emptyFunction.thatReturnsNull,
};
constructor(props: Props, context: any) {
super(props, context);
}
@@ -145,9 +143,6 @@ class NavigationCardStack extends React.Component {
}
}
NavigationCardStack.propTypes = propTypes;
NavigationCardStack.defaultProps = defaultProps;
const styles = StyleSheet.create({
animatedView: {
flex: 1,