Skip to content
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

feat: add custom pin to map #4

Merged
merged 1 commit into from
Sep 11, 2024
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
Binary file added apps/expo/assets/location.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added apps/expo/assets/locationpin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added apps/expo/assets/userPin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 9 additions & 3 deletions apps/expo/src/component/CustomMarker.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
import React from 'react';
import { Image } from 'react-native';
import { Marker } from 'react-native-maps';

const CustomMarker = ({ coordinate, title, description, onPress, pinColor = "red" }) => {
const CustomMarker = ({ coordinate, title, description, onPress, pinImage, height, width}) => {
return (
<Marker
coordinate={coordinate}
title={title}
description={description}
pinColor={pinColor}
onPress={onPress}
/>
>
<Image
source={pinImage}
style={{ width: width, height: height }}
resizeMode="contain"
/>
</Marker>
);
};

Expand Down
56 changes: 33 additions & 23 deletions apps/expo/src/component/EventCard.js
Original file line number Diff line number Diff line change
@@ -1,46 +1,56 @@
import React from 'react';
import { View, Text, Image, StyleSheet } from 'react-native';

const locationIcon = require('../../assets/location.png'); // Ton image d'icône de localisation

const EventCard = ({ city, groupName, imageSource }) => {
return (
<View style={styles.cardContainer}>
<Image source={imageSource} style={styles.image} />
<View style={styles.textContainer}>
<Text style={styles.cityText}>{city} : </Text>
<Text style={styles.groupText}>{groupName}</Text>
<View style={styles.infoContainer}>
<Text style={styles.groupName}>{groupName}</Text>
<View style={styles.cityContainer}>
<Image source={locationIcon} style={styles.locationImage} />
<Text style={styles.cityText}>{city}</Text>
</View>
</View>
</View>
);
};

const styles = StyleSheet.create({
cardContainer: {
flexDirection: 'row',
alignItems: 'center',
backgroundColor: '#b9f8f4',
borderRadius: 20,
marginBottom: 25,
padding: 15,
marginBottom: 20,
borderRadius: 10,
overflow: 'hidden',
backgroundColor: 'rgba(255,255,255,0.67)',
},
image: {
width: 45,
height: 45,
borderRadius: 40,
marginRight: 20,
width: '100%',
height: 150,
},
infoContainer: {
padding: 10,
justifyContent: 'center',
},
cityContainer: {
flexDirection: 'row', // Permet d'aligner l'icône et le texte côte à côte
alignItems: 'center', // Centrer verticalement
},
textContainer: {
flex: 1,
flexDirection:"row",
locationImage: {
width: 20,
height: 20,
marginRight: 8, // Ajouter un espacement entre l'image et le texte
},
cityText: {
fontSize: 22,
color: '#fff',
fontWeight: 'bold',
color: 'rgba(180,180,180,0.73)',
fontSize: 16,
},
groupText: {
fontSize: 22,
color: '#fff',
fontWeight: 'bold',
groupName: {
color: '#1B1464',
fontSize: 19,
marginTop: 5,
fontWeight: "bold",
},
});

Expand Down
16 changes: 13 additions & 3 deletions apps/expo/src/pages/MapScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import CustomMarker from '../../src/component/CustomMarker';

// Image personnalisée
const PopupImage = require('../../assets/logo.png');
const UserImagePin = require('../../assets/userPin.png');
const LocationImagePin = require('../../assets/locationPin.png');

const MapScreen = () => {
const [region, setRegion] = useState({
Expand Down Expand Up @@ -68,7 +70,9 @@ const MapScreen = () => {
coordinate={userLocation}
title="Votre position actuelle"
description="Vous êtes ici"
pinColor="blue"
height={45}
width={45}
pinImage={UserImagePin}
onPress={() => handleMarkerPress({
title: "Votre position actuelle",
description: "Vous êtes ici",
Expand All @@ -84,6 +88,9 @@ const MapScreen = () => {
}}
title="Exo"
description="Kpop"
pinImage={LocationImagePin}
height={35}
width={35}
onPress={() => handleMarkerPress({
title: "Exo",
description: "Heures : 17h",
Expand All @@ -93,11 +100,14 @@ const MapScreen = () => {

<CustomMarker
coordinate={{
latitude: 65.44709008859785,
longitude: 1.1042816721797788,
latitude: 49.442804165962286,
longitude: 1.0926350343166913,
}}
title="Poab"
description="Kpop"
pinImage={LocationImagePin}
height={35}
width={35}
onPress={() => handleMarkerPress({
title: "Poab",
description: "Heures : 18h",
Expand Down
Loading