question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Items are not clickable over a MapView (Android)

See original GitHub issue

I am using the expo-managed workflow, and I would need to use the dropdown at the top part of a screen view, and below I have a MapView (react-native-maps).

After opening the dropdown, items over the MapView are not clickable.

https://user-images.githubusercontent.com/48277672/120935627-043f8380-c704-11eb-9d7f-a020753d335d.mp4

I tried to write a simple code snippet in order to make it easily replicable:

import React, { useState } from "react";
import { StyleSheet, View } from "react-native";
import DropDownPicker from "react-native-dropdown-picker";
import MapView from "react-native-maps";

export default function App() {
    const [open, setOpen] = useState(false);
    const [value, setValue] = useState(null);
    const [items, setItems] = useState([
        { label: "Apple", value: "apple" },
        { label: "Banana", value: "banana" },
    ]);

    return (
        <View style={styles.container}>
            <View style={styles.top}>
                <DropDownPicker
                    open={open}
                    value={value}
                    items={items}
                    setOpen={setOpen}
                    setValue={setValue}
                    setItems={setItems}
                    zIndex={1000}
                />
            </View>

            <MapView style={styles.map}></MapView>
        </View>
    );
}

const styles = StyleSheet.create({
    container: {
        flex: 1,
        flexDirection: "column",
        backgroundColor: "yellow",
    },
    top: {
        flexDirection: "column",
        marginTop: 40,
        height: 70,
        zIndex: 10,
    },
    map: {
        flex: 1,
        zIndex: 0,
    },
});

The same code is working perfectly on iOS.

I would appreciate it if you have some suggestions, thank you in advance!

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:2
  • Comments:20 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
losheredoscommented, Sep 3, 2021

@sibandrew you can check this package as well, at least it solved my issues which is similar to yours. I tried few but this one looks easiest to use for now.

https://github.com/sohobloo/react-native-modal-dropdown

1reaction
mohammadrahmaniancommented, Jun 9, 2021

I’m using this dropdown picker inside a modal and I have the exact same issue. I’ve removed the zIndex for android devices but I still can’t select any items from the dropdown list. this is the code from my custom styles related to the zIndex: ...(Platform.OS !== 'android' && { zIndex: 11 }),

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using a non clickable MapView - android - Stack Overflow
When you set clickable(false) you can't use onClick , when you set clickable(true) then onTouch will take focus. So, override onTouch and then...
Read more >
Events | Maps SDK for Android - Google Developers
To disable click events on a map in lite mode, call setClickable() on the view that contains the MapView or MapFragment . This...
Read more >
Showing panel on top of map - panel not clickable on android
1.- click on the top panel to show the bottom panel (check that it moves overlaying the bottom bar) · 2.- click on...
Read more >
[Solved]-Android MapView in fragment freeze (not clickable or ...
Coding example for the question Android MapView in fragment freeze (not clickable or dragable) after initialisation-Googlemaps.
Read more >
Android: MapView.Callout - seems to be clickable with touch ...
Android : MapView. ... On iOS, touchable elements inside a custom callout work fine. ... On Android, the callout layout is not right....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found