Skip to content

Commit

Permalink
Fix broken render on Android in API <= 0.58 (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
VincentCATILLON authored Apr 5, 2019
1 parent f42a694 commit dfe3895
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,13 @@ class Explosion extends React.PureComponent<Props, State> {

componentDidMount = () => {
this.calculateItems();
setTimeout(() => {
this.animate()
}, 1000);
};

calculateItems = () => {
const { count } = this.props;
const items: Array<Item> = [];

Array.from(Array(count).keys()).forEach(() => {
Array(count).fill().map(() => {
const item: Item = {
leftDelta: randomValue(0, 1),
topDelta: randomValue(TOP_MIN, 1),
Expand All @@ -81,7 +78,7 @@ class Explosion extends React.PureComponent<Props, State> {

this.setState({
items
});
}, () => this.animate());
};

animate = () => {
Expand Down Expand Up @@ -132,13 +129,11 @@ class Explosion extends React.PureComponent<Props, State> {
const translateX = this.animation.interpolate({
inputRange: [0, 0.4, 1.2, 2],
outputRange: [0, -(item.swingDelta * 30), (item.swingDelta * 30), 0]
})

});
const opacity = this.animation.interpolate({
inputRange: [0, 1, 1.8, 2],
outputRange: [1, 1, 1, fadeOut ? 0 : 1]
});

const transform = [{rotateX}, {rotateY}, {rotateZ}, {translateX}];

return (
Expand Down

0 comments on commit dfe3895

Please sign in to comment.