Open mmarvick opened 6 years ago
It looks like you can use TypeScript's Exclude
to remove props from a type.
https://stackoverflow.com/a/49662505/3081611
So it'd be possible to exclude a few things from ScrollViewProps
that can't really be set on Swiper
(e.g. style
), and then have SwiperProps
extend from that.
+1 for adding keyboardShouldPersistTaps
This can be closed. Adding keyboardShouldPersistTaps="handled" successfully added the prop.
Which OS ?
N/A
Version
Which versions are you using:
master
Expected behaviour
I should be able to add most ScrollViewProps (e.g.
keyboardShouldPersistTaps={'handled'}
), and TypeScript shouldn't complain.Actual behaviour
TypeScript doesn't know that I can use other scrollview props.
Misc
With some exception of overwritten props by the library, almost all props that can be set on ScrollView can be set on swiper: https://github.com/leecade/react-native-swiper/blob/master/src/index.js#L626
It'd be great if we could just extend from ScrollViewProps. Because some properties like ScrollView's
style
are getting set to other things like Swiper'sscrollViewStyle
, extending the typing and exposing astyle
property may be misleading. I'm not sure if you can "extend an interface except for these ___ props", but if you can that seems like an ideal solution.At the very least.. I'd love to get
keyboardShouldPersistTaps
added to the definition :) But there's probably others too that could be brought over.