From 62a23e0cdf913f941571069f87bf26645a5d1b99 Mon Sep 17 00:00:00 2001 From: DigohD Date: Thu, 24 Aug 2017 15:38:58 +0200 Subject: [PATCH] Huawei, Android 7 fix + Wrapped in Animated View Fix --- lib/FlipCard.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/FlipCard.js b/lib/FlipCard.js index 40eb503..19400f3 100644 --- a/lib/FlipCard.js +++ b/lib/FlipCard.js @@ -50,7 +50,7 @@ export default class FlipCard extends Component { { toValue: Number(isFlipped), friction: this.props.friction, - useNativeDriver: true + useNativeDriver: this.props.useNativeDriver } ).start((param) => { this.setState({isFlipping: false}) @@ -105,6 +105,7 @@ export default class FlipCard extends Component { style={[ this.state.height > 0 && {height: this.state.height}, this.state.width > 0 && {width: this.state.width}]} flipHorizontal={this.props.flipHorizontal} flipVertical={this.props.flipVertical} + perspective={this.props.perspective} onLayout={(event) => { var {x, y, width, height} = event.nativeEvent.layout var _update = Object.assign(this.state.back, {width: width, height: height}) @@ -204,6 +205,7 @@ FlipCard.propTypes = { onFlipStart: PropTypes.func, alignHeight: PropTypes.bool, alignWidth: PropTypes.bool, + useNativeDriver: PropTypes.bool, children (props, propName, componentName) { const prop = props[propName] if (React.Children.count(prop) !== 2) { @@ -228,6 +230,7 @@ FlipCard.defaultProps = { onFlipStart: () => {}, alignHeight: false, alignWidth: false, + useNativeDriver: true, } @@ -254,9 +257,11 @@ export class Back extends Component { var transform = [] if (this.props.flipHorizontal) { transform.push({scaleX: -1}) + transform.push({perspective: this.props.perspective}) } if (this.props.flipVertical) { transform.push({scaleY: -1}) + transform.push({perspective: this.props.perspective}) } return ( @@ -275,12 +280,14 @@ export class Back extends Component { Back.defaultProps = { flipHorizontal: false, - flipVertical: true + flipVertical: true, + perspective: 1000, } Back.propTypes = { flipHorizontal: PropTypes.bool, flipVertical: PropTypes.bool, + perspective: PropTypes.number, children (props, propName, componentName) { } }