Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[flow-strict] Flow strict TouchableHighlight #22173

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 21 additions & 6 deletions Libraries/Components/AppleTV/TVViewPropTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,31 +10,46 @@

'use strict';

type TVParallaxPropertiesType = $ReadOnly<{|
export type TVParallaxPropertiesType = $ReadOnly<{|
/**
* If true, parallax effects are enabled. Defaults to true.
*/
enabled: boolean,
enabled?: boolean,

/**
* Defaults to 2.0.
*/
shiftDistanceX: number,
shiftDistanceX?: number,

/**
* Defaults to 2.0.
*/
shiftDistanceY: number,
shiftDistanceY?: number,

/**
* Defaults to 0.05.
*/
tiltAngle: number,
tiltAngle?: number,

/**
* Defaults to 1.0
*/
magnification: number,
magnification?: number,

/**
* Defaults to 1.0
*/
pressMagnification?: number,

/**
* Defaults to 0.3
*/
pressDuration?: number,

/**
* Defaults to 0.3
*/
pressDelay?: number,
|}>;

/**
Expand Down
20 changes: 5 additions & 15 deletions Libraries/Components/Touchable/TouchableHighlight.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import type {PressEvent} from 'CoreEventTypes';
import type {ViewStyleProp} from 'StyleSheet';
import type {ColorValue} from 'StyleSheetTypes';
import type {Props as TouchableWithoutFeedbackProps} from 'TouchableWithoutFeedback';
import type {TVParallaxPropertiesType} from 'TVViewPropTypes';

const DEFAULT_PROPS = {
activeOpacity: 0.85,
Expand All @@ -39,7 +40,7 @@ const PRESS_RETENTION_OFFSET = {top: 20, left: 20, right: 20, bottom: 30};

type IOSProps = $ReadOnly<{|
hasTVPreferredFocus?: ?boolean,
tvParallaxProperties?: ?Object,
tvParallaxProperties?: ?TVParallaxPropertiesType,
|}>;

type Props = $ReadOnly<{|
Expand All @@ -49,8 +50,8 @@ type Props = $ReadOnly<{|
activeOpacity?: ?number,
underlayColor?: ?ColorValue,
style?: ?ViewStyleProp,
onShowUnderlay?: ?Function,
onHideUnderlay?: ?Function,
onShowUnderlay?: ?() => void,
onHideUnderlay?: ?() => void,
testOnly_pressed?: ?boolean,
|}>;

Expand Down Expand Up @@ -185,18 +186,7 @@ const TouchableHighlight = ((createReactClass({
*/
hasTVPreferredFocus: PropTypes.bool,
/**
* *(Apple TV only)* Object with properties to control Apple TV parallax effects.
*
* enabled: If true, parallax effects are enabled. Defaults to true.
* shiftDistanceX: Defaults to 2.0.
* shiftDistanceY: Defaults to 2.0.
* tiltAngle: Defaults to 0.05.
* magnification: Defaults to 1.0.
* pressMagnification: Defaults to 1.0.
* pressDuration: Defaults to 0.3.
* pressDelay: Defaults to 0.0.
*
* @platform ios
* Apple TV parallax effects
*/
tvParallaxProperties: PropTypes.object,
/**
Expand Down