Skip to content

Commit

Permalink
Update Types
Browse files Browse the repository at this point in the history
  • Loading branch information
piaskowyk committed Aug 17, 2022
1 parent 128f9c3 commit af31d7a
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 21 deletions.
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -100,7 +100,7 @@
"@types/babel__generator": "^7.6.4",
"@types/babel__traverse": "^7.14.2",
"@types/jest": "^27.4.0",
"@types/react-native": "^0.66.15",
"@types/react-native": "^0.69.5",
"@typescript-eslint/eslint-plugin": "^5.11.0",
"@typescript-eslint/parser": "^5.11.0",
"babel-eslint": "^10.1.0",
Expand Down
14 changes: 9 additions & 5 deletions src/reanimated2/component/FlatList.tsx
Expand Up @@ -6,10 +6,14 @@ import { ILayoutAnimationBuilder } from '../layoutReanimation/animationBuilder/c

const AnimatedFlatList = createAnimatedComponent(FlatList as any) as any;

interface AnimatedFlatListProps {
onLayout: (event: LayoutChangeEvent) => void;
// implicit `children` prop has been removed in @types/react^18.0.0
children: React.ReactNode;
}

const createCellRenderer = (itemLayoutAnimation?: ILayoutAnimationBuilder) => {
const cellRenderer: React.FC<{
onLayout: (event: LayoutChangeEvent) => void;
}> = (props) => {
const cellRenderer = (props: AnimatedFlatListProps) => {
return (
<ReanimatedView layout={itemLayoutAnimation} onLayout={props.onLayout}>
{props.children}
Expand All @@ -20,11 +24,11 @@ const createCellRenderer = (itemLayoutAnimation?: ILayoutAnimationBuilder) => {
return cellRenderer;
};

export interface ReanimatedFlatlistProps<ItemT> extends FlatListProps<ItemT> {
export interface ReanimatedFlatListProps<ItemT> extends FlatListProps<ItemT> {
itemLayoutAnimation?: ILayoutAnimationBuilder;
}

type ReanimatedFlatListFC<T = any> = React.FC<ReanimatedFlatlistProps<T>>;
type ReanimatedFlatListFC<T = any> = React.FC<ReanimatedFlatListProps<T>>;

const ReanimatedFlatlist: ReanimatedFlatListFC = forwardRef(
(props: ReanimatedFlatListProps<any>, ref: ForwardedRef<FlatList>) => {
Expand Down
21 changes: 6 additions & 15 deletions yarn.lock
Expand Up @@ -3933,12 +3933,12 @@
dependencies:
"@types/react" "*"

"@types/react-native@^0.66.15":
version "0.66.21"
resolved "https://registry.yarnpkg.com/@types/react-native/-/react-native-0.66.21.tgz#0af38b44fb5a4afdc4ef6ecf065ef91ee5bc813f"
integrity sha512-O/PLXzTWZsNByotNKLxBWe/ePr/qV2km2pXflnMFkaot3KdfMl36E/0c5JVRMKCxxmDVvoazVHkqPuAvnkkgxA==
"@types/react-native@^0.69.5":
version "0.69.5"
resolved "https://registry.yarnpkg.com/@types/react-native/-/react-native-0.69.5.tgz#7709fdbff031a5ecf1956705e6c4a07cdfe6867c"
integrity sha512-mSUCuGUsW2kJlZiu4GmdYVDKZX/52iyC9rm6dxAmflJj1b7kSO/CMSDy5WbcfS8QerxTqbYGTrIwHD0GnXHzbQ==
dependencies:
"@types/react" "^17"
"@types/react" "*"

"@types/react-test-renderer@>=16.9.0":
version "18.0.0"
Expand All @@ -3965,15 +3965,6 @@
"@types/scheduler" "*"
csstype "^3.0.2"

"@types/react@^17":
version "17.0.48"
resolved "https://registry.yarnpkg.com/@types/react/-/react-17.0.48.tgz#a4532a8b91d7b27b8768b6fc0c3bccb760d15a6c"
integrity sha512-zJ6IYlJ8cYYxiJfUaZOQee4lh99mFihBoqkOSEGV+dFi9leROW6+PgstzQ+w3gWTnUfskALtQPGHK6dYmPj+2A==
dependencies:
"@types/prop-types" "*"
"@types/scheduler" "*"
csstype "^3.0.2"

"@types/responselike@*", "@types/responselike@^1.0.0":
version "1.0.0"
resolved "https://registry.npmjs.org/@types/responselike/-/responselike-1.0.0.tgz"
Expand Down Expand Up @@ -9935,7 +9926,7 @@ react-test-renderer@18.0.0:

react@17.0.2:
version "17.0.2"
resolved "https://registry.npmjs.org/react/-/react-17.0.2.tgz"
resolved "https://registry.yarnpkg.com/react/-/react-17.0.2.tgz#d0b5cc516d29eb3eee383f75b62864cfb6800037"
integrity sha512-gnhPt75i/dq/z3/6q/0asP78D0u592D5L1pd7M8P+dck6Fu/jJeL6iVVK23fptSUZj8Vjf++7wXA8UNclGQcbA==
dependencies:
loose-envify "^1.1.0"
Expand Down

0 comments on commit af31d7a

Please sign in to comment.