maplibre-react-native icon indicating copy to clipboard operation
maplibre-react-native copied to clipboard

MarkerView containing Pressable not working reliably on Android

Open josh-gosling opened this issue 2 months ago • 1 comments

Describe and reproduce the Bug

Hi, thanks for the work put into this library.

Pressing a <Pressable> within a parent <MarkerView> consistently results in the onPress not firing on Android.

Expected behaviour: onPress behaviour happens consistently with every press. This behaviour works fully on iOS.

Actual behaviour: onPress very rarely fires after pressing on Android. Very rarely it does work as expected.

Note that this behaviour works as expected using the Android emulator; it's only on physical devices that it happens.

Minimum reproducible example:

import {MapView, MarkerView} from "@maplibre/maplibre-react-native";
import {Alert, Pressable} from "react-native";

export default function BugReport() {
    return (
        <MapView style={{flex: 1}}>
            <MarkerView coordinate={[0, 0]}>
                <Pressable
                    style={{width: 200, height: 200, backgroundColor: "#004225"}}
                    android_ripple={{color: "#fff3"}}
                    onPress={() => {
                        console.log("Press registered");
                        Alert.alert("Test alert title", "Test alert body");
                    }}
                ></Pressable>
            </MarkerView>
        </MapView>
    );
}

@maplibre/maplibre-react-native Version

10.1.4

Which platforms does this occur on?

Android Device

Which frameworks does this occur on?

Expo

Which architectures does this occur on?

New Architecture

Environment

expo-env-info 2.0.7 environment info:
    System:
      OS: macOS 15.6.1
      Shell: 5.9 - /bin/zsh
    Binaries:
      Node: 22.14.0 - ~/.nvm/versions/node/v22.14.0/bin/node
      Yarn: 1.22.22 - /opt/homebrew/bin/yarn
      npm: 10.9.2 - ~/.nvm/versions/node/v22.14.0/bin/npm
      Watchman: 2025.04.28.00 - /opt/homebrew/bin/watchman
    Managers:
      CocoaPods: 1.16.2 - /opt/homebrew/bin/pod
    SDKs:
      iOS SDK:
        Platforms: DriverKit 24.4, iOS 18.4, macOS 15.4, tvOS 18.4, visionOS 2.4, watchOS 11.4
    IDEs:
      Android Studio: 2024.1 AI-241.18034.62.2412.12266719
      Xcode: 16.3/16E140 - /usr/bin/xcodebuild
    npmPackages:
      expo: ^53.0.19 => 53.0.19 
      expo-router: ~5.1.3 => 5.1.3 
      react: 19.0.0 => 19.0.0 
      react-dom: 19.0.0 => 19.0.0 
      react-native: 0.79.5 => 0.79.5 
    Expo Workflow: bare

josh-gosling avatar Sep 18 '25 09:09 josh-gosling

Using onPressIn instead is a possible workaround for this.

josh-gosling avatar Sep 18 '25 14:09 josh-gosling