react-native-masonry-list icon indicating copy to clipboard operation
react-native-masonry-list copied to clipboard

MasonryList Component typing improvements.

Open CarmineRumma opened this issue 3 years ago • 1 comments

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;

CarmineRumma avatar Nov 09 '22 12:11 CarmineRumma

Screenshot 2023-01-24 at 7 15 33 PM

I am seeing this when I apply this patch 🤔

hyochan avatar Jan 24 '23 10:01 hyochan