Fix hike transition bug

This commit is contained in:
Berkeley Martinez
2016-01-06 15:39:41 -08:00
parent 622974ca2a
commit 1a858fe53c
3 changed files with 27 additions and 7 deletions

View File

@ -48,6 +48,7 @@ export default Store({
toggleQuestions,
fetchHikes,
hideInfo,
resetHike,
grabQuestion,
releaseQuestion,
moveQuestion,
@ -59,6 +60,7 @@ export default Store({
toggleQuestions,
fetchHikes,
hideInfo,
resetHike,
grabQuestion,
releaseQuestion,
moveQuestion,

View File

@ -23,12 +23,13 @@ export default contain(
showQuestions: PropTypes.bool
},
componentWillReceiveProps({ params: { dashedName }, showQuestions }) {
if (
showQuestions &&
this.props.params.dashedName !== dashedName
) {
this.props.hikesActions.toggleQuestions();
componentWillUnmount() {
this.props.hikesActions.resetHike();
},
componentWillReceiveProps({ params: { dashedName } }) {
if (this.props.params.dashedName !== dashedName) {
this.props.hikesActions.resetHike();
}
},

View File

@ -175,7 +175,8 @@ export default Actions({
transform(state) {
const hikesApp = {
...state.hikesApp,
mouse: [0, 0]
mouse: [0, 0],
showInfo: false
};
return { ...state, hikesApp };
}
@ -250,5 +251,21 @@ export default Actions({
.catch(err => Observable.just({
transform(state) { return { ...state, err }; }
}));
},
resetHike() {
return {
transform(state) {
return { ...state,
hikesApp: {
...state.hikesApp,
currentQuestion: 1,
showQuestions: false,
showInfo: false,
mouse: [0, 0],
delta: [0, 0]
}
};
}
};
}
});