diff options
Diffstat (limited to 'app/screens/new-workout-screen.js')
| -rw-r--r-- | app/screens/new-workout-screen.js | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/app/screens/new-workout-screen.js b/app/screens/new-workout-screen.js index 5c87bfc..0958603 100644 --- a/app/screens/new-workout-screen.js +++ b/app/screens/new-workout-screen.js @@ -14,8 +14,7 @@ export default class NewWorkoutScreen extends Screen { componentDidMount() { super.componentDidMount(); - this.publish(events.FETCH_NEW_WORKOUT); - this.setState({ isLoading: true }); + this.onLoadWorkout() } render() { @@ -27,6 +26,7 @@ export default class NewWorkoutScreen extends Screen { </Container> ); } else { + console.log("loading new workout..."); return ( <Container> <Content> @@ -36,4 +36,16 @@ export default class NewWorkoutScreen extends Screen { ); } } + + onLoadWorkout() { + this.setState({ isLoading: true }); + this.publish({ event: events.FETCH_NEW_WORKOUT }); + } + + notify(event) { + switch(event.event) { + case events.FETCH_NEW_WORKOUT: + this.setState({ isLoading: false, ...event }); + } + } } |
