瀏覽代碼

Upload files to ''

juan.hernandez41 1 年之前
父節點
當前提交
4b05c10443
共有 2 個文件被更改,包括 86 次插入29 次删除
  1. 86
    29
      App.js
  2. 二進制
      census-logos.png

+ 86
- 29
App.js 查看文件

1
-import { StatusBar } from 'expo-status-bar';
2
-import React, {useState, useEffect} from 'react';
3
-import { View, Image, StyleSheet, Text, Button, ScrollView, Pressable} from 'react-native';
1
+import React, {useState, useEffect, Component} from 'react';
2
+import { View, Image, StyleSheet, Text, Button, ScrollView, Pressable, Linking} from 'react-native';
4
 import DropDownPicker from 'react-native-dropdown-picker';
3
 import DropDownPicker from 'react-native-dropdown-picker';
5
 import { parse } from 'json2csv';
4
 import { parse } from 'json2csv';
5
+import { Table, TableWrapper, Row, Rows, Col, Cols, Cell } from 'react-native-table-component';
6
 
6
 
7
 //import JSON;
7
 //import JSON;
8
 //import { Dataframe, readJSON } from "danfojs";
8
 //import { Dataframe, readJSON } from "danfojs";
94
 	  marginTop: 40,
94
 	  marginTop: 40,
95
 	  marginBottom: 30,
95
 	  marginBottom: 30,
96
 	  margin: 30,
96
 	  margin: 30,
97
-	  borderColor: "grey",
97
+	  borderColor: "white",
98
 	  borderRadius: 8,
98
 	  borderRadius: 8,
99
-	  padding: (30, 16),
99
+	  paddingVertical: 15,
100
+	  paddingHorizontal: 30,
100
 	  backgroundColor: "#008CBA",
101
 	  backgroundColor: "#008CBA",
101
 	  marginTop: 0
102
 	  marginTop: 0
102
   }, 
103
   }, 
103
   buttonContainer: {
104
   buttonContainer: {
104
     flexDirection: 'column',
105
     flexDirection: 'column',
105
     backgroundColor: 'black',
106
     backgroundColor: 'black',
106
-    alignItems: 'center',
107
+    // alignItems: 'center',
107
     justifyContent: 'center',
108
     justifyContent: 'center',
108
-	paddingTop:100,
109
-	marginTop: 20,
109
+	paddingTop:5,
110
+	marginTop: 30,
110
   },
111
   },
111
   container: {
112
   container: {
112
     flexDirection: 'column',
113
     flexDirection: 'column',
126
       color:"#beb2c8",
127
       color:"#beb2c8",
127
 	  fontSize: 30,
128
 	  fontSize: 30,
128
   },
129
   },
130
+  intro2: {
131
+	fontWeight: "bold",
132
+	color:"#beb2c8",
133
+	fontSize: 20,
134
+},
129
 
135
 
130
   sub: {
136
   sub: {
131
 	color:"#beb2c8",  
137
 	color:"#beb2c8",  
139
 	  fontWeight: "bold",
145
 	  fontWeight: "bold",
140
 	  fontSize: 30,
146
 	  fontSize: 30,
141
 	  paddingBottom:10,
147
 	  paddingBottom:10,
148
+	  alignItems: 'center',
142
   },
149
   },
143
   scrollView:{
150
   scrollView:{
144
 	  marginHorizontal: 20
151
 	  marginHorizontal: 20
172
 //data parsing goes here
179
 //data parsing goes here
173
 function getInfo(){
180
 function getInfo(){
174
 	//console.log(information[6])
181
 	//console.log(information[6])
175
-	return information
182
+	if(!information)
183
+	{Alert.alert("Please try again later! Error retriving data")}
184
+	else
185
+	{return information}
186
+
187
+	
176
 }
188
 }
177
 
189
 
178
 //data display
190
 //data display
348
 	
360
 	
349
 	</View>
361
 	</View>
350
   );
362
   );
363
+
364
+  
351
 }
365
 }
352
 
366
 
353
 
367
 
355
 //actual application
369
 //actual application
356
 
370
 
357
 class App extends React.Component {
371
 class App extends React.Component {
372
+	//Note: if prop-types could not be found within the project
373
+	//run on terminal "npm install --save proptypes"
374
+
375
+	// constructor(props) {
376
+	// 	super(props);
377
+	// 	this.setData = {
378
+	// 	  HeadTable: ['Head1', 'Head2', 'Head3', 'Head4', 'Head5'],
379
+	// 	  DataTable: [
380
+	// 		['1', '2', '3', '4', '5'],
381
+	// 		['a', 'b', 'c', 'd', 'e'],
382
+	// 		['1', '2', '3', '4', '5'],
383
+	// 		['a', 'b', 'c', 'd', 'e'],
384
+	// 		['1', '2', '3', '4', '5']
385
+	// 	  ]
386
+	// 	}
387
+	//   }
388
+	
358
 
389
 
359
-//the text at the end of a page gets cut off if anyone knows how to fix that?
360
-vars = {
390
+	//the text at the end of a page gets cut off if anyone knows how to fix that?
391
+	vars = {
361
 		welcome:
392
 		welcome:
362
-		  
363
-
364
-		<View style = {styles.containerbackground}>
365
-		<ScrollView style={styles.scrollView}>
393
+			<View style = {styles.containerbackground}>
394
+		
366
 		  	<View style = {styles.container}>
395
 		  	<View style = {styles.container}>
367
 		  
396
 		  
368
 		  
397
 		  
375
 					ultimas noticias relacionadas al censo y tambien verificar 
404
 					ultimas noticias relacionadas al censo y tambien verificar 
376
 					las tablas por municipio.</Text>
405
 					las tablas por municipio.</Text>
377
 		   </View>
406
 		   </View>
378
-		  </ScrollView>
379
-		</View>,
380
-		 
407
+		   <View style = {styles.container}>
408
+				<Text style={styles.intro2}>Contactenos:</Text>
409
+				<Text style={styles.sub}>Prof: Hernando Mattei Torres
410
+				<Button onPress={() => Linking.openURL('mailto:hernando.mattei@upr.edu') }
411
+      			title="e-mail" /></Text>
412
+				<Text style={styles.sub}>Angelica Rosario Santos
413
+				<Button onPress={() => Linking.openURL('mailto:angelica.rosario2@upr.edu') }
414
+      			title="e-mail" /></Text>
415
+				<Text style={styles.sub}>Data from:</Text>
416
+				<Image source={require('./census-logos.png')} />
417
+				<Button onPress={() => Linking.openURL('https://data.census.gov/profile?q=United+States&g=0100000US') }
418
+      			title="United States Census page" />
419
+		   </View>
420
+		  
421
+		</View>
422
+		
423
+		,
381
 		newsView:
424
 		newsView:
382
 		<View style = {styles.containerbackground}>
425
 		<View style = {styles.containerbackground}>
383
 		<ScrollView style={styles.scrollView}>
426
 		<ScrollView style={styles.scrollView}>
391
 			
434
 			
392
 			
435
 			
393
 		 </View>
436
 		 </View>
394
-		</ScrollView></View>,
437
+		</ScrollView>
438
+		</View>,
395
 		
439
 		
396
 		dataOp:
440
 		dataOp:
397
 		<View style = {styles.containerbackground}>
441
 		<View style = {styles.containerbackground}>
409
 			
453
 			
410
 			<Text style={styles.sub}>blehhhhhh bleh bleh bleh bleh bleh blehhhhhhhhhhhhhhhhh </Text>
454
 			<Text style={styles.sub}>blehhhhhh bleh bleh bleh bleh bleh blehhhhhhhhhhhhhhhhh </Text>
411
 			
455
 			
456
+			<View style={styles.container}>
457
+      		{/* <Table borderStyle={{borderWidth: 1, borderColor: '#ffa1d2'}}>
458
+        	<Row data={state.HeadTable} style={styles.HeadStyle} textStyle={styles.TableText}/>
459
+        	<Rows data={state.DataTable} textStyle={styles.TableText}/>
460
+      	</Table> */}
461
+    </View>
462
+
412
 		 </View>
463
 		 </View>
413
 		</ScrollView></View>
464
 		</ScrollView></View>
414
 		
465
 		
436
 	  <View>
487
 	  <View>
437
 		
488
 		
438
 			<View style = {styles.containerbackground}>
489
 			<View style = {styles.containerbackground}>
490
+				<ScrollView style={styles.scrollView}>
439
 				<View style = {styles.buttonContainer}>
491
 				<View style = {styles.buttonContainer}>
440
 					<Text style={styles.Navsub}> Demographic Data Viewer</Text>
492
 					<Text style={styles.Navsub}> Demographic Data Viewer</Text>
441
 						<Text style={styles.sub}> Navegador</Text>
493
 						<Text style={styles.sub}> Navegador</Text>
442
-							<View style = {styles.buttons}>
494
+							<Pressable style = {styles.buttons} onPress={this.setNews}>
443
 							
495
 							
444
 			 		 			<Button
496
 			 		 			<Button
445
-								onPress = {this.setNews}
446
-				 				title = "Noticias"
447
-				 				color = "rgba(255, 0, 0, 0)"
497
+								title = "Noticias"
498
+				 				color = "white"
448
 			  					/>
499
 			  					/>
449
 			  
500
 			  
450
-			  					<Button
451
-								 onPress = {this.setData}
452
-								 title = "Datos"
453
-								 color = "rgba(255, 0, 0, 0)"
501
+			  					
502
+							</Pressable>
503
+								
504
+							<Pressable style = {styles.buttons} onPress={this.setData}>
505
+							
506
+			 		 			<Button
507
+								title = "Datos"
508
+				 				color = "white"
454
 			  					/>
509
 			  					/>
455
-							</View>
456
-						
510
+			  
511
+			  					
512
+							</Pressable>
457
 						
513
 						
458
 		  				{this.state.current}
514
 		  				{this.state.current}
459
 					</View>
515
 					</View>
516
+					</ScrollView>
460
 			</View>
517
 			</View>
461
 		</View>
518
 		</View>
462
       );
519
       );

二進制
census-logos.png 查看文件