Skip to content

Commit

Permalink
Fix ScrollView missing properties (#5437)
Browse files Browse the repository at this point in the history
<!-- Thanks for submitting a pull request! We appreciate you spending
the time to work on these changes. Please follow the template so that
the reviewers can easily understand what the code changes affect. -->

## Summary

Fixes #5425. 

## Test plan

Added a new test suite.
  • Loading branch information
tjzel authored and piaskowyk committed Nov 30, 2023
1 parent 634e809 commit d6faee5
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 1 deletion.
69 changes: 69 additions & 0 deletions __typetests__/common.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1951,3 +1951,72 @@ function UseAnimatedRefTest() {
);
}
}

function AnimatedPropsTest() {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
function AnimatedPropsTestExistence(prop: any) {
class CustomClassComponent extends React.Component<never> {
render() {
return null;
}
}
const AnimatedCustomClassComponent =
Animated.createAnimatedComponent(CustomClassComponent);

return (
<>
<Animated.View
entering={prop}
layout={prop}
exiting={prop}
sharedTransitionTag={prop}
sharedTransitionStyle={prop}
animatedProps={prop}
/>
<Animated.Image
entering={prop}
layout={prop}
exiting={prop}
sharedTransitionTag={prop}
sharedTransitionStyle={prop}
animatedProps={prop}
source={{ uri: undefined }}
/>
<Animated.Text
entering={prop}
layout={prop}
exiting={prop}
sharedTransitionTag={prop}
sharedTransitionStyle={prop}
animatedProps={prop}
/>
<Animated.ScrollView
entering={prop}
layout={prop}
exiting={prop}
sharedTransitionTag={prop}
sharedTransitionStyle={prop}
animatedProps={prop}
/>
<Animated.FlatList
entering={prop}
layout={prop}
exiting={prop}
sharedTransitionTag={prop}
sharedTransitionStyle={prop}
animatedProps={prop}
data={[]}
renderItem={() => null}
/>
<AnimatedCustomClassComponent
entering={prop}
layout={prop}
exiting={prop}
sharedTransitionTag={prop}
sharedTransitionStyle={prop}
animatedProps={prop}
/>
</>
);
}
}
4 changes: 3 additions & 1 deletion src/reanimated2/component/ScrollView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ import { createAnimatedComponent } from '../../createAnimatedComponent';
import type { SharedValue } from '../commonTypes';
import type { AnimatedRef } from '../hook';
import { useAnimatedRef, useScrollViewOffset } from '../hook';
import type { AnimatedProps } from '../helperTypes';

export interface AnimatedScrollViewProps extends ScrollViewProps {
export interface AnimatedScrollViewProps
extends AnimatedProps<ScrollViewProps> {
scrollViewOffset?: SharedValue<number>;
}

Expand Down

0 comments on commit d6faee5

Please sign in to comment.