How to layout DeckSwiper with flex?
My goal:
Note the red box is a <View /> inside the same container as the <DeckSwiper />.

My code:
render() {
return (
<View style={{ flex: 1, backgroundColor: 'pink' }}>
<DeckSwiper
dataSource={this.props.cards}
renderItem={this.renderCard}
onSwipeRight={() => {}}
/>
<View style={{ backgroundColor: 'red', height: 80 }} />
</View>
);
}
What I get:
Q1. Note that the red box is on the top. Seems DeckSwiper has no height?
Q2. Is there any way to give DeckSwiper the style flex: 1 to make it fill the height? (So that the cards can fill the height with flex: 1 as well)

@lsps9150414 DeckSwiper, by default is absolute positioned, thus the View comes over it. You can position absolute your View and place it below DeckSwiper.
@shivrajkumar Thanks! Is there any way to override it and not break things? Or can I give it bottom : 0 and wraps it inside another flex view so that it stretch with the wrapper view?
@lsps9150414 I don't think it will make any difference. But you can surely try and let us know if that works for you
@shivrajkumar the problem is that I can't give <DeckSwiper /> any custom styles since style prop is not exposed, or is it?
@lsps9150414 You can just wrap your Deck inside a View, give it the style rules
Closing due to inactivity
Any suggestion on how to use deckSwipper with flex ?
@shivrajkumar I am not able to set the height of the parent view (green border view equal to black border view)
<View style={styles.wrapper1} >
<DeckSwiper
looping = {false}
dataSource={this.getStack()}
renderItem={item =>
<View style={styles.wrapper}>
</View>
}
onSwipeRight={() => this.updateDeckSize()}
onSwipeLeft={() => this.updateDeckSize()}
/>
</View>
both wrapper & wrapper1 are
position: 'absolute',
left: 0,
top: 0,
right:0,
bottom:0
Any idea ?
Thanks for the help
@lsps9150414, @akhil-geekyants - This is an issue for me as well, I can't center the DeckSwiper in a flexed Content view using justifyContent: 'center'
How can we center this component in a flexed component?
Hi @lsps9150414 , @kodayashi , DeckSwiper doesn't work with flex. You can align it with the below style. Closing this for now.
<View style={{position: 'relative', top: 100}}>
<DeckSwiper ... />
</View>