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.

ShapeSource onpress call 2 times

See original GitHub issue

Describe the bug The onpress function of ShapeSource is called 2 times

To Reproduce

async function onPress(e, coleta, setDados) {
  console.log(11);
}

function Point({
  features, coleta, setDados
}) {
  return (
    <MapboxGL.ShapeSource
      cluster
      clusterRadius={35}
      clusterMaxZoom={14}
      id="postes"
      shape={{ type: 'FeatureCollection', features }}
      onPress={e => console.log(11)}
    >
      <MapboxGL.SymbolLayer
        id="pointCount"
        style={styles.clusterCount}
      />

Screenshots image

Versions (please complete the following information):

  • Platfrom: [Android]
  • SDK Version [28]
  • React Native Version [0.59.5]

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:16 (12 by maintainers)

github_iconTop GitHub Comments

1reaction
mattijsfcommented, Jun 27, 2019

@mfazekas Thanks for pointing it out. Yes it was caused by the same problem, just added a commit to the PR that fixes the problem for these map related events.

0reactions
Beamanatorcommented, Sep 15, 2019

Hmmm I’m trying to get a ShapeSource’s onPress to work, but it’s not running the function at all! Any advice?

Some important packages I’m using:

"@react-native-mapbox-gl/maps": "^7.0.4",
"react": "^16.9.0",
"react-native": "^0.60.5",

Platfrom: [Android] SDK Version [28]

I’ve been using very similar code to this example but including onPress={(e) => console.log("shapesource press", e)} prop in the ShapeSource component.

I am not getting any errors or anything, and no console log messages either. Is anyone else running into a similar issue with the above packages?

Read more comments on GitHub >

github_iconTop Results From Across the Web

ShapeSource onpress call 2 times · Issue #97 · rnmapbox/maps
Describe the bug The onpress function of ShapeSource is called 2 times To Reproduce async function onPress(e, coleta, ...
Read more >
react native how to call multiple functions when onPress is ...
There are a few ways to achieve this. One option would be to define a function that calls functionOne and functionTwo , and...
Read more >
rnmapbox/Lobby - Gitter
I'm trying to use rnmapbox/maps library with the latest React Native (0.70.x) and it doesn't seem to work. Is this expected/has anyone been...
Read more >
How to update MapboxGL.ShapeSource dynamically?-Reactjs
To make it short : I wanted to use dynamics SVGs as SymbolLayer (so that I can change the colour for instance), but...
Read more >
How do you center the map on a clicked symbol using MapBox and ...
Spent a long time trying to do this: Mapbox show how to do it here, ... I'm using ShapeSource and SymboLayer, getting my...
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