leecade / leecade/react-native-swiper

onMomentumScrollEnd and OnIndexChanged not firing

Open
#596 10 comments 0 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

On Windows 10

  • react-native-swiper v1.5.12
  • react-native v0.48.4

Oddly enough I have the same code on two pages, with just basic views, and on one it fires, and on the other it doesn't. I'm getting no logs for anything.

I can't fork the code because it's private, but this is the gist of the code.
Working code

render() {
  return (
    <View style={styles.container}>
        <Header title={this.state.title} onPress={()=>this.props.navigation.goBack()}/>
        <View style={styles.body}>
            <View style={styles.routes}>
              <Swiper loadMinimal={true} loadMinimalSize={4} showsPagination={false}>
                  {this.display()}
              </Swiper>
            </View>
            <View style={styles.alpha}>
                {this.displayAlpha()}
            </View>
          </View>
      </View>
  )

Not working code

onMomentumScrollEnd = (e, state, context) => {
    Reactotron.log(this.state.List[state.index].title)
    Reactotron.log(true, true)
}
render() {
  return (
     <View style={styles.container}>
       <Header title={this.state.title} onPress={()=>this.props.navigation.goBack()} navigate={this.props.navigation.navigate}/>
       <View style={styles.body}>
          <View style={styles.routes}>
             <Swiper loadMinimal={true} loadMinimalSize={4} showsPagination={false} onMomentumScrollEnd={this.onMomentumScrollEnd}>
                   {this.display()}
             </Swiper>
          </View>
          <View style={styles.alpha}>
            {this.displayAlpha()}
          </View>
        </View>
      </View>
  )
}

this.display() returns an array of basic like components.

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 by comparing the working and non-working render snippets, focusing on the Swiper onMomentumScrollEnd prop and the display() child array under React Native 0.48.4 and react-native-swiper 1.5.12 on Windows 10. Reproduce the missing callback with a minimal public example or inspect the Swiper callback entry point; done when the callback reliably logs the index in the affected setup.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react-native
Domain
frontend, mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.