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.

onPress not detected on position: absolute element inside Menu's anchor property

See original GitHub issue

OnPress not working on position absolute element inside Menu anchor

image

I have a FAB button(the purple button in the image above with the horizontal menu icon) that has a position: absolute and it is inside a Menu element. The onPress event is not triggered when it is inside the Menu’s anchor property. If I change the FAB’s position to relative then the onPress events are triggered.

Code

<Menu
    visible={this.state.profile_edit_menu_visible}
    onDismiss={this._dismissProfileMenu}
    anchor={
        <FAB
            icon="dots-vertical"
            color="#FFFFFF"
            small
            style={styles.infoBtn}
            onPress={() => {
            console.log("Pressed...");
            this._showProfileMenu();
            }}
        />
    }
>
    <Menu.Item ... />
    <Menu.Item ... />
</Menu>

I am not able to get this working in any way. I don’t want to change it to a normal button, so appreciate any workarounds and suggestions. Thanks

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7

github_iconTop GitHub Comments

2reactions
jdbarrascommented, Nov 22, 2020

Very late to this, but I wrapped my entire Menu in a View and gave the View absolute positioning and it fixed this for me.

2reactions
ramazan-sambaposcommented, Oct 22, 2020

Hi I solved my problem, are you trying to change the z-index property of its FAB?

Read more comments on GitHub >

github_iconTop Results From Across the Web

when div with absolute position is added cannot click on links
As The Div is absolutely positioned over the links and hence it is not allowing clickability. #left_border { background-image: url(http://tax.
Read more >
Position element at the bottom of the screen using Flexbox in ...
In this post, we go from absolute position to another container, get to know flex , how to add reusable function and how...
Read more >
Menu · React Native Paper
Menus display a list of choices on temporary elevated surfaces. Their placement varies based on the element that opens them.
Read more >
Controlling tooltips & pop-up menus with components in React
Use compound components to control tooltips and pop-up menus in your React ... Position the tooltip relative to the selected element; Detect ......
Read more >
CSS Z-Index Not Working? How to Fix It Using Stack Order
The z-index property of CSS is a tricky one. It won't work easily by itself if you don't know how to use it...
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