Skip to content

Instantly share code, notes, and snippets.

@ahartzog
Created April 30, 2019 12:27
Show Gist options
  • Save ahartzog/63b10f5b7ecaccafdbbfdbf7fecf3233 to your computer and use it in GitHub Desktop.
Save ahartzog/63b10f5b7ecaccafdbbfdbf7fecf3233 to your computer and use it in GitHub Desktop.
SlowComp
//Inside componentDidMount
setTimeout(() => {
const slowComp = (
<WorkoutEntryEditWrapper
navigation={this.props.navigation}
withFetchWorkoutsData={this.props.workoutLogsList}
/>
);
this.setState({ loading: false, slowComp });
}, 0);
//Render
render() {
const workout = this.props.navigation.getParam('workout', null);
if (this.state.loading) {
const title = workout && workout.name ? workout.name : ' ';
return <LoadingScreen title={title} />;
}
return this.state.slowComp;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment