Skip to content

Commit

Permalink
Merge pull request moschan#44 from DigohD/master
Browse files Browse the repository at this point in the history
Huawei, Android 7  fix + Wrapped in Animated View Fix
  • Loading branch information
moschan authored Sep 2, 2017
2 parents 00eb3bf + 62a23e0 commit 2cb7cd3
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions lib/FlipCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -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})
Expand Down Expand Up @@ -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})
Expand Down Expand Up @@ -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) {
Expand All @@ -228,6 +230,7 @@ FlipCard.defaultProps = {
onFlipStart: () => {},
alignHeight: false,
alignWidth: false,
useNativeDriver: true,
}


Expand All @@ -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 (
Expand All @@ -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) {
}
}

0 comments on commit 2cb7cd3

Please sign in to comment.