question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Android] Image in PointAnnotation can't be shown on Android

See original GitHub issue

To Reproduce Should be starting from 7.0.5 Release

            <View style={{height: 30, width: 21, backgroundColor: '#000'}}>
              <Image source={require('../../images/map/school.png')} />
            </View>
            <MapboxGL.Callout title='xxx' />
          </MapboxGL.PointAnnotation>

Screenshots Screen Shot 2019-10-14 at 10 42 44 AM

Versions (please complete the following information):

  • Platfrom: Android
  • Device: Asus Zenfone 5
  • OS: Android 6
  • SDK Version 28
  • React Native Version 0.59

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:5
  • Comments:26 (8 by maintainers)

github_iconTop GitHub Comments

24reactions
RobertSasakcommented, Dec 19, 2019

Workaround is to wrap <Image/> with <Text/>. Or as @RichardLindhout wrote to use SVG instead. Source: https://github.com/react-native-community/react-native-maps/issues/431#issuecomment-524321467

const HackMarker = ({ children }) =>
    Platform.select({
        ios: children,
        android: (
            <Text
                style={{
                    lineHeight: 88, // there is some weird gap, add 40+ pixels
                    backgroundColor: '#dcdcde',
                }}>
                {children}
            </Text>
        ),
    })

Use like this

<MapboxGL.PointAnnotation
    coordinate={[0,0]}
    id="marker">
    <HackMarker>
        <Image source={marker} />
    </HackMarker>
</MapboxGL.PointAnnotation>
8reactions
subodhsri1commented, Oct 30, 2019

Guys did you find the solution on it? if YES please guide.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[Android] Image in PointAnnotation can't be shown on ... - GitHub
On your Android emulator, go to the three-dots menu, and navigate to Settings > Advanced > OpenGL ES Renderer. Choose SwiftShader and restart...
Read more >
pointannotation is not working in android - Stack Overflow
Run and install the app · The images on PointAnnotation are completely invisible · Change the height and width in real time and...
Read more >
PointAnnotationOptions - Mapbox docs
PointAnnotation Options. Builder class from which a pointAnnotation is created. class PointAnnotationOptions : AnnotationOptions<Point, PointAnnotation>.
Read more >
Mark a Coordinate on Mapbox Map in React Native
In Android, the child React Native View is captured into a static image and then displayed. So, for instance, you cannot place a...
Read more >
rnmapbox/Lobby - Gitter
next question, it looks like PointAnnotation renders under other layers (this ... On android the layer id might-be: mapbox-android-symbol-layer-0 or ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found