glepur / react-native-swipe-gestures

4-directional swipe gestures for react-native
MIT License
607 stars 162 forks source link

Multiple Swipe Left required to swipe Left #66

Open ravi123saxena opened 3 years ago

ravi123saxena commented 3 years ago

HI, I have horizontal gallery and when swipe left it not happens in one swipe . I need multiple swipe to get it work. Please look into the issue.

<GestureRecognizer onSwipeLeft={() => { let currentPosition = this.state.currentPosition; if (this.state.alreadyVoted == true) { currentPosition = this.state.nextVotingPosition } if (currentPosition < this.state.contentList.length - 1) { this.setState({ currentPosition: currentPosition + 1, contentId: this.state.contentList[currentPosition + 1], alreadyVoted: false }) console.log('Displaying next item - ', currentPosition) } else { console.log('No more items to display!!') this.setState({ currentPosition: currentPosition + 1, alreadyVoted: false })

                                        }
                                        this.saveLastViewedContentForCampaign(
                                            this.state.campaignId,
                                            currentPosition + 1)
                                    }}
                                    config={{
                                        detectSwipeUp: false,
                                        detectSwipeDown: false,
                                        detectSwipeRight: false,
                                        velocityThreshold: 0.3,
                                        directionalOffsetThreshold: 80
                                    }}>{this.renderGallery(tabVerticalStyles)}
                                </GestureRecognizer>
hussainahmad commented 3 years ago

@dpk89 did you find any solution ?

ravi123saxena commented 3 years ago

Did you find a solution for this?

I am using some custom code. I have attached the source code.

UseCase:

<SwipeGesture style={this.isLandscapeAsset() ? phoneStyles.vote2GalleryContainerLandscape : phoneStyles.vote2GalleryContainer} onSwipePerformed={this.onSwipePerformed}

{this.renderGallery(phoneStyles)}

swipe-gesture.js.zip