Eugnis/react-native-timeline-flatlist

options prop should be of type Optional<FlatlistProps>

king-d-dev opened this issue ยท 2 comments

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.

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

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