Permalink
Browse files

Add Prop type for View

Reviewed By: yungsters

Differential Revision: D5098891

fbshipit-source-id: 5e1304344744e57c4d7f97455f49e1444fb7a42b
  • Loading branch information...
mjmahone authored and facebook-github-bot committed May 23, 2017
1 parent af90bab commit 05ec85043b86fa94408e7a72b55123a60c90426c
@@ -74,4 +74,14 @@ var TVViewPropTypes = {
};
export type TVViewProps = {
isTVSelectable?: bool,
hasTVPreferredFocus?: bool,
tvParallaxProperties?: Object,
tvParallaxShiftDistanceX?: number,
tvParallaxShiftDistanceY?: number,
tvParallaxTiltAngle?: number,
tvParallaxMagnification?: number,
};
module.exports = TVViewPropTypes;
@@ -14,26 +14,29 @@
const NativeMethodsMixin = require('NativeMethodsMixin');
const NativeModules = require('NativeModules');
const Platform = require('Platform');
const React = require('React');
const PropTypes = require('prop-types');
const React = require('React');
const ReactNativeFeatureFlags = require('ReactNativeFeatureFlags');
const ReactNativeStyleAttributes = require('ReactNativeStyleAttributes');
const ReactNativeViewAttributes = require('ReactNativeViewAttributes');
const ViewPropTypes = require('ViewPropTypes');
const invariant = require('fbjs/lib/invariant');
const requireNativeComponent = require('requireNativeComponent');
const warning = require('fbjs/lib/warning');
const {
AccessibilityComponentTypes,
AccessibilityTraits,
} = require('ViewAccessibility');
const requireNativeComponent = require('requireNativeComponent');
const forceTouchAvailable = (NativeModules.PlatformConstants &&
NativeModules.PlatformConstants.forceTouchAvailable) || false;
import type {ViewProps} from 'ViewPropTypes';
export type Props = ViewProps;
/**
* The most fundamental component for building a UI, `View` is a container that supports layout with
* [flexbox](docs/flexbox.html), [style](docs/style.html),
@@ -27,8 +27,49 @@ if (Platform.isTVOS) {
TVViewPropTypes = require('TVViewPropTypes');
}
import type {
AccessibilityComponentType,
AccessibilityTrait,
} from 'ViewAccessibility';
import type {EdgeInsetsProp} from 'EdgeInsetsPropType';
import type {TVViewProps} from 'TVViewPropTypes';
const stylePropType = StyleSheetPropType(ViewStylePropTypes);
// There's no easy way to create a different type if(Platform.isTVOS):
// so we must include TVViewProps
export type ViewProps = {
accessible?: bool,
accessibilityLabel?: React$PropType$Primitive<any>,
accessibilityComponentType?: AccessibilityComponentType,
accessibilityLiveRegion?: 'none' | 'polite' | 'assertive',
importantForAccessibility?: 'auto'| 'yes'| 'no'| 'no-hide-descendants',
accessibilityTraits?: AccessibilityTrait | Array<AccessibilityTrait>,
accessibilityViewIsModal?: bool,
onAccessibilityTap?: Function,
onMagicTap?: Function,
testID?: string,
nativeID?: string,
onResponderGrant?: Function,
onResponderMove?: Function,
onResponderReject?: Function,
onResponderRelease?: Function,
onResponderTerminate?: Function,
onResponderTerminationRequest?: Function,
onStartShouldSetResponder?: Function,
onStartShouldSetResponderCapture?: Function,
onMoveShouldSetResponder?: Function,
onMoveShouldSetResponderCapture?: Function,
hitSlop?: EdgeInsetsProp,
pointerEvents?: 'box-none'| 'none'| 'box-only'| 'auto',
style?: stylePropType,
removeClippedSubviews?: bool,
renderToHardwareTextureAndroid?: bool,
shouldRasterizeIOS?: bool,
collapsable?: bool,
needsOffscreenAlphaCompositing?: bool,
} & TVViewProps;
module.exports = {
...TVViewPropTypes,
@@ -11,15 +11,22 @@
*/
'use strict';
var {PropTypes} = require('React');
var createStrictShapeTypeChecker = require('createStrictShapeTypeChecker');
var {PropTypes} = require('React');
var EdgeInsetsPropType = createStrictShapeTypeChecker({
top: PropTypes.number,
left: PropTypes.number,
bottom: PropTypes.number,
right: PropTypes.number,
});
export type EdgeInsetsProp = {
top: number,
left: number,
bottom: number,
right: number,
};
module.exports = EdgeInsetsPropType;

0 comments on commit 05ec850

Please sign in to comment.