|
@ -1,11 +1,28 @@ |
|
|
import React, { useEffect, useContext } from "react"; |
|
|
|
|
|
|
|
|
import React, { useEffect, useContext, useState } from "react"; |
|
|
import { StyleSheet, View } from "react-native"; |
|
|
import { StyleSheet, View } from "react-native"; |
|
|
import OpenStreetMap from "../components/map/OpenStreetMap"; |
|
|
import OpenStreetMap from "../components/map/OpenStreetMap"; |
|
|
import attachFocusToQuery from "../hooks/useFocus"; |
|
|
import attachFocusToQuery from "../hooks/useFocus"; |
|
|
import { MapMarkerList } from "../components/MapMarkerList"; |
|
|
import { MapMarkerList } from "../components/MapMarkerList"; |
|
|
|
|
|
import formsApi from "../api/getforms"; |
|
|
|
|
|
|
|
|
export default function MapFeedScreen() { |
|
|
export default function MapFeedScreen() { |
|
|
const focusChanged = attachFocusToQuery(); |
|
|
const focusChanged = attachFocusToQuery(); |
|
|
|
|
|
const [error, setError] = useState(false); |
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
|
|
loadForms(); |
|
|
|
|
|
}, []); |
|
|
|
|
|
|
|
|
|
|
|
const loadForms = async () => { |
|
|
|
|
|
const response = await formsApi.getForms(); |
|
|
|
|
|
console.log(response); |
|
|
|
|
|
if (!response.ok) { |
|
|
|
|
|
console.log("resposta não ok!"); |
|
|
|
|
|
return setError(true); |
|
|
|
|
|
} |
|
|
|
|
|
setError(false); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return ( |
|
|
return ( |
|
|
<View style={styles.container}> |
|
|
<View style={styles.container}> |
|
|