andrea.nieves7 2 years ago
parent
commit
24df7cb33c
1 changed files with 49 additions and 26 deletions
  1. 49
    26
      App.js

+ 49
- 26
App.js View File

4
 import data from './transfer.json' 
4
 import data from './transfer.json' 
5
 
5
 
6
 
6
 
7
+//where data will be put
8
+var organizedData
7
 
9
 
8
-var information = ""
10
+//where data will be stored
11
+var information = "default text"
9
 
12
 
13
+//organize data make it pretty
14
+function organize(){
15
+	
16
+	
17
+	
18
+	
19
+}
20
+
21
+
22
+//calls data query
10
 function loadDoc() {
23
 function loadDoc() {
11
   var xhttp = new XMLHttpRequest();
24
   var xhttp = new XMLHttpRequest();
12
   xhttp.onreadystatechange = function() {
25
   xhttp.onreadystatechange = function() {
13
     if (this.readyState == 4 && this.status == 200) {
26
     if (this.readyState == 4 && this.status == 200) {
14
          information = this.responseText;
27
          information = this.responseText;
28
+		 organize()
15
   }
29
   }
16
   };
30
   };
17
   xhttp.open("GET", "https://api.census.gov/data/2020/acs/acs5/profile?get=group(DP02PR)&for=county:127&in=state:72", true);
31
   xhttp.open("GET", "https://api.census.gov/data/2020/acs/acs5/profile?get=group(DP02PR)&for=county:127&in=state:72", true);
19
   
33
   
20
 }
34
 }
21
 
35
 
36
+loadDoc()
37
+
38
+
39
+
40
+
41
+
22
 //change this to an external css file later
42
 //change this to an external css file later
23
 const styles = StyleSheet.create({
43
 const styles = StyleSheet.create({
24
 	
44
 	
25
   buttons: {
45
   buttons: {
26
 	  flexDirection: 'row',
46
 	  flexDirection: 'row',
27
 	  justifyContent: 'center',
47
 	  justifyContent: 'center',
28
-	  marginTop: 30,
48
+	  marginTop: 40,
29
 	  marginBottom: 30,
49
 	  marginBottom: 30,
30
-	  margin: 4,
50
+	  margin: 30,
31
 	  borderColor: "grey",
51
 	  borderColor: "grey",
32
-  },
52
+  }, 
33
   container: {
53
   container: {
34
     flexDirection: 'column',
54
     flexDirection: 'column',
35
 	justifyContent: 'center',
55
 	justifyContent: 'center',
37
     alignItems: 'center',
57
     alignItems: 'center',
38
     justifyContent: 'center',
58
     justifyContent: 'center',
39
 	marginTop: 20,
59
 	marginTop: 20,
40
-	marginBottom: 500
41
   },
60
   },
42
   containerbackground:{
61
   containerbackground:{
43
 	
62
 	
44
     backgroundColor: '#063970',
63
     backgroundColor: '#063970',
45
-	padding: 40
64
+	marginTop: 20
46
   },
65
   },
47
   intro: {
66
   intro: {
48
 	  fontWeight: "bold",
67
 	  fontWeight: "bold",
51
 	 
70
 	 
52
   },
71
   },
53
   sub: {
72
   sub: {
54
-      color:"#D7D6D6",
55
-	  
56
-	  fontSize: 20,
73
+      color:"#D7D6D6",  
74
+	  fontSize: 20
57
   },
75
   },
58
   scrollView:{
76
   scrollView:{
59
 	  marginHorizontal: 20
77
 	  marginHorizontal: 20
80
 		  
98
 		  
81
 
99
 
82
 		<View style = {styles.containerbackground}>
100
 		<View style = {styles.containerbackground}>
101
+		<ScrollView style={styles.scrollView}>
83
 		  <View style = {styles.container}>
102
 		  <View style = {styles.container}>
84
 		  
103
 		  
85
 		  
104
 		  
90
 			 
109
 			 
91
 			<Image source={require('./testimg.gif')} />
110
 			<Image source={require('./testimg.gif')} />
92
 			
111
 			
93
-		  </View>
112
+		  </View> 
113
+		  </ScrollView>
94
 		</View>,
114
 		</View>,
95
-		  
96
-		dataView:
97
-		
115
+		 
116
+		newsView:
98
 		<View style = {styles.containerbackground}>
117
 		<View style = {styles.containerbackground}>
99
 		<ScrollView style={styles.scrollView}>
118
 		<ScrollView style={styles.scrollView}>
100
 		 <View style = {styles.container}>
119
 		 <View style = {styles.container}>
101
 		  
120
 		  
102
 		  
121
 		  
103
-			<Text style={styles.intro}>DATADATADATADATADATA</Text>
104
-		
105
-			<Text style={styles.sub}>{information}</Text>
122
+			<Text style={styles.intro}>Noticias</Text>
106
 			 
123
 			 
107
 			<Image source={require('./testimg.gif')} />
124
 			<Image source={require('./testimg.gif')} />
108
 			
125
 			
109
 		 </View>
126
 		 </View>
110
-		</ScrollView></View>,
127
+		</ScrollView></View>
111
 
128
 
129
+		
130
+	}
112
 
131
 
113
-		newsView:
114
-		<View style = {styles.containerbackground}>
132
+function dataView(){	
133
+	return (
134
+	<View style = {styles.containerbackground}>
115
 		<ScrollView style={styles.scrollView}>
135
 		<ScrollView style={styles.scrollView}>
116
 		 <View style = {styles.container}>
136
 		 <View style = {styles.container}>
117
 		  
137
 		  
118
 		  
138
 		  
119
-			<Text style={styles.intro}>Noticias</Text>
139
+			<Text style={styles.intro}>DATADATADATADATADATA</Text>
140
+		
141
+			<Text style={styles.sub}>{information}</Text>
120
 			 
142
 			 
121
 			<Image source={require('./testimg.gif')} />
143
 			<Image source={require('./testimg.gif')} />
122
 			
144
 			
123
 		 </View>
145
 		 </View>
124
 		</ScrollView></View>
146
 		</ScrollView></View>
125
-
126
-		
127
-	}
128
-
129
-
147
+	)
148
+}
130
 
149
 
131
 
150
 
132
 class App extends React.Component {
151
 class App extends React.Component {
136
 
155
 
137
 //state changing functions
156
 //state changing functions
138
 setHome = () => this.setState({ current: states.welcome })
157
 setHome = () => this.setState({ current: states.welcome })
139
-setData = () => {loadDoc(); this.setState({ current: states.dataView })}
158
+
159
+
160
+setData = () => this.setState({current: dataView()})
161
+
162
+
140
 setNews = () => this.setState({ current: states.newsView })
163
 setNews = () => this.setState({ current: states.newsView })
141
 	
164
 	
142
 	
165