leecade / leecade/react-native-swiper

Support to dynamic children and pageNumber property

Open
#100 2 comments 1 reaction 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

In this line https://github.com/leecade/react-native-swiper/blob/master/src%2Findex.js#L187

initState.total = props.children ? props.children.length || 1 : 0

You get the total page Number from children, this is really bad design when you want to have infinite swipes

It should be possible to set a pageNumber property to set the total, and also an option to render dynamic just one view

One use case, swipe pdf pages:

<Swiper
   totalPage={pdf.numberOfPages}
   onChange={(currentPage, nextPage) => this.setState({currentPage: nextPage})>
   <PDFView src={pdf.path} pageNumber={this.state.currentPage} />
</Swiper>

I can help you to merge some pull request :)

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

Start in src/index.js around line 187, where the page total is derived from props.children, and trace how that value affects swipe rendering and page-change callbacks. Define how totalPage and a single dynamically rendered view should interact, then verify the PDF-page use case and existing swipe behavior remain consistent.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react-native
Domain
mobile
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.