diff --git a/lib/screens/mapPage/ExploreLoadingScreen.tsx b/lib/screens/mapPage/ExploreLoadingScreen.tsx new file mode 100644 index 0000000..aa2eaea --- /dev/null +++ b/lib/screens/mapPage/ExploreLoadingScreen.tsx @@ -0,0 +1,24 @@ +import { ActivityIndicator, View, Text, StyleSheet } from 'react-native'; +import { useTheme } from '../../components/ThemeProvider'; + +const ExploreLoadingScreen = () => { + const { theme, isDarkmode } = useTheme(); + + return ( + + + + Loading your location... + + ); +} + +const styles = StyleSheet.create({ + centered: { + flex: 1, + justifyContent: 'center', + alignItems: 'center' + } +}); + +export default ExploreLoadingScreen; diff --git a/lib/screens/mapPage/ExploreScreen.js b/lib/screens/mapPage/ExploreScreen.js index 9c16235..0b06703 100644 --- a/lib/screens/mapPage/ExploreScreen.js +++ b/lib/screens/mapPage/ExploreScreen.js @@ -36,7 +36,6 @@ const ExploreScreen = () => { const { theme, isDarkmode } = useTheme(); const [showMapTypeOptions, setShowMapTypeOptions] = useState(false); - const toggleMapTypeOptions = () => { setShowMapTypeOptions(prevState => !prevState); }; @@ -87,10 +86,18 @@ const ExploreScreen = () => { globeIcon !== "earth", "someUserId" ); - - console.log("STEP 3: fetchedNotes from ApiService.fetchMessages:", fetchedNotes); - // console.log("Notes being used: ", fetchedNotes); - + + // console.log("STEP 3: fetchedNotes from ApiService.fetchMessages:", fetchedNotes); + + // Write the count to the log file + await RNFS.appendFile(logFilePath, `Count of fetched notes: ${fetchedNotes.length}\n`, 'utf8') + .then(() => { + console.log('Logged count to file'); + }) + .catch(err => { + console.error('Error writing to log file:', err); + }); + const fetchedMarkers = fetchedNotes.map((note) => { let time; if (note.time === undefined) { @@ -101,7 +108,7 @@ const ExploreScreen = () => { } else { time = new Date(note.time); } - + return { coordinate: { latitude: parseFloat(note.latitude) || 0, @@ -113,20 +120,22 @@ const ExploreScreen = () => { description: note.BodyText || "", images: note.media.map((mediaItem) => ({ uri: mediaItem.uri })) || - require("../../../assets/map_marker.png"), // need to replace with placeholder image + require("../../../assets/map_marker.png"), // Placeholder image replacement time: formatToLocalDateString(time) || "", tags: note.tags || [], }; }); - + setState((prevState) => ({ ...prevState, markers: fetchedMarkers, + notesCount: fetchedNotes.length, // if you need to use this count in your state })); } catch (error) { console.error("Error fetching messages:", error); } }); + useEffect(() => { fetchMessages(); @@ -491,7 +500,7 @@ const [state, setState] = useState({ { setGlobeIcon(prevIcon => (prevIcon === "earth-outline" ? "earth" : "earth-outline")); - setSearchResults(null); + setSearchResults(null); }}>