leecade / leecade/react-native-swiper

how to deal with the onPress event

Open
#160 2 comments 7 reactions 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

part of my code is shown as below. Please tell me why the onPress event can not be called.

var image=[];
    var carousel=this.state.carousel;
    for(var i=0;i<carousel.图片.length;i++){
      var path='http://'+config.serverAddress+carousel[i].图片地址;
      image.push(
        <View>
        <TouchableHighlight onPress={()=>{Alert.alert("touch")}}>
        <Image source={{uri:path}} height={width/2} navigator={this.props.navigator} key={i}/>
        </TouchableHighlight>
        </View>
        );
}

<Swiper style={styles.wrapper} showsButtons={true} autoplay={true} height={width/2} 
             activeDot={<View style={{backgroundColor: '#27c081', width: 8, height: 8, borderRadius: 4, marginLeft: 3, marginRight: 3, marginTop: 3, marginBottom: 3,}} />}
             nextButton={<Text style={styles.buttonText}>›</Text>}
             prevButton={<Text style={styles.buttonText}>‹</Text>}>
              {image}
            </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 with the inline render code, focusing on the TouchableHighlight and Swiper interaction. Reproduce the missing onPress callback and inspect the relevant component behavior; done means identifying the cause and documenting or confirming a fix, though the issue names no repository file or test.

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
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.