juan.hernandez41 преди 2 години
родител
ревизия
4b05c10443
променени са 2 файла, в които са добавени 86 реда и са изтрити 29 реда
  1. 86
    29
      App.js
  2. Двоични данни
      census-logos.png

+ 86
- 29
App.js Целия файл

@@ -1,8 +1,8 @@
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 3
 import DropDownPicker from 'react-native-dropdown-picker';
5 4
 import { parse } from 'json2csv';
5
+import { Table, TableWrapper, Row, Rows, Col, Cols, Cell } from 'react-native-table-component';
6 6
 
7 7
 //import JSON;
8 8
 //import { Dataframe, readJSON } from "danfojs";
@@ -94,19 +94,20 @@ const styles = StyleSheet.create({
94 94
 	  marginTop: 40,
95 95
 	  marginBottom: 30,
96 96
 	  margin: 30,
97
-	  borderColor: "grey",
97
+	  borderColor: "white",
98 98
 	  borderRadius: 8,
99
-	  padding: (30, 16),
99
+	  paddingVertical: 15,
100
+	  paddingHorizontal: 30,
100 101
 	  backgroundColor: "#008CBA",
101 102
 	  marginTop: 0
102 103
   }, 
103 104
   buttonContainer: {
104 105
     flexDirection: 'column',
105 106
     backgroundColor: 'black',
106
-    alignItems: 'center',
107
+    // alignItems: 'center',
107 108
     justifyContent: 'center',
108
-	paddingTop:100,
109
-	marginTop: 20,
109
+	paddingTop:5,
110
+	marginTop: 30,
110 111
   },
111 112
   container: {
112 113
     flexDirection: 'column',
@@ -126,6 +127,11 @@ const styles = StyleSheet.create({
126 127
       color:"#beb2c8",
127 128
 	  fontSize: 30,
128 129
   },
130
+  intro2: {
131
+	fontWeight: "bold",
132
+	color:"#beb2c8",
133
+	fontSize: 20,
134
+},
129 135
 
130 136
   sub: {
131 137
 	color:"#beb2c8",  
@@ -139,6 +145,7 @@ const styles = StyleSheet.create({
139 145
 	  fontWeight: "bold",
140 146
 	  fontSize: 30,
141 147
 	  paddingBottom:10,
148
+	  alignItems: 'center',
142 149
   },
143 150
   scrollView:{
144 151
 	  marginHorizontal: 20
@@ -172,7 +179,12 @@ const handlePress = () => false
172 179
 //data parsing goes here
173 180
 function getInfo(){
174 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 190
 //data display
@@ -348,6 +360,8 @@ function Picker() {
348 360
 	
349 361
 	</View>
350 362
   );
363
+
364
+  
351 365
 }
352 366
 
353 367
 
@@ -355,14 +369,29 @@ function Picker() {
355 369
 //actual application
356 370
 
357 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 392
 		welcome:
362
-		  
363
-
364
-		<View style = {styles.containerbackground}>
365
-		<ScrollView style={styles.scrollView}>
393
+			<View style = {styles.containerbackground}>
394
+		
366 395
 		  	<View style = {styles.container}>
367 396
 		  
368 397
 		  
@@ -375,9 +404,23 @@ vars = {
375 404
 					ultimas noticias relacionadas al censo y tambien verificar 
376 405
 					las tablas por municipio.</Text>
377 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 424
 		newsView:
382 425
 		<View style = {styles.containerbackground}>
383 426
 		<ScrollView style={styles.scrollView}>
@@ -391,7 +434,8 @@ vars = {
391 434
 			
392 435
 			
393 436
 		 </View>
394
-		</ScrollView></View>,
437
+		</ScrollView>
438
+		</View>,
395 439
 		
396 440
 		dataOp:
397 441
 		<View style = {styles.containerbackground}>
@@ -409,6 +453,13 @@ vars = {
409 453
 			
410 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 463
 		 </View>
413 464
 		</ScrollView></View>
414 465
 		
@@ -436,27 +487,33 @@ setNews = () => this.setState({ current: this.vars.newsView })
436 487
 	  <View>
437 488
 		
438 489
 			<View style = {styles.containerbackground}>
490
+				<ScrollView style={styles.scrollView}>
439 491
 				<View style = {styles.buttonContainer}>
440 492
 					<Text style={styles.Navsub}> Demographic Data Viewer</Text>
441 493
 						<Text style={styles.sub}> Navegador</Text>
442
-							<View style = {styles.buttons}>
494
+							<Pressable style = {styles.buttons} onPress={this.setNews}>
443 495
 							
444 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 514
 		  				{this.state.current}
459 515
 					</View>
516
+					</ScrollView>
460 517
 			</View>
461 518
 		</View>
462 519
       );

Двоични данни
census-logos.png Целия файл