Skip to content

Commit

Permalink
Remove CellRendererComponent from Animated.FlatList props (#5951)
Browse files Browse the repository at this point in the history
## Summary

Closes #5931 

In our implementation of Animated.FlatList we overwrite
`CellRendererComponent` and providing it is not supported. Therefore I
remove it from valid props

## Error message
Error message should contain the information "CellRendererComponent is
not supported in Animated.FlatList"
Code:
<img width="717" alt="image"
src="https://github.com/software-mansion/react-native-reanimated/assets/56199675/0e59d647-26ac-4f2c-8082-333b9b3ecd67">

Error message:
<img width="717" alt="image"
src="https://github.com/software-mansion/react-native-reanimated/assets/56199675/e569fa48-9d90-48f6-a6ae-1bbdea698dc6">

## Test plan

Tests in `__typetests__/common/AnimatedComponentTest.tsx` added

---------

Co-authored-by: Tomasz Żelawski <40713406+tjzel@users.noreply.github.com>
  • Loading branch information
Latropos and tjzel committed May 14, 2024
1 parent f0ed036 commit 22927c8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
9 changes: 9 additions & 0 deletions __typetests__/common/AnimatedComponentTest.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,15 @@ function AnimatedComponentPropsTest() {
<MyAnimatedView style={RNStyle} />
<Animated.ScrollView style={RNStyle} />
<MyAnimatedScrollView style={RNStyle} />
<Animated.FlatList
style={RNStyle}
// @ts-expect-error
CellRendererComponent={() => {
return <View />;
}}
data={[]}
renderItem={() => <View />}
/>
<Animated.FlatList
style={RNStyle}
data={[]}
Expand Down
4 changes: 4 additions & 0 deletions src/reanimated2/component/FlatList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ interface ReanimatedFlatListPropsWithLayout<T>
* Lets you skip entering and exiting animations of FlatList items when on FlatList mount or unmount.
*/
skipEnteringExitingAnimations?: boolean;
/**
* Property `CellRendererComponent` is not supported in `Animated.FlatList`.
*/
CellRendererComponent?: never;
}

export type FlatListPropsWithLayout<T> = ReanimatedFlatListPropsWithLayout<T>;
Expand Down

0 comments on commit 22927c8

Please sign in to comment.