[Feature request]: Support custom marker icons (bitmap/URI) via icon field in MarkerOptions
維護者通常 5 天內回覆
評估
這個 Issue 還沒有評估資料。
描述
Is there an existing issue for this?
- I have searched the existing issues
Use case
addMarker() via MapViewController only renders the default Google Maps pin regardless of what MarkerOptions is passed. There is no way to supply a custom image as the marker icon through the JS layer.
This is a blocking limitation for any app that needs to differentiate markers visually — the most common real-world case being live location sharing, where each member's marker should display their profile photo rather than an indistinguishable default pin.
Concrete scenario: In a group coordination app where 8 users share live location on the same NavigationView, all 8 markers render as identical red pins. There is no way to tell who is who without tapping each one individually. A custom avatar icon per member solves this entirely.
Alternatives considered:
Rendering an RN View as an overlay — Possible for static UI, but overlays are not anchored to map coordinates and don't move correctly with map pan/zoom/tilt. Not a real substitute for a native map marker.
react-native-maps — Supports custom marker icons but is a completely separate library. It cannot be used alongside @googlemaps/react-native-navigation-sdk on the same map surface, as both require owning the map view.
No existing package solves this within the Navigation SDK's MapViewController surface.
The underlying native SDKs fully support this — BitmapDescriptorFactory.fromBitmap() on Android and GMSMarker.icon on iOS. The gap is only in the React Native wrapper not exposing it.
Proposal
Add an optional icon field to MarkerOptions that accept a URI string pointing to a local asset or remote image, passed through the JS-to-native bridge and applied as the marker's bitmap icon on both Android and iOS.
Proposed TypeScript change:
export interface MarkerOptions {
position: LatLng;
title?: string;
snippet?: string;
isVisible?: boolean;
isFlat?: boolean;
isDraggable?: boolean;
rotation?: number;
alpha?: number;
icon?: { uri: string }; // ← proposed addition
}
Expected usage:
mapViewController.addMarker({
position: { lat: 17.385, lng: 78.4867 },
title: 'Sannihith',
icon: { uri: 'https://example.com/avatar.jpg' },
});
Android (Kotlin) — intended implementation path:
kotlinval iconUri = markerOptionsMap.getString("icon_uri")
val markerOptions = MarkerOptions()
.position(LatLng(lat, lng))
if (iconUri != null) {
val bitmap = BitmapFactory.decodeStream(
URL(iconUri).openConnection().getInputStream()
)
markerOptions.icon(BitmapDescriptorFactory.fromBitmap(bitmap))
}
iOS (Swift) — intended implementation path:
swiftif let iconUri = options["icon_uri"] as? String,
let url = URL(string: iconUri),
let data = try? Data(contentsOf: url),
let image = UIImage(data: data) {
marker.icon = image
}
I am willing to implement the Android side and submit a PR. Happy to align on the preferred API shape before starting if maintainers have a different approach in mind.
- 主要語言
- TypeScript
- 星號
- 226
- 分支
- 39
- 平均合併
- 1 天 20 小時
- 30 天內合併 PR
- 7
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
googlemaps/react-native-navigation-sdk 的其他 Issue
-
[Support Request]: Status of Expo config plugin release (prebuild fails on 0.19.0)可能已有人在做 @jokerttu 於 2 天前認領。 未關閉
googlemaps/react-native-navigation-sdk#711 · 已指派 1 人 ·
維護者通常 5 天內回覆
-
[Bug]: In-navigation notification can't be stopped可能已有人在做 @jokerttu 於 9 天前認領。 未關閉triage me type: bug
googlemaps/react-native-navigation-sdk#696 · 已指派 1 人 ·
維護者通常 5 天內回覆
-
[Bug]: [iOS] Navigation SDK init/quota retry loop pins the main thread; React Native's Settings module and addMarker's temporary GMSMarker add to the cost可能已有人在做 @illuminati1911 於 15 天前認領。 未關閉triage me type: bug
googlemaps/react-native-navigation-sdk#687 · 已指派 1 人 ·
維護者通常 5 天內回覆
-
[Bug]: iOS crash in GMSObjectDataCache Core Data save (fatal optimistic locking failure)可能重新可做 @illuminati1911 於 61 天前認領,目前沒有進行中的 PR。 未關閉native sdk issue
googlemaps/react-native-navigation-sdk#647 · 1 則留言 · 已指派 1 人 ·
維護者通常 5 天內回覆
-
[Bug]: CarPlay map view never sets GMSMapViewOptions.screen, so the navigation header and footer are sized for the phone可能重新可做 @jokerttu 於 75 天前認領,目前沒有進行中的 PR。 未關閉
googlemaps/react-native-navigation-sdk#640 · 4 則留言 · 1 個 reaction · 已指派 1 人 ·
維護者通常 5 天內回覆
查看 googlemaps/react-native-navigation-sdk 的全部 Issue
相似的 Issue
-
難度 1/5 1-3 小時 新手友好度 86/100
g1331/phantom-circuit#93 ·
維護者通常 1 天內回覆
-
bug
難度 2/5 1-3 小時 新手友好度 68/100
-
難度 2/5 1-3 小時 新手友好度 78/100
維護者通常 1 天內回覆
-
compiler
難度 2/5 1-3 小時 新手友好度 74/100
HerringtonDarkholme/hd-lang#1699 ·
維護者通常 1 天內回覆
-
account bug communication lecture
難度 2/5 1-3 小時 新手友好度 78/100
維護者通常 1 天內回覆