Eugnis / react-native-timeline-flatlist

FlatList based timeline component for React Native for iOS and Android
https://www.npmjs.com/package/react-native-timeline-flatlist
MIT License
480 stars 69 forks source link

options prop should be of type Optional<FlatlistProps> #58

Closed king-d-dev closed 2 years ago

king-d-dev commented 2 years ago

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch react-native-timeline-flatlist@0.8.0 for the project I'm working on.

I Realized the Timeline component has a field called options which was marked with the type of FlatlistProps, where as Flastlist has a few props that are required, but in our context wont be required since those props are passed directly to the Timeline component, a typical example is the renderItem prop which Flatlist requires but in this case wont be required on our end as consumers of the module. My suggestion is for us to wrap the FlatlistProps with the TS Optional utility method so we dont have to deal with TS errors requiring us to pass some props which technically we are not required to pass.

Here is the diff that solved my problem:

     renderFullLine?: boolean;
-    options?: FlatListProps<Data>;
+    options?: Optional<FlatListProps<Data>>;
     showTime?: boolean;
     isUsingFlatlist?: boolean;
   }

This issue body was partially generated by patch-package.

NatMuel commented 2 years ago

Running into the same error with typescript. Can you create a pull request to get this fixed?

shobhitsinghal624 commented 2 years ago

Added PR #67 to fix this. Lets wait for the maintainer to merge it.