andrea.nieves7 1 year ago
parent
commit
673aa84b96
1 changed files with 52 additions and 4 deletions
  1. 52
    4
      App.js

+ 52
- 4
App.js View File

@@ -64,6 +64,7 @@ const queryBase = "https://api.census.gov/data/2020/acs/acs5/profile?get=group"
64 64
 const queryEnd = "&in=state:72"
65 65
 var table = ""
66 66
 var pueblo = ""
67
+var year = ""
67 68
 
68 69
 
69 70
 function updateTable(value){
@@ -74,6 +75,10 @@ function updatePueblo(value){
74 75
 	pueblo = value
75 76
 }
76 77
 
78
+function updateYear(value) {
79
+	year = value
80
+}
81
+
77 82
 //calls data query
78 83
 function loadDoc(query) {
79 84
   var xhttp = new XMLHttpRequest();
@@ -341,6 +346,33 @@ function Picker() {
341 346
 	{label: 'Yauco', value: '153'}
342 347
   ]);
343 348
   
349
+  
350
+  const [openYear, setOpenYear] = useState(false);
351
+  const [valueYear, setValueYear] = useState(null);
352
+  const [year, setYear] = useState([
353
+    {label:'2000', value: '2000'},
354
+    {label:'2001', value: '2001'},
355
+	{label:'2002', value: '2002'},
356
+    {label:'2003', value: '2003'},
357
+	{label:'2004', value: '2004'},
358
+    {label:'2005', value: '2005'},
359
+	{label:'2006', value: '2006'},
360
+    {label:'2007', value: '2007'},
361
+	{label:'2008', value: '2008'},
362
+    {label:'2009', value: '2009'},
363
+	{label:'2010', value: '2010'},
364
+    {label:'2011', value: '2011'},
365
+	{label:'2012', value: '2012'},
366
+    {label:'2013', value: '2013'},
367
+	{label:'2014', value: '2014'},
368
+    {label:'2015', value: '2015'},
369
+	{label:'2016', value: '2016'},
370
+    {label:'2017', value: '2017'},
371
+	{label:'2018', value: '2018'},
372
+    {label:'2019', value: '2019'},
373
+	{label:'2020', value: '2020'}
374
+  ]);
375
+  
344 376
 
345 377
   return (
346 378
   <View>
@@ -354,7 +386,7 @@ function Picker() {
354 386
 	  onChangeValue = {(valueTable) => {
355 387
 		updateTable(valueTable);
356 388
 		}}
357
-	  onOpen = {() => {setOpenPueblo(false)}}
389
+	  onOpen = {() => {setOpenPueblo(false);setOpenYear(false)}}
358 390
 	  zIndex={3000}
359 391
 	  zIndexInverse={1000}
360 392
 	  placeholder="Tabla de Datos"
@@ -371,13 +403,29 @@ function Picker() {
371 403
 	  onChangeValue = {(valuePueblo) => {
372 404
 		updatePueblo(valuePueblo);
373 405
 		}}
374
-	  onOpen = {() => {setOpenTable(false)}}
375
-	  zIndex={1000}
376
-      zIndexInverse={3000}
406
+	  onOpen = {() => {setOpenTable(false);setOpenYear(false)}}
407
+	  zIndex={2000}
408
+      zIndexInverse={2000}
377 409
 	  placeholder="Pueblo"
378 410
 	  searchPlaceholder="Busqueda..."
379 411
     />
380 412
 	
413
+	 <DropDownPicker
414
+      open={openYear}
415
+      value={valueYear}
416
+      items={year}
417
+      setOpen={setOpenYear}
418
+      setValue={setValueYear}
419
+      setItems={setYear}
420
+	  onChangeValue = {(valueYear) => {
421
+		updateYear(valueYear);
422
+		}}
423
+	  onOpen = {() => {setOpenPueblo(false);setOpenTable(false)}}
424
+	  zIndex={1000}
425
+	  zIndexInverse={3000}
426
+	  placeholder="20xx"
427
+    />
428
+	
381 429
 	</View>
382 430
   );
383 431
 }