Comments (8)
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.
from react-native-deck-swiper.
please reopen
from react-native-deck-swiper.
@acesetmatch I think 1.3.3 fixed it. closing the issue.
from react-native-deck-swiper.
This problem is still there with version 1.4.2. I've created a modal which appears when tapping on the card and when opening the modal, the card stack resets to the first card.
onTapCard = (cardIndex) => {
this.setState({currentCardIndex: cardIndex});
this.setDetailsVisible(true);
};
<Swiper
ref={swiper => {
this.swiper = swiper;
}}
cards={this.state.cards}
renderCard={this.renderCard}
onTapCard={this.onTapCard}
cardIndex={this.state.cardIndex}
horizontalSwipe={this.state.horizontalSwipe}
verticalSwipe={this.state.verticalSwipe}
showSecondCard={this.state.showNextCard}
goBackToPreviousCardOnSwipeBottom={this.state.verticalSwipeBack}
goBackToPreviousCardOnSwipeRight={this.state.horizontalSwipeBack}
infinite={this.state.infiniteSwiping}
backgroundColor={Colors.transparent}
cardStyle={styles.cardSwiper}
cardVerticalMargin={10}>
</Swiper>
<Modal
animationType="slide"
transparent={false}
visible={this.state.detailsVisible}
onRequestClose={() => {
this.setDetailsVisible(false);
this.setState({cardIndex: this.state.currentCardIndex}); // workaround with warning
}}
>
In the moment I need so set the cardIndex manually to the current index, but then there is a warning.
Warning: flattenChildren(...): Encountered two children with the same key,
1
. Keys should be unique so that components maintain their identity across updates. Non-unique keys may cause children to be duplicated and/or omitted รขโฌโ the behavior is unsupported and could change in a future version.
An other problem with this workaround is that the next visible card is now the second card and not the next one.
this.swiper.jumpToCardIndex(currentIndex);
when closing the modal is also not working, nothing happens.
from react-native-deck-swiper.
I have the same problem, when open modal, cards resets to the first card
@DFelten you can work around this issue?
from react-native-deck-swiper.
I guess this issue should be reopened.
I looked into example project in the repo and it throws "Encountered two children with the same key" warning too.
from react-native-deck-swiper.
yeah I am getting the following error and it resets the card to first index:
Warning: flattenChildren(...): Encountered two children with the same key,
0
. Keys should be unique so that components maintain their identity across updates. Non-unique keys may cause children to be duplicated and/or omitted โ the behavior is unsupported and could change in a future version.
from react-native-deck-swiper.
When setting infinite={true}
you need to have at least stackSize
elements in your cards
, which works around the issue for me.
from react-native-deck-swiper.
Related Issues (20)
- View takes up the whole screen. HOT 2
- Only renders 1 card out of more
- Default Background color prevents a linear gradient background HOT 2
- Disable bottom swipe just for first card HOT 1
- reRender HOT 5
- put more than one key
- Unable to change View styling with containerStyle HOT 3
- Play Video HOT 1
- Typescript:react-native-deck-swiper undefined is not an object (evaluation'card.image')
- Issues when using a draggable object on a card HOT 1
- Can't adjust when overlay label will appear on Android HOT 2
- Card be under of components when swiping
- TypeError: undefined is not an object (evaluating '_this.dimensionsChangeSubscription.remove')
- ๐ Doesn't come back animatedly after dropping the card
- Changing the state of a component in the renderCard prop using the onTapCard prop. HOT 1
- Modal popup should render the same info that is being rendered onto the card HOT 1
- The swipe functionality does not work on the subsequent cards after swiping the first card. HOT 10
- swipeBack
- sorry. please delete this issue
- Double Tab?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-native-deck-swiper.