Skip to content
This repository was archived by the owner on Aug 8, 2019. It is now read-only.

Commit 47d629f

Browse files
authored
Merge pull request yujonglee#9 from rollsroyc3/master
Fixed onPress running animation
2 parents a4f60cc + 207d2e3 commit 47d629f

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

index.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,20 @@ class Item extends Component {
5555
rightContainerStyle: PropTypes.any,
5656
leftContainerStyle: PropTypes.any
5757
};
58+
59+
componentWillReceiveProps(newProps){
60+
if(newProps.switchOn != this.props.switchOn){
61+
this.runAnimation();
62+
}
63+
};
64+
5865
onPress = () => {
59-
this.runAnimation();
6066
this.props.onPress();
6167
};
6268

6369
getStart = () => {
6470
return this.props.type === undefined ? 0 : this.props.type === 0 ? 0 : this.props.containerStyle.padding * 2;
65-
}
71+
};
6672

6773
runAnimation = () => {
6874
// this.state.anim.setValue(0);

0 commit comments

Comments
 (0)