React-native-mapbox-gl: Option to disable empty annotations.

Created on 27 Oct 2018  路  5Comments  路  Source: nitaliano/react-native-mapbox-gl

Hey everyone, i just want to have pointAnnotations that dont show any annotations when the text is empty just like it was mentioned in #141. The linked isssue says its fixed, but im having them with the current version of mapbox. Any help would be appreciated

All 5 comments

Any news on this? I'm experiencing the same issue with mapbox version 6.1.2

Not really. We left it as is. I recommend getting rid of mapbox altogether, its been really problematic for us.

Yes, but I'm currently working on a project that needs the offline maps support feature so I need to stick with MapBox.
For anyone interested: I ended up modifying Callout.js in /node-modules/react-native-mapbox-gl/javascript/components/Callout.js to have an opacity of 0 in order to hide it. Definitely not the most elegant solution, though.

const styles = StyleSheet.create({
  container: {
    alignItems: 'center',
    justifyContent: 'center',
    width: 180,
    zIndex: 9999999,
    opacity: 0 // here
  },
  tip: {
    zIndex: 1000,
    marginTop: -2,
    elevation: 0,
    backgroundColor: 'transparent',
    borderTopWidth: 16,
    borderRightWidth: 8,
    borderBottomWidth: 0,
    borderLeftWidth: 8,
    borderTopColor: 'white',
    borderRightColor: 'transparent',
    borderBottomColor: 'transparent',
    borderLeftColor: 'transparent',
  },
  content: {
    position: 'relative',
    padding: 8,
    flex: 1,
    borderRadius: 3,
    borderWidth: 1,
    borderColor: 'rgba(0, 0, 0, 0.2)',
    backgroundColor: 'white',
  },
  title: {
    color: 'black',
    textAlign: 'center',
  },
});

You can hide it with:
```
style={{ display: title ? 'flex' : 'none' }}
containerStyle={{ display: title ? 'flex' : 'none' }}
contentStyle={{ display: title ? 'flex' : 'none' }}
tipStyle={{ display: title ? 'flex' : 'none' }}
textStyle={{ display: title ? 'flex' : 'none' }} />

@nitaliano can be closed.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

madroneropaulo picture madroneropaulo  路  4Comments

Maxence-Machu picture Maxence-Machu  路  3Comments

Amalp picture Amalp  路  3Comments

digitaldavenyc picture digitaldavenyc  路  4Comments

max-prokopenko picture max-prokopenko  路  4Comments