react-native-maps: Callout causing full app crash
Summary
The Callout component is causing a full app crash. I have verified that this happens on ios, but if I set the width to anything over 316 the app fully crashes. The simulator I am using is an iPhone 14. The width in pixels according to useWindowDimensions was 390.
I was modifying the simple callout example when I ran into this. The only change was inline and the width changed to 317. <Callout style={{ width: 317 }}> <View> <Text>This is a plain view</Text> </View> </Callout>
these are the versions. “react”: “18.2.0”, “react-native”: “0.71.3”, “react-native-map-clustering”: “^3.4.2”, “react-native-maps”: “^1.4.0”,
Reproducible sample code
import React, { ReactElement, useRef, useState } from 'react';
import {
Callout,
MapViewProps,
Marker,
PROVIDER_GOOGLE,
} from 'react-native-maps';
import MapView, { MapClusteringProps } from 'react-native-map-clustering';
import { View, ViewStyle, Text } from 'react-native';
interface MapProps {
style?: ViewStyle;
mapOptions?: MapViewProps & MapClusteringProps;
}
export const Map: React.FC<MapProps> = ({ style, mapOptions }) => {
const mapRef = useRef<MapView | null>(null);
return (
<MapView
provider={PROVIDER_GOOGLE}
style={[{ width: '100%', height: '100%' }, style]}
showsUserLocation={true}
region={{
latitude: 0,
longitude: 0,
latitudeDelta: 1.0,
longitudeDelta: 1.0,
}}
ref={mapRef}
{...mapOptions}>
<Marker
onPress={e => {
e.stopPropagation();
}}
coordinate={{
latitude: 0,
longitude: 0,
}}>
<Callout style={{ width: 317 }}>
<View>
<Text>This is a plain view</Text>
</View>
</Callout>
</Marker>
</MapView>
);
};
Steps to reproduce
If you run the reproducible sample code and click the marker it will crash the app. Afterward, change the width to 316 and it works fine.
Expected result
I expect it to show the callback without the app crashing.
Actual result
App instantly crashes and I get an apple report.
React Native Maps Version
^1.4.0
What platforms are you seeing the problem on?
iOS (Google Maps)
React Native Version
0.71.3
What version of Expo are you using?
Not using Expo
Device(s)
iPhone 14 simulator
Additional information
No response
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 11
- Comments: 16
Same issue here … Really need to be fixed
I was experiencing the same issue with the app crashing when opening MapView on the iPhone 14, 14 Pro Max, Pro, and Plus. I discovered that the problem was related to the width exceeding a certain limit. While I was able to resolve it in debug mode, the issue persisted in the release version. After reviewing the documentation for react-native-maps, which outlines the parameters supported by both iOS and Android, I realized I was passing a parameter specific to Google Maps that MKMapView (iOS’s native map) does not recognize. I suggest you check whether you’re passing any unsupported parameters for MKMapView!
Here’s the link to the documentation: https://github.com/react-native-maps/react-native-maps/blob/master/docs/mapview.md
In my case width is 220 but the app is still crashing in the production. In the dev environment, it is working fine.
i am using Expo and currently having the same issue, no errors are displayed on console, the whole app just crashes
the same issue happens with width, more thant 316px causes the app to crash