App crashes on using PointAnnotation in loop with below error
See original GitHub issueDescribe the bug When i am using Point annonation in loop or conditional way to render point then many times it crashes an app.
- Crashes an app
- Point annotation loads image on second time. Even refresh prop use also do nothing.
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
- It should not crash an app.
- 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:
- Created 3 years ago
- Comments:14 (5 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yes @JordanProtin still getting issue.
@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.
Thank you for your help !