No Description

App.js 3.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. import React, {useState, useEffect} from 'react';
  2. import { View, Image, Text, Button, ScrollView, Pressable, Linking,StyleSheet} from 'react-native';
  3. import {Picker, DataButton} from "./Datos"
  4. import Noticias from './Noticias';
  5. import { styles } from './styles';
  6. //actual application
  7. class App extends React.Component {
  8. //the text at the end of a page gets cut off if anyone knows how to fix that?
  9. vars = {
  10. welcome:
  11. <View style = {styles.containerbackground}>
  12. <ScrollView style={styles.scrollView}>
  13. <View style = {styles.container}>
  14. <Text style={styles.intro}>Bienvenido!</Text>
  15. </View>
  16. <View style = {styles.container}>
  17. <Text style={styles.sub}>Aquí podra mantenerse al tanto con las
  18. últimas noticias relacionadas al Censo y tener acceso a los
  19. los Demographic Data Profiles de cada municipio de
  20. Puerto Rico.
  21. </Text>
  22. </View>
  23. <View style = {styles.bottom}>
  24. <Text style={styles.intro2}>Contactenos:</Text>
  25. <Text style={styles.sub}>Prof: Hernando Mattei Torres
  26. <Button onPress={() => Linking.openURL('mailto:hernando.mattei@upr.edu') }
  27. title="e-mail" /></Text>
  28. <Text style={styles.sub}>Angelica Rosario Santos
  29. <Button onPress={() => Linking.openURL('mailto:angelica.rosario2@upr.edu') }
  30. title="e-mail" /></Text>
  31. <Text style={styles.sub}>Data from:</Text>
  32. <Image source={require('./census-logos.png')} />
  33. <Button onPress={() => Linking.openURL('https://data.census.gov/profile?q=United+States&g=0100000US') }
  34. title="United States Census page" />
  35. </View>
  36. </ScrollView>
  37. </View>,
  38. newsView:
  39. <View style = {styles.containerbackground}>
  40. <ScrollView style={styles.scrollView}>
  41. <View style = {styles.container}>
  42. <Text style={styles.intro}>Noticias</Text>
  43. <Image source={require('./Logo.jpeg')} />
  44. </View>
  45. </ScrollView>
  46. <Noticias />
  47. </View>,
  48. dataOp:
  49. <View style = {styles.containerbackground}>
  50. <ScrollView nestedScrollEnabled = {true} style={styles.scrollView}>
  51. <View style = {styles.container}>
  52. <Text style={styles.intro}>DATA VIEWING PROJECT</Text>
  53. </View>
  54. <Picker />
  55. <DataButton />
  56. </ScrollView>
  57. </View>
  58. }
  59. //current state
  60. state = {current: this.vars.welcome}
  61. //state changing functions
  62. setHome = () => this.setState({ current: this.vars.welcome })
  63. setData = () => this.setState({current: this.vars.dataOp})
  64. setNews = () => this.setState({ current: this.vars.newsView })
  65. //render app
  66. render() {
  67. return (
  68. <View>
  69. <View style = {styles.containerbackground}>
  70. <View style = {styles.buttonContainer}>
  71. <Text style={styles.Navsub}> Demographic Data Viewer</Text>
  72. <View style = {styles.navContainer}>
  73. <Pressable style={styles.buttons} onPress = {this.setNews}>
  74. <Text style={styles.text}> Noticias</Text>
  75. </Pressable>
  76. <Pressable style={styles.buttons} onPress = {this.setHome}>
  77. <Text style={styles.text}> Hogar</Text>
  78. </Pressable>
  79. <Pressable style={styles.buttons} onPress = {this.setData}>
  80. <Text style={styles.text}> Datos</Text>
  81. </Pressable>
  82. </View>
  83. {this.state.current}
  84. </View>
  85. </View>
  86. </View>
  87. );
  88. }
  89. }
  90. export default App