Skip to content

Instantly share code, notes, and snippets.

@FabricioFFC
Created July 2, 2018 00:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save FabricioFFC/dce8f4149c3beab3039bfe4aa240bd5a to your computer and use it in GitHub Desktop.
Save FabricioFFC/dce8f4149c3beab3039bfe4aa240bd5a to your computer and use it in GitHub Desktop.
import React, { Component } from 'react';
import { View, ActivityIndicator } from 'react-native';
import TeamDetails from './../components/TeamDetails';
import teamsApi from '../api/TeamsApi';
class TeamDetailsScreen extends Component {
constructor(props) {
super(props);
this.state = {
loading: true,
};
this.routeParams = props.navigation.state.params; // eslint-disable-line react/prop-types
}
async componentWillMount() {
const team = await teamsApi.get(this.routeParams.teamCode);
this.setState({ team, loading: false });
}
render() {
if (this.state.loading) {
return (
<View style={{ flex: 1, padding: 20 }}>
<ActivityIndicator size="large" color="#0000ff" />
</View>
);
}
return (
<TeamDetails team={this.state.team} />
);
}
}
export default TeamDetailsScreen;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment