mirror of
https://github.com/zhigang1992/react-native-card-stack-swiper.git
synced 2026-04-29 20:56:55 +08:00
Fix overlapped cards on Android
This commit is contained in:
21
CardStack.js
21
CardStack.js
@@ -6,7 +6,8 @@ import {
|
|||||||
Animated,
|
Animated,
|
||||||
PanResponder,
|
PanResponder,
|
||||||
Dimensions,
|
Dimensions,
|
||||||
Text
|
Text,
|
||||||
|
Platform
|
||||||
} from 'react-native';
|
} from 'react-native';
|
||||||
|
|
||||||
const { height, width } = Dimensions.get('window');
|
const { height, width } = Dimensions.get('window');
|
||||||
@@ -345,7 +346,14 @@ export default class CardStack extends Component {
|
|||||||
<View {...this._panResponder.panHandlers} style={[{position:'relative'},this.props.style]}>
|
<View {...this._panResponder.panHandlers} style={[{position:'relative'},this.props.style]}>
|
||||||
<Animated.View style={{
|
<Animated.View style={{
|
||||||
position: 'absolute',
|
position: 'absolute',
|
||||||
zIndex: (topCard === 'cardB') ? 3 : 2,
|
...Platform.select({
|
||||||
|
ios: {
|
||||||
|
zIndex: (topCard === 'cardB') ? 3 : 2,
|
||||||
|
},
|
||||||
|
android: {
|
||||||
|
elevation: (topCard === 'cardB') ? 3 : 2,
|
||||||
|
}
|
||||||
|
}),
|
||||||
transform: [
|
transform: [
|
||||||
{ rotate: (topCard === 'cardB') ? rotate: '0deg' },
|
{ rotate: (topCard === 'cardB') ? rotate: '0deg' },
|
||||||
{translateX: (topCard === 'cardB') ? drag.x: 0},
|
{translateX: (topCard === 'cardB') ? drag.x: 0},
|
||||||
@@ -357,7 +365,14 @@ export default class CardStack extends Component {
|
|||||||
</Animated.View>
|
</Animated.View>
|
||||||
<Animated.View style={{
|
<Animated.View style={{
|
||||||
position: 'absolute',
|
position: 'absolute',
|
||||||
zIndex: (topCard === 'cardA') ? 3 : 2,
|
...Platform.select({
|
||||||
|
ios: {
|
||||||
|
zIndex: (topCard === 'cardA') ? 3 : 2,
|
||||||
|
},
|
||||||
|
android: {
|
||||||
|
elevation: (topCard === 'cardA') ? 3 : 2,
|
||||||
|
}
|
||||||
|
}),
|
||||||
transform: [
|
transform: [
|
||||||
{ rotate: (topCard === 'cardA') ? rotate: '0deg' },
|
{ rotate: (topCard === 'cardA') ? rotate: '0deg' },
|
||||||
{translateX: (topCard === 'cardA') ? drag.x: 0},
|
{translateX: (topCard === 'cardA') ? drag.x: 0},
|
||||||
|
|||||||
Reference in New Issue
Block a user