rnmapbox / maps

A Mapbox react native module for creating custom maps
MIT License
2.26k stars 846 forks source link

[Bug]: React Native Heatmaps Not Working and Causes Crash #3474

Open gavinruihanyu opened 6 months ago

gavinruihanyu commented 6 months ago

Mapbox Implementation

Mapbox

Mapbox Version

default

React Native Version

0.74

Platform

Android

@rnmapbox/maps version

10.0.0-beta.11

Standalone component to reproduce

import React from "react";
import { Button, StyleSheet, TouchableOpacity, View, Text } from "react-native";
import Mapbox from "@rnmapbox/maps";
import { HeatmapLayer, ShapeSource, CircleLayer } from "@rnmapbox/maps";

Mapbox.setAccessToken("");

const App = () => {
  return (

<Mapbox.MapView
          styleURL="mapbox://styles/gavinruihanyu/cll3vsy9s006w01r8aptc3y9b"
          projection="globe"
          rotateEnabled={true}
          scaleBarEnabled={false}
          logoEnabled={false}
        >
          {/*Add the GeoJSON source and heatmap layer*/}
          <ShapeSource
            id="earthquakes"
            url="https://docs.mapbox.com/mapbox-gl-js/assets/earthquakes.geojson"
          >
            {console.log("Setting up HeatmapLayer") /* THIS IS THE CULPRIT*/}
            <HeatmapLayer id="hello" sourceID="earthquakes" />
            {/* <CircleLayer
              id="earthquakeCircle"
              sourceID="earthquakes"
              style={{
                circleRadius: 4,
                circleColor: "blue",
                circleOpacity: 0.6,
              }}
            /> */}
          </ShapeSource>
        </Mapbox.MapView>
  );
}

export default App;

Observed behavior and steps to reproduce

The Behavior: When launching an app bundled with either Metro or EAS Expo, the rendering of HeatmapLayer appears to cause the application to crash. This is happening on Android without double checking IOS.

Upon launch of the app, we initially render the globe: image However the application crashes immediately with no error logs or logs of any kind. image There does not seem to be a deletion of the running instance of the app considering that the app can still be accessed via: image

Reproduction: The application was both tested via bundling EAS Expo and React Native Cli Metro. The error was only able to be reproduced in Android. Virtualization was used for both cases. -> need to check if it crashes on an Android device

My team discovered that upon calling <HeatmapLayer id="earthquakesHeat" sourceID="earthquakes" /> we obtain the "crash". However, calling <HeatmapLayer sourceID="earthquakes" /> (without the ID param) we obtain a globe without the heatmap render. However it does not crash when there is no ID param.

Exact reproduction method:

  1. Create either an Expo EAS or a react-native Metro Project.
  2. Use any android emulator using virtualization (any chipset, all failed thus far)
  3. Run the following code mentioned above

Expected behavior

No response

Notes / preliminary analysis

No response

Additional links and references

No response

1revolman1 commented 1 month ago

The same one here! Is there any solution?

gavinruihanyu commented 1 month ago

@1revolman1 Not as of yet unfortunately, hoping mapbox will find a solution, let me know if you find anything.

Artotim commented 2 weeks ago

Same issue here. The code runs fine on my physical device, but it crashes on the emulator without any React Native logs.

Checking the AndroidStudio logcat, I found the following error:

libc                    com.test_app    A  Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0 in tid 7176 (MapboxRenderThr), pid 6850 (test_app)
DEBUG                   crash_dump64    A  Cmdline: com.test_app
DEBUG                   crash_dump64    A  pid: 6850, tid: 7176, name: MapboxRenderThr  >>> com.test_app <<<
DEBUG                   crash_dump64    A        #01 pc 00000000000f13d9  /data/app/~~VGA8TIIdMXYi2Mi8ZFWymg==/com.test_app-EgYAVGnhc6rmjl8VaolNPg==/lib/x86_64/libc++_shared.so (BuildId: de4901415b117d03796c38214752f9d82ebc73ca)
DEBUG                   crash_dump64    A        #03 pc 00000000000f115b  /data/app/~~VGA8TIIdMXYi2Mi8ZFWymg==/com.test_app-EgYAVGnhc6rmjl8VaolNPg==/lib/x86_64/libc++_shared.so (BuildId: de4901415b117d03796c38214752f9d82ebc73ca)
DEBUG                   crash_dump64    A        #04 pc 000000000022a408  /data/app/~~VGA8TIIdMXYi2Mi8ZFWymg==/com.test_app-EgYAVGnhc6rmjl8VaolNPg==/lib/x86_64/libmapbox-maps.so (BuildId: db190a827351d622)
DEBUG                   crash_dump64    A        #05 pc 00000000000ed6b2  /data/app/~~VGA8TIIdMXYi2Mi8ZFWymg==/com.test_app-EgYAVGnhc6rmjl8VaolNPg==/lib/x86_64/libc++_shared.so (BuildId: de4901415b117d03796c38214752f9d82ebc73ca)
DEBUG                   crash_dump64    A        #06 pc 00000000000ed4e7  /data/app/~~VGA8TIIdMXYi2Mi8ZFWymg==/com.test_app-EgYAVGnhc6rmjl8VaolNPg==/lib/x86_64/libc++_shared.so (__gxx_personality_v0+135) (BuildId: de4901415b117d03796c38214752f9d82ebc73ca)
DEBUG                   crash_dump64    A        #07 pc 00000000002297f6  /data/app/~~VGA8TIIdMXYi2Mi8ZFWymg==/com.test_app-EgYAVGnhc6rmjl8VaolNPg==/lib/x86_64/libmapbox-maps.so (BuildId: db190a827351d622)
DEBUG                   crash_dump64    A        #08 pc 0000000000229c5f  /data/app/~~VGA8TIIdMXYi2Mi8ZFWymg==/com.test_app-EgYAVGnhc6rmjl8VaolNPg==/lib/x86_64/libmapbox-maps.so (BuildId: db190a827351d622)
DEBUG                   crash_dump64    A        #09 pc 000000000053bf66  /data/app/~~VGA8TIIdMXYi2Mi8ZFWymg==/com.test_app-EgYAVGnhc6rmjl8VaolNPg==/lib/x86_64/libmapbox-maps.so (BuildId: db190a827351d622)
DEBUG                   crash_dump64    A        #10 pc 000000000053f018  /data/app/~~VGA8TIIdMXYi2Mi8ZFWymg==/com.test_app-EgYAVGnhc6rmjl8VaolNPg==/lib/x86_64/libmapbox-maps.so (BuildId: db190a827351d622)
DEBUG                   crash_dump64    A        #11 pc 000000000053ed1a  /data/app/~~VGA8TIIdMXYi2Mi8ZFWymg==/com.test_app-EgYAVGnhc6rmjl8VaolNPg==/lib/x86_64/libmapbox-maps.so (BuildId: db190a827351d622)
DEBUG                   crash_dump64    A        #12 pc 00000000003472fc  /data/app/~~VGA8TIIdMXYi2Mi8ZFWymg==/com.test_app-EgYAVGnhc6rmjl8VaolNPg==/lib/x86_64/libmapbox-maps.so (BuildId: db190a827351d622)
DEBUG                   crash_dump64    A        #13 pc 000000000037ff3e  /data/app/~~VGA8TIIdMXYi2Mi8ZFWymg==/com.test_app-EgYAVGnhc6rmjl8VaolNPg==/lib/x86_64/libmapbox-maps.so (BuildId: db190a827351d622)
DEBUG                   crash_dump64    A        #14 pc 00000000003afc60  /data/app/~~VGA8TIIdMXYi2Mi8ZFWymg==/com.test_app-EgYAVGnhc6rmjl8VaolNPg==/lib/x86_64/libmapbox-maps.so (BuildId: db190a827351d622)
DEBUG                   crash_dump64    A        #15 pc 0000000000376d49  /data/app/~~VGA8TIIdMXYi2Mi8ZFWymg==/com.test_app-EgYAVGnhc6rmjl8VaolNPg==/lib/x86_64/libmapbox-maps.so (BuildId: db190a827351d622)
DEBUG                   crash_dump64    A        #16 pc 00000000002a1443  /data/app/~~VGA8TIIdMXYi2Mi8ZFWymg==/com.test_app-EgYAVGnhc6rmjl8VaolNPg==/lib/x86_64/libmapbox-maps.so (BuildId: db190a827351d622)
DEBUG                   crash_dump64    A        #17 pc 000000000029c230  /data/app/~~VGA8TIIdMXYi2Mi8ZFWymg==/com.test_app-EgYAVGnhc6rmjl8VaolNPg==/lib/x86_64/libmapbox-maps.so (BuildId: db190a827351d622)
DEBUG                   crash_dump64    A        #18 pc 000000000025b27e  /data/app/~~VGA8TIIdMXYi2Mi8ZFWymg==/com.test_app-EgYAVGnhc6rmjl8VaolNPg==/lib/x86_64/libmapbox-maps.so (BuildId: db190a827351d622)
ActivityTaskManager     system_server   W    Force finishing activity com.test_app/.MainActivity