Skip to content

Commit

Permalink
fix play screen animation state bug
Browse files Browse the repository at this point in the history
  • Loading branch information
moonou committed Apr 13, 2018
1 parent 844fa68 commit 8b9884c
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions src/views/Play.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,14 +97,22 @@ class Play extends Component {
}
onNavigatorEvent (event) {
if (event.id === 'didAppear') {
const { music } = this.props
if (music.playerState === TrackPlayerType.STATE_PLAYING) {
this.startRotate()
} else {
this.stopRotate()
}
this.updateUI()
}
}
// update animation state
updateUI () {
const { music } = this.props
if (music.playerState === TrackPlayerType.STATE_PLAYING) {
this.startRotate()
} else {
this.stopRotate()
}
}

componentDidUpdate (prevProps) {
this.updateUI()
}
render () {
const { music } = this.props
const currentMusic = music.list.find(item => item.id === music.trackId)
Expand Down

0 comments on commit 8b9884c

Please sign in to comment.