Use Flow type inference for interpolation outputRange
Summary: Changelog: [Internal] Cleans up unnecessary type casts / suppressions throughout the codebase following D35869725. Reviewed By: javache Differential Revision: D35870027 fbshipit-source-id: eefcb544b19ba93587011cdfd4046d18dddb246e
This commit is contained in:
Родитель
7b86fa2b79
Коммит
598c2e02fd
|
@ -45,9 +45,6 @@ function LogBoxInspectorSourceMapStatus(props: Props): React.Node {
|
||||||
animation,
|
animation,
|
||||||
rotate: animated.interpolate({
|
rotate: animated.interpolate({
|
||||||
inputRange: [0, 1],
|
inputRange: [0, 1],
|
||||||
/* $FlowFixMe[speculation-ambiguous] (>=0.38.0) - Flow error
|
|
||||||
* detected during the deployment of v0.38.0. To see the error,
|
|
||||||
* remove this comment and run flow */
|
|
||||||
outputRange: ['0deg', '360deg'],
|
outputRange: ['0deg', '360deg'],
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
|
|
|
@ -160,7 +160,7 @@ function ComposingExampleItem({
|
||||||
{boxIndexes.map(boxIndex => {
|
{boxIndexes.map(boxIndex => {
|
||||||
const translateX = xTranslations.current[boxIndex].interpolate({
|
const translateX = xTranslations.current[boxIndex].interpolate({
|
||||||
inputRange: [0, 1],
|
inputRange: [0, 1],
|
||||||
outputRange: ([0, maxXTranslation]: [number, number]),
|
outputRange: [0, maxXTranslation],
|
||||||
});
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
|
@ -56,22 +56,22 @@ function RotatingImagesView({useNativeDriver}: {useNativeDriver: boolean}) {
|
||||||
{
|
{
|
||||||
scale: anim.interpolate({
|
scale: anim.interpolate({
|
||||||
inputRange: [0, 1],
|
inputRange: [0, 1],
|
||||||
outputRange: ([1, 10]: $ReadOnlyArray<number>),
|
outputRange: [1, 10],
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
translateX: anim.interpolate({
|
translateX: anim.interpolate({
|
||||||
inputRange: [0, 1],
|
inputRange: [0, 1],
|
||||||
outputRange: ([0, 100]: $ReadOnlyArray<number>),
|
outputRange: [0, 100],
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
rotate: anim.interpolate({
|
rotate: anim.interpolate({
|
||||||
inputRange: [0, 1],
|
inputRange: [0, 1],
|
||||||
outputRange: ([
|
outputRange: [
|
||||||
'0deg',
|
'0deg',
|
||||||
'360deg', // 'deg' or 'rad'
|
'360deg', // 'deg' or 'rad'
|
||||||
]: $ReadOnlyArray<string>),
|
],
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|
|
@ -62,22 +62,22 @@ function TransformBounceView({useNativeDriver}: {useNativeDriver: boolean}) {
|
||||||
{
|
{
|
||||||
scale: anim.interpolate({
|
scale: anim.interpolate({
|
||||||
inputRange: [0, 1],
|
inputRange: [0, 1],
|
||||||
outputRange: ([1, 4]: $ReadOnlyArray<number>),
|
outputRange: [1, 4],
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
translateX: anim.interpolate({
|
translateX: anim.interpolate({
|
||||||
inputRange: [0, 1],
|
inputRange: [0, 1],
|
||||||
outputRange: ([0, 500]: $ReadOnlyArray<number>),
|
outputRange: [0, 500],
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
rotate: anim.interpolate({
|
rotate: anim.interpolate({
|
||||||
inputRange: [0, 1],
|
inputRange: [0, 1],
|
||||||
outputRange: ([
|
outputRange: [
|
||||||
'0deg',
|
'0deg',
|
||||||
'360deg', // 'deg' or 'rad'
|
'360deg', // 'deg' or 'rad'
|
||||||
]: $ReadOnlyArray<string>),
|
],
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|
|
@ -145,9 +145,6 @@ class LoopExample extends React.Component<{...}, $FlowFixMeState> {
|
||||||
{
|
{
|
||||||
opacity: this.state.value.interpolate({
|
opacity: this.state.value.interpolate({
|
||||||
inputRange: [0, 0.5, 1],
|
inputRange: [0, 0.5, 1],
|
||||||
/* $FlowFixMe[speculation-ambiguous] (>=0.38.0) - Flow error
|
|
||||||
* detected during the deployment of v0.38.0. To see the error,
|
|
||||||
* remove this comment and run flow */
|
|
||||||
outputRange: [0, 1, 0],
|
outputRange: [0, 1, 0],
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
|
@ -243,9 +240,6 @@ class EventExample extends React.Component<{...}, $FlowFixMeState> {
|
||||||
{
|
{
|
||||||
rotate: this.state.anim.interpolate({
|
rotate: this.state.anim.interpolate({
|
||||||
inputRange: [0, 1],
|
inputRange: [0, 1],
|
||||||
/* $FlowFixMe[speculation-ambiguous] (>=0.38.0) - Flow
|
|
||||||
* error detected during the deployment of v0.38.0. To see
|
|
||||||
* the error, remove this comment and run flow */
|
|
||||||
outputRange: ['0deg', '1deg'],
|
outputRange: ['0deg', '1deg'],
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
|
|
|
@ -32,16 +32,10 @@ class ScrollViewAnimatedExample extends Component<{...}> {
|
||||||
render(): React.Node {
|
render(): React.Node {
|
||||||
const interpolated = this._scrollViewPos.interpolate({
|
const interpolated = this._scrollViewPos.interpolate({
|
||||||
inputRange: [0, 1],
|
inputRange: [0, 1],
|
||||||
/* $FlowFixMe[speculation-ambiguous] (>=0.38.0) - Flow error detected
|
|
||||||
* during the deployment of v0.38.0. To see the error, remove this
|
|
||||||
* comment and run flow */
|
|
||||||
outputRange: [0, 0.1],
|
outputRange: [0, 0.1],
|
||||||
});
|
});
|
||||||
const interpolated2 = this._scrollViewPos.interpolate({
|
const interpolated2 = this._scrollViewPos.interpolate({
|
||||||
inputRange: [0, 1],
|
inputRange: [0, 1],
|
||||||
/* $FlowFixMe[speculation-ambiguous] (>=0.38.0) - Flow error detected
|
|
||||||
* during the deployment of v0.38.0. To see the error, remove this
|
|
||||||
* comment and run flow */
|
|
||||||
outputRange: ['0deg', '1deg'],
|
outputRange: ['0deg', '1deg'],
|
||||||
});
|
});
|
||||||
return (
|
return (
|
||||||
|
|
|
@ -119,7 +119,7 @@ function SwipeableCard(props: {
|
||||||
const {width} = useWindowDimensions();
|
const {width} = useWindowDimensions();
|
||||||
const rotation = movementX.interpolate({
|
const rotation = movementX.interpolate({
|
||||||
inputRange: [-width / 2, 0, width / 2],
|
inputRange: [-width / 2, 0, width / 2],
|
||||||
outputRange: (['-5deg', '0deg', '5deg']: $ReadOnlyArray<string>),
|
outputRange: ['-5deg', '0deg', '5deg'],
|
||||||
extrapolate: 'clamp',
|
extrapolate: 'clamp',
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -38,9 +38,6 @@ function AnimateTansformSingleProp() {
|
||||||
{
|
{
|
||||||
rotate: theta.interpolate({
|
rotate: theta.interpolate({
|
||||||
inputRange: [0, 100],
|
inputRange: [0, 100],
|
||||||
/* $FlowFixMe[speculation-ambiguous] (>=0.38.0) - Flow error
|
|
||||||
* detected during the deployment of v0.38.0. To see the
|
|
||||||
* error, remove this comment and run flow */
|
|
||||||
outputRange: ['0deg', '360deg'],
|
outputRange: ['0deg', '360deg'],
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
|
@ -79,9 +76,6 @@ function Flip() {
|
||||||
{
|
{
|
||||||
rotateX: theta.interpolate({
|
rotateX: theta.interpolate({
|
||||||
inputRange: [0, 180],
|
inputRange: [0, 180],
|
||||||
/* $FlowFixMe[speculation-ambiguous] (>=0.38.0) - Flow error
|
|
||||||
* detected during the deployment of v0.38.0. To see the
|
|
||||||
* error, remove this comment and run flow */
|
|
||||||
outputRange: ['0deg', '180deg'],
|
outputRange: ['0deg', '180deg'],
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
|
@ -100,9 +94,6 @@ function Flip() {
|
||||||
{
|
{
|
||||||
rotateX: theta.interpolate({
|
rotateX: theta.interpolate({
|
||||||
inputRange: [0, 180],
|
inputRange: [0, 180],
|
||||||
/* $FlowFixMe[speculation-ambiguous] (>=0.38.0) - Flow error
|
|
||||||
* detected during the deployment of v0.38.0. To see the
|
|
||||||
* error, remove this comment and run flow */
|
|
||||||
outputRange: ['180deg', '360deg'],
|
outputRange: ['180deg', '360deg'],
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
|
|
Загрузка…
Ссылка в новой задаче