davidgalindo / react-native-arcgis-mapview

A basic ArcGIS port for React Native.
MIT License
48 stars 24 forks source link

App Crashes when map view is unmounted. #11

Open OsamaMukhtar opened 4 years ago

OsamaMukhtar commented 4 years ago

After successfully displaying map, when I press back the app crashes in the ComponentWillUnmount function of the mapView saying 'args' is undefined. Here is my code :

export default function MapScreen() {
  const mapView = useRef();
  return (
    <SafeAreaView style={styles.containerStyle}>
      <ArcGISMapView ref={mapView} style={{width: '100%', height: '100%'}}
          initialMapCenter={[{latitude: 34.055561, longitude: -117.182602}]}
          recenterIfGraphicTapped={true}
          rotationEnabled={false}
          mapBasemap={ { type: 'normal' } }
      />
    </SafeAreaView>
  );
}

Simulator Screen Shot - iPhone X - 2020-06-19 at 15 31 12

OsamaMukhtar commented 4 years ago

This is where it crashes:

componentWillUnmount() {
    UIManager.dispatchViewManagerCommand(
      findNodeHandle(this.agsMapRef),
      UIManager.getViewManagerConfig('RNArcGISMapView').Commands.dispose,
      [args]
    );
  }
Ma2iio commented 4 years ago

This is where it crashes:

componentWillUnmount() {
    UIManager.dispatchViewManagerCommand(
      findNodeHandle(this.agsMapRef),
      UIManager.getViewManagerConfig('RNArcGISMapView').Commands.dispose,
      [args]
    );
  }

Can you solve it?

Ma2iio commented 4 years ago

@OsamaMukhtar You can remove "args" and using patch-package for another developer.