react-native-masonry-list
react-native-masonry-list copied to clipboard
MasonryList Component typing improvements.
Hi! 👋
Firstly, thanks for your work on this project! 🙂
Here is the diff that avoid typing's warnings on props data and renderItem:
diff --git a/node_modules/@react-native-seoul/masonry-list/lib/index.d.ts b/node_modules/@react-native-seoul/masonry-list/lib/index.d.ts
index dc67ceb..980b1c6 100644
--- a/node_modules/@react-native-seoul/masonry-list/lib/index.d.ts
+++ b/node_modules/@react-native-seoul/masonry-list/lib/index.d.ts
@@ -1,5 +1,5 @@
import type { Omit, RefreshControlProps, ScrollViewProps, StyleProp, ViewStyle } from 'react-native';
-import { ScrollView } from 'react-native';
+import { ListRenderItem, ScrollView } from "react-native";
import type { MutableRefObject, ReactElement } from 'react';
import React from 'react';
interface Props<T> extends Omit<ScrollViewProps, 'refreshControl'> {
@@ -11,11 +11,8 @@ interface Props<T> extends Omit<ScrollViewProps, 'refreshControl'> {
onEndReached?: () => void;
onEndReachedThreshold?: number;
style?: StyleProp<ViewStyle>;
- data: T[];
- renderItem: ({ item, i }: {
- item: T;
- i: number;
- }) => ReactElement;
+ data: ReadonlyArray<T>;
+ renderItem: ListRenderItem<ItemT> | null | undefined;
LoadingView?: React.ComponentType<any> | React.ReactElement | null;
ListHeaderComponent?: React.ReactNode | null;
ListEmptyComponent?: React.ComponentType<any> | React.ReactElement | null;
I am seeing this when I apply this patch 🤔