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.

App crashes on using PointAnnotation in loop with below error

See original GitHub issue

Describe the bug When i am using Point annonation in loop or conditional way to render point then many times it crashes an app.

  1. Crashes an app
  2. Point annotation loads image on second time. Even refresh prop use also do nothing.

LongScreenshot_2020-05-18-23-12-06

To Reproduce This code is resides in home page. When do login and redirect to home page it shows map with multiple point annotation. For that i am using loop.

Sample code:



function Home(props) {

function getPoints(centers) {
    const items = [];
    for (let i = 0; i < centers.length; i++) {
      const center = centers[i];
      if(currentCentre && currentCentre.id === center.id) {
        continue;
      }
      items.push(
        <MapboxGL.PointAnnotation
          key={i}
          id={`${i}`}
          coordinate={getLocation(center.location)}
          title={center.name}
          onSelected={() => console.log('sss')}>
          <View>
            <Image
              source={imageMapper.station.source}
              style={{width: 40, height: 47}}
            />
          </View>
        </MapboxGL.PointAnnotation>,
      );
    }
    return items;
  }

   return (
    <MapboxGL.MapView
        style={styles.map}
        logoEnabled={false}
      >
        <MapboxGL.Camera
          zoomLevel={13}
          centerCoordinate={[72.75488663468855, 21.146613036727842]}
        />
        <MapboxGL.UserLocation />
        {getPoints(_centers)}
        
        <MapboxGL.PointAnnotation
          ref={r => (pointRef.current = r)}
          id={`test`}
          coordinate={getLocation(currentCentre.location)}>
          <View>
            <Image
              source={imageMapper.selectedStation.source}
              style={{width: 40, height: 47}}
              onLoad={() => {
                console.log(pointRef);
                // pointRef.current && pointRef.current.refresh();
              }}
            />
          </View>
        </MapboxGL.PointAnnotation>
      </MapboxGL.MapView>
)
}

Expected behavior

  1. It should not crash an app.
  2. It should load image component every tine without fail.

Versions:

  • Platform: [Android]
  • react-native-mapbox-gl Version [8.0.0-rc2]
  • React Native Version [0.62.0]

Additional context Inform me if you need more information. Ready to fix problem together. thanks

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:14 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
Julious1994commented, Jun 4, 2020

up ! @mfazekas @Julious1994 do you still have this bug ?

Yes @JordanProtin still getting issue.

1reaction
JordanProtincommented, Jun 4, 2020

@mfazekas for sure !

This is a single example component that represents this bug. Please note I get this bug randomly, it doesn’t happen all the time, and I don’t know why.

In this example, you have to edit the MAPBOX_GL_ACCESS_TOKEN constant with your personal key. (line 7)

This script uses external libraries such as react-native-svg and @turf/helpers

Thank you for your help !

Read more comments on GitHub >

github_iconTop Results From Across the Web

Loop App crashes - LoopDocs
If your Loop app crashes immediately upon opening, you have a problem that needs to be fixed. What do I mean by "crashes"?...
Read more >
Floating Action Button causing error and crashing application
When I remove it, my application runs successfully, but I'd rather use the floating action button if I can. This is my complete...
Read more >
rnmapbox/Lobby - Gitter
this short error: https://hastebin.com/rijipesozu.php . ... and click on point annotation app crashes with error saying bitmap.getheight on a null reference.
Read more >
ReactNative App Crashes when Deployed to TestFlight
When I download the app from TestFlight on the same device, the app crashes immediately upon opening the app. The app is built...
Read more >
How to Resolve App Crashes in Android Studio?
Now we can write error-less code and our app should run, right? Well, NO. ... In Android Studio one of the most used...
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