react-native-maps: Android callouts are cut off and do not show content

Summary

Callout text and media on Android are cut off, and do not display. Styling changes do not affect how it displays.

Reproducible sample code

import React from "react"
import MapView, { Marker,Callout } from 'react-native-maps';
import { Text, View } from 'react-native';

export default function MyMap() {
   return (
      <MapView
        style={{
            width: '100%',
            height: '100%',
          
        }}
        initialRegion={{
          latitude: 41.8781,
          longitude: -87.6298,
          latitudeDelta: 0.0922,
          longitudeDelta: 0.0421,
        }}
      >
        <Marker
            key={1}
            coordinate={{
                "latitude": 41.884782,
                "longitude": -87.624961
            }}
          >
              <Callout>
                  <View><Text>Some text here</Text></View>
              </Callout>
          </Marker>
      </MapView>
    )
}

Steps to reproduce

Run example on Expo SDK 52.0.6 with react-native-maps version 1.18.0 (latest recommended Expo version).

View on Android, and see callout as screenshotted below.

Expected result

Callout should show text content.

Actual result

Screenshot_20241114_163512_Expo Go

See screenshot. Top is cut off of callout.

React Native Maps Version

1.18.0

What platforms are you seeing the problem on?

Android

React Native Version

0.76.1

What version of Expo are you using?

Not using Expo

Device(s)

Samsung A15 5G

Additional information

This was not happening before updating to Expo SDK 52.

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Reactions: 33
  • Comments: 51

Most upvoted comments

This has been fixed in the alpha release, will be merged into master later, but it will require Fabric to be enabled / new arch

This is one of Maps’ critical functionalities. It would be helpful if it could be prioritized.

Hey Folks,

In your android/gradle.properties, chnage newArchEnabled=true to newArchEnabled=false. It will fix this for now. I tested on 0.76.3. Thank me later ! 😀

This is one of Maps’ critical functionalities. It would be helpful if it could be prioritized.

This is one of Maps’ critical functionalities. It would be helpful if it could be prioritized.

Hey Folks,

In your android/gradle.properties, chnage newArchEnabled=true to newArchEnabled=false. It will fix this for now. I tested on 0.76.3. Thank me later ! 😀

This is the correct solution , if you are looking a way to go through this issue without downgrading the react native version. This worked for me.

The version 1.23.8 throws another error ERROR Invariant Violation: TurboModuleRegistry.getEnforcing(…): ‘RNMapsAirModule’ could not be found. Verify that a module by this name is registered in the native binary., js engine: hermes

because of the versions Im using it means it does not allow me to use anything more than 1.20

That seems like a huge issue. I don’t really want to downgrade the react native version. I’ll probably try to find a workaround or build my own solution

import MapView, { Callout, Marker, PROVIDER_GOOGLE } from ‘react-native-maps’; import React, { useState } from ‘react’;

import { StyleSheet, Text, View, Dimensions, TouchableOpacity, } from ‘react-native’;

export default function App() { const [mapLat, setMapLat] = useState(6.841776681); const [mapLong, setMapLong] = useState(79.869319); const locationData = [ { latitude: 6.841776681, longitude: 79.869319 ,weight:1,}, { latitude: 6.84076664, longitude: 79.871323 ,weight:2,}, ]; return ( <View style={styles.container}> <MapView style={styles.map} initialRegion={{ latitude: mapLat, longitude: mapLong, latitudeDelta: 0.0922, longitudeDelta: 0.0421, }}> {locationData.map((data, index) => ( <Marker key={index} coordinate={{ latitude: data.latitude, longitude: data.longitude, }} title={Marker ${index + 1}} description={Weight: ${data.weight}} onPress={() => { alert(data.weight); }} tracksViewChanges={true} > <TouchableOpacity style={{

           //borderRadius: 15,
            elevation: 2,
           borderWidth: 1.0,
            borderColor: 'gray',
    
          
          }}>
          <Text
           
           >
         { "custom text"}
          </Text>
        </TouchableOpacity>
      </Marker>
    ))}
  </MapView>
</View>

); }

const styles = StyleSheet.create({ container: { flex: 1, backgroundColor: ‘#fff’, alignItems: ‘center’, justifyContent: ‘center’, }, map: { width: Dimensions.get(‘window’).width, height: Dimensions.get(‘window’).height, }, }); but cant style the touchable opacity Image

🚨 SAME ISSUE 🚨

  • “expo”: “^52.0.17”
  • “react-native”: “0.76.3”,
  • “react-native-maps”: “1.18.0”,

image

What solutions or workarounds you are using guys without downgrading?

the @ChanuPerera solution works for me, on android change the gradle.properties -> newArchEnabled=false, and on iOS Podfile.properties.json -> “newArchEnabled”: “false”, I also change the app.json -> “newArchEnabled”: false, because if I need to make a prebuild it will works too.

What solutions or workarounds you are using guys without downgrading?

Is there a way to fix it without changing the new architecture flag?

I also tried several solutions (except downgrading) but none of them seemed to work. Becuase there probably won’t be a fix to this in the near future and it’ll take even more time until this fix is in the recommended version for Expo, I came up with a solution for myself (@i-umayr ).

I have already added a bottom sheet that displays the same data as my map, so I linked the map to the bottom sheet and the FlatList inside that bottom sheet, to achieve the following behavoir:

If a user klicks on a marker:

  • The bottomsheet get’s opened to take up some space at the bottom of the screen
  • The FlatList get’s scrolled to the related item
  • The item get’s highlighted with a pulsing background

I know this is a “fix” that only fits my specific needs, but I guess this works for me. I might even like it a bit more than using the normal Callouts.

https://github.com/user-attachments/assets/8af64c76-ae1e-4104-8b75-6d6cd2180e99