leecade / leecade/react-native-swiper

onIndexChanged not called, wrong screen rendered

Open
#503 34 comments 21 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Version

Which versions are you using:

  • react-native-swiper v1.5.8
  • react-native v0.47.1
Expected behavior
  1. onIndexChanged should be called when I swipe
  2. first View should be rendered as the first screen
Actual behavior
  1. not called
  2. third View (with "And simple" message) is rendered as first
Code example
export default class AppIntro extends PureComponent {

  onSwipe = (index) => {
    console.log('index changed', index);
  }

  render() {
    return (
      <Swiper style={styles.wrapper} onIndexChanged={this.onSwipe}>
        <View style={styles.slide1}>
          <Text style={styles.text}>Hello Swiper</Text>
        </View>
        <View style={styles.slide2}>
          <Text style={styles.text}>Beautiful</Text>
        </View>
        <View style={styles.slide3}>
          <Text style={styles.text}>And simple</Text>
        </View>
      </Swiper>
    );
  }
}

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 from the AppIntro example and the Swiper entry points for the onIndexChanged prop and initial screen selection. Reproduce the report with react-native-swiper v1.5.8 and React Native v0.47.1, then verify that swiping invokes the callback and the first View is rendered initially.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react-native
Domain
mobile
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 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.