Reset to first card when modal is presented
See original GitHub issueI have a modal that presents whenever the user swipes Right. The view is presented by setting a isModalVisible state variable. However, when I dismiss the modal view, the card stack resets to the first card. Why does this occur and how do I fix this?
Here is my code:
<Swiper
ref={swiper => {
this.swiper = swiper;
}}
infinite={true}
cards={this.state.cards}
cardIndex={this.state.cardIndex}
cardVerticalMargin={(Platform.OS === 'ios') ? 15: 160}
marginTop={(Platform.OS === 'ios') ? 0: -150}
marginBottom={(Platform.OS === 'ios') ? 115 : 0}
backgroundColor={'#ffffff'}
renderCard={this.renderCard}
onSwipedAll={this.onSwipedAllCards}
onSwiped={this.onSwiped}
onSwipedRight={this.handleYup}
onSwipedLeft={this.handleNope}
showSecondCard={true}
overlayLabels={{
bottom: {
title: 'BLEAH',
swipeColor: '#9262C2',
backgroundOpacity: '0.75',
fontColor: '#FFF'
},
left: {
title: 'NOPE',
swipeColor: '#FF6C6C',
backgroundOpacity: '0.75',
fontColor: '#FFF'
},
right: {
title: 'LIKE',
swipeColor: '#4CCC93',
backgroundOpacity: '0.75',
fontColor: '#FFF'
},
top: {
title: 'SUPER LIKE',
swipeColor: '#4EB8B7',
backgroundOpacity: '0.75',
fontColor: '#FFF'
}
}}
animateOverlayLabelsOpacity
animateCardOpacity
>
</Swiper>
Issue Analytics
- State:
- Created 6 years ago
- Comments:8 (1 by maintainers)
Top Results From Across the Web
Presenting a View Controller Modally Resets The Current View
I am trying to present view controller modally (a UIImagePickerController to be precise) while animating some views before the presentation.
Read more >Modality changes in iOS13 - Sarunw
What changes? So with iOS 13, default presentation for modal is now in sheet style. It is beautiful and packs with useful gestures....
Read more >Modal · Bootstrap v5.0
Use Bootstrap's JavaScript modal plugin to add dialogs to your site for lightboxes, user notifications, or completely custom content.
Read more >Showing and hiding view controllers - Apple Developer
Present a view controller modally. Use modal presentations to create temporary interruptions in your app's workflow, such as prompting the user for important ......
Read more >Modal — Shopify Polaris
Modals are overlays that require merchants to take an action before they can ... for merchant success: always put the most critical information...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
please reopen
Has anyone found a solution or effective workaround for this? This component works much better than other swipers, but things like this are almost a deal breaker.