-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix: Issue #98 #166
Closed
Closed
Fix: Issue #98 #166
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,26 @@ | ||
import React, { useEffect, useState, useRef, useCallback } from "react"; | ||
import Constants from "expo-constants"; | ||
import * as Location from "expo-location"; | ||
import React, { useCallback, useEffect, useRef, useState } from "react"; | ||
import { | ||
Animated, | ||
Dimensions, | ||
Image, | ||
Keyboard, | ||
Platform, | ||
StyleSheet, | ||
Text, | ||
TextInput, | ||
View, | ||
Animated, | ||
Image, | ||
TouchableOpacity, | ||
Dimensions, | ||
Platform, | ||
View, | ||
} from "react-native"; | ||
import MapView, { Marker } from "react-native-maps"; | ||
import * as Location from "expo-location"; | ||
import NoteDetailModal from "./NoteDetailModal"; | ||
import { formatToLocalDateString } from "../../components/time"; | ||
import Ionicons from "react-native-vector-icons/Ionicons"; | ||
import MaterialCommunityIcons from "react-native-vector-icons/MaterialCommunityIcons"; | ||
import { mapDarkStyle, mapStandardStyle } from "./mapData"; | ||
import ApiService from "../../utils/api_calls"; | ||
import Constants from "expo-constants"; | ||
import { Keyboard } from "react-native"; | ||
import { useTheme } from "../../components/ThemeProvider"; | ||
import { formatToLocalDateString } from "../../components/time"; | ||
import ApiService from "../../utils/api_calls"; | ||
import NoteDetailModal from "./NoteDetailModal"; | ||
import { mapDarkStyle, mapStandardStyle } from "./mapData"; | ||
|
||
const { width } = Dimensions.get("window"); | ||
const CARD_HEIGHT = 220; | ||
|
@@ -36,6 +36,9 @@ const ExploreScreen = () => { | |
const { theme, isDarkmode } = useTheme(); | ||
const [showMapTypeOptions, setShowMapTypeOptions] = useState(false); | ||
|
||
// Add the rest of your component logic here | ||
|
||
|
||
const toggleMapTypeOptions = () => { | ||
setShowMapTypeOptions((prevState) => !prevState); | ||
}; | ||
|
@@ -147,22 +150,24 @@ const ExploreScreen = () => { | |
|
||
useEffect(() => { | ||
fetchMessages(); | ||
}, [state, globeIcon, searchResults]); | ||
}, [ globeIcon, searchResults]); | ||
|
||
|
||
const styles = StyleSheet.create({ | ||
|
||
const createStyles = (theme, isDarkmode) => StyleSheet.create({ | ||
container: { | ||
flex: 1, | ||
}, | ||
searchBox: { | ||
position: "absolute", | ||
marginTop: Constants.statusBarHeight, | ||
flexDirection: "row", | ||
backgroundColor: theme.primaryColor, | ||
backgroundColor:"#ffff", | ||
width: "90%", | ||
alignSelf: "center", | ||
borderRadius: 5, | ||
padding: 10, | ||
shadowColor: theme.text, | ||
shadowColor: "#cccc", | ||
shadowOffset: { width: 0, height: 0 }, | ||
shadowOpacity: 0.125, | ||
shadowRadius: 5, | ||
|
@@ -284,6 +289,7 @@ const ExploreScreen = () => { | |
padding: 10, | ||
fontSize: 14, | ||
fontWeight: "bold", | ||
color: "black", | ||
}, | ||
selectedMapTypeText: { | ||
fontWeight: "bold", | ||
|
@@ -348,7 +354,7 @@ const ExploreScreen = () => { | |
|
||
useEffect(() => { | ||
mapAnimation.addListener(({ value }) => { | ||
let index = Math.floor(value / CARD_WIDTH + 0.3); // animate 30% away from landing on the next item | ||
let index = Math.floor(value / CARD_WIDTH + 2); // animate 30% away from landing on the next item | ||
if (index >= state.markers.length) { | ||
index = state.markers.length - 1; | ||
} | ||
|
@@ -432,14 +438,12 @@ const ExploreScreen = () => { | |
return { scale }; | ||
}); | ||
|
||
const onMarkerPress = (mapEventData) => { | ||
const markerID = mapEventData._targetInst.return.key; | ||
|
||
const onMarkerPress = (markerID) => { | ||
let x = markerID * CARD_WIDTH + markerID * 20; | ||
if (Platform.OS === "ios") { | ||
x = x - SPACING_FOR_CARD_INSET; | ||
} | ||
|
||
_scrollView.current.scrollTo({ x: x, y: 0, animated: true }); | ||
}; | ||
|
||
|
@@ -450,7 +454,7 @@ const ExploreScreen = () => { | |
<View style={styles.container}> | ||
<MapView | ||
ref={_map} | ||
initialRegion={state.region} | ||
region={state.region} | ||
style={styles.container} | ||
customMapStyle={isDarkmode ? mapDarkStyle : mapStandardStyle} | ||
mapType={mapType} | ||
|
@@ -467,7 +471,7 @@ const ExploreScreen = () => { | |
<Marker | ||
key={index} | ||
coordinate={marker.coordinate} | ||
onPress={(e) => onMarkerPress(e)} | ||
onPress={() => onMarkerPress(index)} | ||
> | ||
<Animated.View style={[styles.markerWrap]}> | ||
<Animated.Image | ||
|
@@ -640,8 +644,6 @@ const ExploreScreen = () => { | |
); | ||
}; | ||
|
||
export default ExploreScreen; | ||
|
||
const styles = StyleSheet.create({ | ||
container: { | ||
flex: 1, | ||
|
@@ -650,12 +652,12 @@ const styles = StyleSheet.create({ | |
position: "absolute", | ||
marginTop: Constants.statusBarHeight, | ||
flexDirection: "row", | ||
backgroundColor: "#fff", | ||
backgroundColor: "#ffff", | ||
width: "90%", | ||
alignSelf: "center", | ||
borderRadius: 5, | ||
padding: 10, | ||
shadowColor: "#ccc", | ||
shadowColor: "#cccc", | ||
shadowOffset: { width: 0, height: 3 }, | ||
shadowOpacity: 0.5, | ||
shadowRadius: 5, | ||
|
@@ -717,6 +719,7 @@ const styles = StyleSheet.create({ | |
textContent: { | ||
flex: 2, | ||
padding: 10, | ||
color: "#cccc", | ||
}, | ||
cardtitle: { | ||
fontSize: 12, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a lot of lines for a file, do we need it to be this long? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe look to divi up some of these components into more files |
||
|
@@ -753,3 +756,5 @@ const styles = StyleSheet.create({ | |
fontWeight: "bold", | ||
}, | ||
}); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These changes look like rearrangement of imports, is there a purpose behind this?