leecade / leecade/react-native-swiper
Support to dynamic children and pageNumber property
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
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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