-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Change pinColor of MapView.Marker to Black #887
Comments
Hey @nyxynyx try adding the pinColor value in curly braces like this.
|
Observing the same problem, iOS works but android still renders the default red pin (also tried @krsjoseph solution, same result) |
bump |
Google maps markers only show in certain colors. You can't just use any color. I wish a had a canonical source to back this up, but try experimenting with shades of a color. You can't change the shade but at a certain hex value it will just appear as a different color. |
I had the issues (only on Android) that the pin color change did not work. I assume the map is reusing the pin based on the key. Changing the marker key property to something different worked for me key={this.updatePinKeyForMarker(marker)} |
Same issue here, @bufke is right. |
Going to bump this as well. Almost every hex color I've tried is defaulting to the red marker, and the Versions: "expo": "^19.0.0",
"react-native": "^0.46.1"`
"react-native-maps": "^0.15.3" @jorgutdev I was unable to find a list of available colors, but here are some I found from testing (per @bufke's suggestion):
Not the best set of colors IMO, and it doesn't seem to offer anything on a grayscale (which is what I need for my app). @duvnjak99, would you mind elaborating on your |
@pcooney10 thanks for the research, not a great set of colors indeed. |
Yes, agreed @raduflp. Best bet IMO is just to use custom images. |
From my research, I've find out that only colors that are created from combination HUE + 100% saturation and 100 % value/lightness can be used see docs page ( |
@fduvnjak I am having the same issues you mention about the key playing a role in allowing/preventing rendering with a new color. I'm simply switching between I ended up using something like <Marker
pinColor={isActive ? 'yellow' : 'red'}
key={`${markerId}-${isActive ? 'active' : 'inactive'}`}
// ... other props ...
/> It seems that there are two issues at hand here: Android only allows very specific colors for markers, and marker colors don't update on Android unless the |
Closing as per #2429 |
Thank you @fduvnjak ! This was precisely my problem, too. I "foolishly" tried to use a stable, natural key (i.e. strictly domain-object derived) and every time my redux store was modified with prop values changing the pinColor, the color wouldn't actually update. By adding something that's different every time (i.e. getMilliseconds()) to the key, I was able to get the reacted updates as I expected from marker changes. That will teach me to build keys with meaning.. right?? Hah. |
Thank you ! Its work for me |
The color of
MapView.Marker
does not seem to change from the default red color even after assigning a color topinColor
.Is something wrong?
Screen cap from Android Emulator
The text was updated successfully, but these errors were encountered: