Нема описа

ProfileScreen.js 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. import React, { Component } from "react";
  2. import { Text, View, StyleSheet, Button } from "react-native";
  3. export default class ProfileScreen extends Component {
  4. prueba = async()=>{
  5. let response = await fetch('http://05cb04aa6bc5.ngrok.io/api/hello',{
  6. method: 'GET',
  7. headers: {
  8. Authorization: 'Token c33cc0e20cdf09a12d1e3e3de2515f3e9f2fd008'
  9. }
  10. })
  11. let responseJson = await response.json()
  12. console.log(responseJson)
  13. }
  14. render() {
  15. return (
  16. <View style={styles.container}>
  17. <Text> Profile Screen </Text>
  18. <Text style={{ fontSize: 20, fontWeight: "bold" }}>
  19. Welcome, {this.props.navigation.getParam("username")}
  20. </Text>
  21. <Button
  22. title="Sign out"
  23. onPress={() => this.props.navigation.navigate("Login")}
  24. />
  25. <Button
  26. title="Test"
  27. onPress={this.prueba}
  28. />
  29. <Button
  30. title="Add Taken Course"
  31. onPress= {() => this.props.navigation.navigate("AddTakenCourse")}
  32. />
  33. <Button
  34. title="Settings"
  35. onPress= {() => this.props.navigation.navigate("Settings")}
  36. />
  37. </View>
  38. );
  39. }
  40. }
  41. const styles = StyleSheet.create({
  42. container: {
  43. flex: 1,
  44. backgroundColor: "#fff",
  45. alignItems: "center",
  46. justifyContent: "center"
  47. }
  48. });