question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Reset to first card when modal is presented

See original GitHub issue

I 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:closed
  • Created 6 years ago
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
yonahforstcommented, Mar 14, 2018

please reopen

3reactions
zelgan90commented, Feb 6, 2018

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found