Carla Ramos 1 rok temu
rodzic
commit
6aa5790ff7
5 zmienionych plików z 90 dodań i 50 usunięć
  1. 73
    25
      App.js
  2. BIN
      census-logos.png
  3. 11
    0
      package-lock.json
  4. 1
    0
      package.json
  5. 5
    25
      yarn.lock

+ 73
- 25
App.js Wyświetl plik

@@ -1,6 +1,5 @@
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 { Alert } from 'react-native';
6 5
 
@@ -99,7 +98,8 @@ function fetchData() {
99 98
 	var query = queryBase + "(" + table + ")&for=county:" + pueblo + queryEnd 
100 99
 	
101 100
 	if(pueblo && table)
102
-	{loadDoc(query)}
101
+	{loadDoc(query);
102
+	if(information == ""){Alert.alert("No data response found.")}}
103 103
 	else
104 104
 	{Alert.alert("Please fill every parameter before calling!")}
105 105
 	
@@ -114,7 +114,7 @@ const styles = StyleSheet.create({
114 114
 	  marginTop: 40,
115 115
 	  marginBottom: 30,
116 116
 	  margin: 30,
117
-	  borderColor: "grey",
117
+	  borderColor: "white",
118 118
 	  borderRadius: 8,
119 119
 	  padding: (30, 16),
120 120
 	  backgroundColor: "black",
@@ -122,11 +122,11 @@ const styles = StyleSheet.create({
122 122
   }, 
123 123
   buttonContainer: {
124 124
     flexDirection: 'column',
125
-    backgroundColor: '#f0f8ff',
125
+    backgroundColor: 'black',
126 126
     alignItems: 'center',
127 127
     justifyContent: 'center',
128
-	paddingTop:100,
129
-	marginTop: 20,
128
+	paddingTop:5,
129
+	marginTop: 30,
130 130
   },
131 131
   container: {
132 132
     flexDirection: 'column',
@@ -146,6 +146,11 @@ const styles = StyleSheet.create({
146 146
       color:"#black",
147 147
 	  fontSize: 30,
148 148
   },
149
+  intro2: {
150
+	fontWeight: "bold",
151
+	color:"#beb2c8",
152
+	fontSize: 20,
153
+},
149 154
 
150 155
   sub: {
151 156
 	color:"#black",  
@@ -159,6 +164,7 @@ const styles = StyleSheet.create({
159 164
 	  fontWeight: "bold",
160 165
 	  fontSize: 30,
161 166
 	  paddingBottom:10,
167
+	  alignItems: 'center',
162 168
   },
163 169
   scrollView:{
164 170
 	  marginHorizontal: 20
@@ -193,7 +199,12 @@ const handlePress = () => false
193 199
 //data parsing goes here
194 200
 function getInfo(){
195 201
 	//console.log(information[6])
196
-	return information
202
+	if(!information)
203
+	{Alert.alert("Please try again later! Error retriving data")}
204
+	else
205
+	{return information}
206
+
207
+	
197 208
 }
198 209
 
199 210
 //data display
@@ -363,6 +374,8 @@ function Picker() {
363 374
 	
364 375
 	</View>
365 376
   );
377
+
378
+  
366 379
 }
367 380
 
368 381
 
@@ -370,21 +383,39 @@ function Picker() {
370 383
 //actual application
371 384
 
372 385
 class App extends React.Component {
386
+	//Note: if prop-types could not be found within the project
387
+	//run on terminal "npm install --save proptypes"
388
+
389
+	// constructor(props) {
390
+	// 	super(props);
391
+	// 	this.setData = {
392
+	// 	  HeadTable: ['Head1', 'Head2', 'Head3', 'Head4', 'Head5'],
393
+	// 	  DataTable: [
394
+	// 		['1', '2', '3', '4', '5'],
395
+	// 		['a', 'b', 'c', 'd', 'e'],
396
+	// 		['1', '2', '3', '4', '5'],
397
+	// 		['a', 'b', 'c', 'd', 'e'],
398
+	// 		['1', '2', '3', '4', '5']
399
+	// 	  ]
400
+	// 	}
401
+	//   }
402
+	
373 403
 
374
-//the text at the end of a page gets cut off if anyone knows how to fix that?
375
-vars = {
404
+	//the text at the end of a page gets cut off if anyone knows how to fix that?
405
+	vars = {
376 406
 		welcome:
377 407
 
378 408
 		<View style = {styles.containerbackground}>
379 409
 		<ScrollView style={styles.scrollView}>
410
+			<View style = {styles.containerbackground}>
411
+		
380 412
 		  	<View style = {styles.container}>
381 413
 				<Text style={styles.intro}>Bienvenido!</Text>
382 414
 			</View>
383 415
 			<View style = {styles.container}>
384
-				<Text style={styles.sub}>Aquí podra mantenerse al tanto con las 
385
-					últimas noticias relacionadas al Censo y tener acceso a los  
386
-					los Demographic Data Profiles de cada municipio de
387
-					Puerto Rico.</Text>
416
+				<Text style={styles.sub}>Aqui podra mantenerse al tanto con las 
417
+					ultimas noticias relacionadas al censo y tambien verificar 
418
+					las tablas por municipio.</Text>
388 419
 		   </View>
389 420
 		  </ScrollView>
390 421
 		</View>,
@@ -399,7 +430,8 @@ vars = {
399 430
 			<Image source={require('./Logo.jpeg')} />
400 431
 			
401 432
 		 </View>
402
-		</ScrollView></View>,
433
+		</ScrollView>
434
+		</View>,
403 435
 		
404 436
 		dataOp:
405 437
 		<View style = {styles.containerbackground}>
@@ -415,6 +447,13 @@ vars = {
415 447
 			
416 448
 			<Text style={styles.sub}>blehhhhhh bleh bleh bleh bleh bleh blehhhhhhhhhhhhhhhhh </Text>
417 449
 			
450
+			<View style={styles.container}>
451
+      		{/* <Table borderStyle={{borderWidth: 1, borderColor: '#ffa1d2'}}>
452
+        	<Row data={state.HeadTable} style={styles.HeadStyle} textStyle={styles.TableText}/>
453
+        	<Rows data={state.DataTable} textStyle={styles.TableText}/>
454
+      	</Table> */}
455
+    </View>
456
+
418 457
 		 </View>
419 458
 		</ScrollView></View>
420 459
 		
@@ -442,24 +481,33 @@ setNews = () => this.setState({ current: this.vars.newsView })
442 481
 	  <View>
443 482
 		
444 483
 			<View style = {styles.containerbackground}>
484
+				<ScrollView style={styles.scrollView}>
445 485
 				<View style = {styles.buttonContainer}>
446 486
 					<Text style={styles.Navsub}> Demographic Data Viewer</Text>
447
-							<View style = {styles.buttons}>
487
+						<Text style={styles.sub}> Navegador</Text>
488
+							<Pressable style = {styles.buttons} onPress={this.setNews}>
489
+							
448 490
 			 		 			<Button
449
-								onPress = {this.setNews}
450
-				 				title = "Noticias"
491
+								title = "Noticias"
451 492
 				 				color = "white"
452 493
 			  					/>
453
-			  					<Button
454
-								 onPress = {this.setData}
455
-								 title = "Datos"
456
-								 color = "white"
494
+			  
495
+			  					
496
+							</Pressable>
497
+								
498
+							<Pressable style = {styles.buttons} onPress={this.setData}>
499
+							
500
+			 		 			<Button
501
+								title = "Datos"
502
+				 				color = "white"
457 503
 			  					/>
458
-							</View>
459
-						
504
+			  
505
+			  					
506
+							</Pressable>
460 507
 						
461 508
 		  				{this.state.current}
462 509
 					</View>
510
+					</ScrollView>
463 511
 			</View>
464 512
 		</View>
465 513
       );

BIN
census-logos.png Wyświetl plik


+ 11
- 0
package-lock.json Wyświetl plik

@@ -21,6 +21,7 @@
21 21
         "react-native": "0.70.5",
22 22
         "react-native-dropdown-picker": "^5.4.3",
23 23
         "react-native-element-dropdown": "^2.5.0",
24
+        "react-native-table-component": "^1.2.2",
24 25
         "react-native-web": "~0.18.9"
25 26
       },
26 27
       "devDependencies": {
@@ -15482,6 +15483,11 @@
15482 15483
       "integrity": "sha512-oOanj84fJEXUg9FoEAQomA8ISG+DVIrTZ3qF7m69VQUJyOGYyDZmPqKcjvRku4KXlEH6hWO9i4ACLzNBh8gC0A==",
15483 15484
       "license": "MIT"
15484 15485
     },
15486
+    "node_modules/react-native-table-component": {
15487
+      "version": "1.2.2",
15488
+      "resolved": "https://registry.npmjs.org/react-native-table-component/-/react-native-table-component-1.2.2.tgz",
15489
+      "integrity": "sha512-7bbsi5431iWcjj3toASh8lFHGi6AG/+MTd4M7GuksXKxx/CFs/Qwv1Ys7D2wgyuYKe3hxWNfSVrteFj0tOYXYw=="
15490
+    },
15485 15491
     "node_modules/react-native-web": {
15486 15492
       "version": "0.18.10",
15487 15493
       "resolved": "https://registry.npmjs.org/react-native-web/-/react-native-web-0.18.10.tgz",
@@ -31873,6 +31879,11 @@
31873 31879
       "resolved": "https://registry.npmjs.org/react-native-gradle-plugin/-/react-native-gradle-plugin-0.70.3.tgz",
31874 31880
       "integrity": "sha512-oOanj84fJEXUg9FoEAQomA8ISG+DVIrTZ3qF7m69VQUJyOGYyDZmPqKcjvRku4KXlEH6hWO9i4ACLzNBh8gC0A=="
31875 31881
     },
31882
+    "react-native-table-component": {
31883
+      "version": "1.2.2",
31884
+      "resolved": "https://registry.npmjs.org/react-native-table-component/-/react-native-table-component-1.2.2.tgz",
31885
+      "integrity": "sha512-7bbsi5431iWcjj3toASh8lFHGi6AG/+MTd4M7GuksXKxx/CFs/Qwv1Ys7D2wgyuYKe3hxWNfSVrteFj0tOYXYw=="
31886
+    },
31876 31887
     "react-native-web": {
31877 31888
       "version": "0.18.10",
31878 31889
       "resolved": "https://registry.npmjs.org/react-native-web/-/react-native-web-0.18.10.tgz",

+ 1
- 0
package.json Wyświetl plik

@@ -22,6 +22,7 @@
22 22
     "react-native": "0.70.5",
23 23
     "react-native-dropdown-picker": "^5.4.3",
24 24
     "react-native-element-dropdown": "^2.5.0",
25
+    "react-native-table-component": "^1.2.2",
25 26
     "react-native-web": "~0.18.9"
26 27
   },
27 28
   "devDependencies": {

+ 5
- 25
yarn.lock Wyświetl plik

@@ -2799,13 +2799,6 @@
2799 2799
   "resolved" "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz"
2800 2800
   "version" "2.2.0"
2801 2801
 
2802
-"bindings@^1.5.0":
2803
-  "integrity" "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ=="
2804
-  "resolved" "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz"
2805
-  "version" "1.5.0"
2806
-  dependencies:
2807
-    "file-uri-to-path" "1.0.0"
2808
-
2809 2802
 "bl@^4.1.0":
2810 2803
   "integrity" "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w=="
2811 2804
   "resolved" "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz"
@@ -5401,19 +5394,6 @@
5401 5394
   "resolved" "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz"
5402 5395
   "version" "1.0.0"
5403 5396
 
5404
-"fsevents@^1.2.7":
5405
-  "integrity" "sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw=="
5406
-  "resolved" "https://registry.npmjs.org/fsevents/-/fsevents-1.2.13.tgz"
5407
-  "version" "1.2.13"
5408
-  dependencies:
5409
-    "bindings" "^1.5.0"
5410
-    "nan" "^2.12.1"
5411
-
5412
-"fsevents@^2.1.2", "fsevents@~2.3.2":
5413
-  "integrity" "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA=="
5414
-  "resolved" "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz"
5415
-  "version" "2.3.2"
5416
-
5417 5397
 "function-bind@^1.1.1":
5418 5398
   "integrity" "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A=="
5419 5399
   "resolved" "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz"
@@ -7663,11 +7643,6 @@
7663 7643
     "object-assign" "^4.0.1"
7664 7644
     "thenify-all" "^1.0.0"
7665 7645
 
7666
-"nan@^2.12.1":
7667
-  "integrity" "sha512-2ZTgtl0nJsO0KQCjEpxcIr5D+Yv90plTitZt9JBfQvVJDS5seMl3FOvsh3+9CoYWXf/1l5OaZzzF6nDm4cagaQ=="
7668
-  "resolved" "https://registry.npmjs.org/nan/-/nan-2.17.0.tgz"
7669
-  "version" "2.17.0"
7670
-
7671 7646
 "nanomatch@^1.2.9":
7672 7647
   "integrity" "sha512-fpoe2T0RbHwBTBUOftAfBPaDEi06ufaUai0mE6Yn1kacc3SnTErfb/h+X94VXzI64rKFHYImXSvdwGGCmwOqCA=="
7673 7648
   "resolved" "https://registry.npmjs.org/nanomatch/-/nanomatch-1.2.13.tgz"
@@ -9091,6 +9066,11 @@
9091 9066
   "resolved" "https://registry.npmjs.org/react-native-gradle-plugin/-/react-native-gradle-plugin-0.70.3.tgz"
9092 9067
   "version" "0.70.3"
9093 9068
 
9069
+"react-native-table-component@^1.2.2":
9070
+  "integrity" "sha512-7bbsi5431iWcjj3toASh8lFHGi6AG/+MTd4M7GuksXKxx/CFs/Qwv1Ys7D2wgyuYKe3hxWNfSVrteFj0tOYXYw=="
9071
+  "resolved" "https://registry.npmjs.org/react-native-table-component/-/react-native-table-component-1.2.2.tgz"
9072
+  "version" "1.2.2"
9073
+
9094 9074
 "react-native-web@~0.18.9":
9095 9075
   "integrity" "sha512-YV2gtZa1n7ulTGp+HcxH+KsAtaDPBI/dKd9oOQS31zyFHURjObLUVkKnGjkmlYAUReWfvmlU64GzyNwoZF9/tA=="
9096 9076
   "resolved" "https://registry.npmjs.org/react-native-web/-/react-native-web-0.18.10.tgz"