Skip to content

Commit

Permalink
chore: add custom marker bitmap to example app
Browse files Browse the repository at this point in the history
  • Loading branch information
jokerttu committed Nov 20, 2024
1 parent 590b429 commit c2c255f
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 6 deletions.
2 changes: 1 addition & 1 deletion example/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ react {
// hermesFlags = ["-O", "-output-source-map"]

/* This example app uses typescript index file, so we need to specify the entry file */
entryFile = file("index.ts")
entryFile = file("../../index.ts")

/* Autolinking */
autolinkLibrariesWithApp()
Expand Down
Binary file added example/android/app/src/main/assets/circle.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions example/ios/SampleApp/Images.xcassets/Contents.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "circle.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
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 example/src/controls/mapsControls.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ const MapsControls: React.FC<MapControlsProps> = ({ mapViewController }) => {
console.log(result);
};

const addMarker = async () => {
const addMarker = async (imgPath?: string) => {
const cameraPosition = await mapViewController.getCameraPosition();

const marker: Marker = await mapViewController.addMarker({
Expand All @@ -115,14 +115,19 @@ const MapsControls: React.FC<MapControlsProps> = ({ mapViewController }) => {
title: 'Marker test',
snippet: 'Marker test',
alpha: 0.8,
rotation: 20,
rotation: 0,
flat: false,
draggable: true,
imgPath: imgPath,
});

console.log(marker);
};

const addCustomMarker = async () => {
addMarker('circle.png');
};

const addCircle = async () => {
const cameraPosition = await mapViewController.getCameraPosition();

Expand Down Expand Up @@ -221,7 +226,8 @@ const MapsControls: React.FC<MapControlsProps> = ({ mapViewController }) => {
setZoom((zoom ?? defaultZoom) - 1);
}}
/>
<Button title="Add marker" onPress={addMarker} />
<Button title="Add marker" onPress={() => addMarker()} />
<Button title="Add custom marker" onPress={() => addCustomMarker()} />
<Button title="Add circle" onPress={addCircle} />
<Button title="Add polyline" onPress={addPolyline} />
<Button title="Add polygon" onPress={addPolygon} />
Expand Down

0 comments on commit c2c255f

Please sign in to comment.