leecade / leecade/react-native-swiper

Typescript: Props should (maybe) extend ScrollViewProps

Open
#834 3 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
10.5k
Forks
2.3k
PR merge metrics
No merged PRs in 30d

Description

Which OS ?

N/A

Version

Which versions are you using:

  • react-native-swiper: master
  • react-native N/A
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's scrollViewStyle, extending the typing and exposing a style 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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Inspect src/index.js around line 626 and the linked React Native ScrollViewProps definition to identify which ScrollView props are forwarded and which Swiper props conflict. Update the TypeScript definitions so supported props such as keyboardShouldPersistTaps are accepted without exposing misleading overrides, then verify the relevant typing behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
react-native, typescript
Domain
mobile
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.