|
@@ -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
|
);
|