leecade / leecade/react-native-swiper

Explain renderScrollview in code

Open
#554 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Can any one explain me why there is separate code for android and ios for rendering scrollview in code. Is there any special purpose to do that??

can't we use for android as well instead of ?? will it create any issue in android?

src/index.js

 renderScrollView = pages => {
    if (Platform.OS === 'ios') {
      return (
        <ScrollView ref='scrollView'
          {...this.props}
          {...this.scrollViewPropOverrides()}
          contentContainerStyle={[styles.wrapperIOS, this.props.style]}
          contentOffset={this.state.offset}
          onScrollBeginDrag={this.onScrollBegin}
          onMomentumScrollEnd={this.onScrollEnd}
          onScrollEndDrag={this.onScrollEndDrag}>
          {pages}
        </ScrollView>
       )
    }
    return (
      <ViewPagerAndroid ref='scrollView'
        {...this.props}
        initialPage={this.props.loop ? this.state.index + 1 : this.state.index}
        onPageSelected={this.onScrollEnd}
        key={pages.length}
        style={[styles.wrapperAndroid, this.props.style]}>
        {pages}
      </ViewPagerAndroid>
    )
  }

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 at renderScrollView and compare the iOS ScrollView branch with the Android ViewPagerAndroid branch. Trace the related props and scroll callbacks shown there, then document the platform-specific rationale and whether using ScrollView on Android is supported; done means the explanation answers the issue's questions clearly.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react-native
Domain
mobile
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.