import React from 'react';
import {
SafeAreaView,
StyleSheet,
ScrollView,
View,
Text,
StatusBar,
Image,
} from 'react-native';
import {
Header,
LearnMoreLinks,
Colors,
DebugInstructions,
ReloadInstructions,
} from 'react-native/Libraries/NewAppScreen';
//import I18n from './i18n';
import { url } from './resources/fetchInfo.json'
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() {
if (this.state.isLoading) {
return
} else {
const iconURI = this.state.data.icon !== undefined?`data:image/png;charset=utf-8;base64,${this.state.data.icon}`:'';
return (
{this.state.data.name}
{'\t'}Grade: {this.state.data.year}
{"\n"}Hobbies:
{'\t'}{this.state.data.hobbies}
{"\n"}Achievements:
{'\t'}{this.state.data.achievements}
{"\n"}Messages:
{'\t'}{this.state.data.messages}
)
}
}
}
export default StudentWeek;