Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/app/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -342,17 +342,21 @@ export default function HomeScreen() {

function handlePinPress(pinId: string) {
if (pinId === "user-location") {
setSelectedVenueId(null);
return;
}

setSelectedVenueId(pinId);

const tappedResult = results.find((result) => result.venue.id === pinId);

if (!tappedResult) {
return;
}

if (selectedVenueId !== pinId) {
setSelectedVenueId(pinId);
return;
}

void openDirections({
address: `${tappedResult.venue.address}, ${tappedResult.venue.city}, ${tappedResult.venue.region}`,
destination: {
Expand Down
62 changes: 40 additions & 22 deletions src/components/app-map.native.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -136,30 +136,41 @@ export function AppMap({
/>
</RasterSource>

{pins.map((pin) => (
<Marker
key={pin.id}
anchor="bottom"
lngLat={[pin.coordinate.longitude, pin.coordinate.latitude]}
onPress={() => onPinPress?.(pin.id)}
>
<View style={styles.markerWrap}>
<View
style={[
styles.dot,
pin.isUserLocation ? styles.userDot : styles.venueDot,
selectedPinId === pin.id && styles.dotSelected,
]}
/>
<View style={styles.label}>
<Text style={styles.labelTitle}>{pin.title}</Text>
{pin.description ? (
<Text style={styles.labelText}>{pin.description}</Text>
{pins.map((pin) => {
const isSelected = selectedPinId === pin.id;

return (
<Marker
key={pin.id}
anchor="bottom"
lngLat={[pin.coordinate.longitude, pin.coordinate.latitude]}
onPress={() => onPinPress?.(pin.id)}
>
<View style={styles.markerWrap}>
<View
style={[
styles.dot,
pin.isUserLocation ? styles.userDot : styles.venueDot,
isSelected && styles.dotSelected,
]}
/>
{isSelected ? (
<View style={styles.label}>
<Text style={styles.labelTitle}>{pin.title}</Text>
{pin.description ? (
<Text style={styles.labelText}>{pin.description}</Text>
) : null}
{!pin.isUserLocation ? (
<Text style={styles.labelAction}>
Tap again for directions
</Text>
) : null}
</View>
) : null}
</View>
</View>
</Marker>
))}
</Marker>
);
})}
</Map>

<View style={styles.zoomControls}>
Expand Down Expand Up @@ -256,4 +267,11 @@ const styles = StyleSheet.create({
fontSize: 11,
lineHeight: 16,
},
labelAction: {
color: theme.colors.brandMuted,
fontSize: 11,
fontWeight: "700",
lineHeight: 16,
marginTop: 4,
},
});
Loading