mirror of
https://github.com/Blair-SGA-Dev-Team/blazerapp.git
synced 2024-11-08 14:51:17 -05:00
Student of the week page finished
This commit is contained in:
parent
219a12d84c
commit
6463193deb
|
@ -6,6 +6,7 @@ import {
|
||||||
View,
|
View,
|
||||||
Text,
|
Text,
|
||||||
StatusBar,
|
StatusBar,
|
||||||
|
Image,
|
||||||
} from 'react-native';
|
} from 'react-native';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
@ -16,13 +17,46 @@ import {
|
||||||
ReloadInstructions,
|
ReloadInstructions,
|
||||||
} from 'react-native/Libraries/NewAppScreen';
|
} from 'react-native/Libraries/NewAppScreen';
|
||||||
|
|
||||||
|
import { url } from './resources/fetchInfo.json'
|
||||||
|
|
||||||
class StudentWeek extends React.Component {
|
class StudentWeek extends React.Component {
|
||||||
|
constructor(props) {
|
||||||
|
super(props)
|
||||||
|
this.state = {
|
||||||
|
isLoading: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
componentDidMount() {
|
||||||
|
fetch(`${url}/api/en/student`,{
|
||||||
|
headers: {
|
||||||
|
'Cache-Control': 'no-cache'
|
||||||
|
}}
|
||||||
|
).then((response) => {
|
||||||
|
return response.text();
|
||||||
|
}).then((json) => {
|
||||||
|
this.setState({data: JSON.parse(json),isLoading:false});
|
||||||
|
}).catch((error) => console.error(error))
|
||||||
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return (
|
console.log(this.state.data)
|
||||||
<View>
|
if (this.state.isLoading) {
|
||||||
|
return <View/>
|
||||||
</View>
|
} else {
|
||||||
)
|
return (
|
||||||
|
<View style={{paddingTop:'5%',paddingLeft:'10%',paddingRight:'10%'}}>
|
||||||
|
<Text style={{fontSize:32,marginBottom:'10%',textAlign:'center'}}>{this.state.data.name}</Text>
|
||||||
|
<Image style = {{height: '50%', width:'100%'}}source={this.state.data.icon} />
|
||||||
|
<View style = {{paddingTop:'5%'}}>
|
||||||
|
<Text style={{fontSize: 20}}>Grade {this.state.data.year}</Text>
|
||||||
|
<Text style={{fontSize: 20}}>{"\n"}Hobbies: {this.state.data.hobbies}</Text>
|
||||||
|
<Text style={{fontSize: 20}}>{"\n"}Achievements: {this.state.data.achievements}</Text>
|
||||||
|
</View>
|
||||||
|
|
||||||
|
</View>
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user