Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MenuItem onPress not working on web #1431

Closed
2 of 6 tasks
mathis-kdio opened this issue Dec 3, 2023 · 5 comments
Closed
2 of 6 tasks

MenuItem onPress not working on web #1431

mathis-kdio opened this issue Dec 3, 2023 · 5 comments
Assignees
Labels
bug Something isn't working enhancement New feature or request

Comments

@mathis-kdio
Copy link

Description

The "onPress" property doesn't seem to work on the web with expo

CodeSandbox/Snack link

No response

Steps to reproduce

  1. Go to '...'
  2. Click on '...'
  3. Scroll down to '...'
  4. See error

gluestack-ui Version

1.0.19

Platform

  • Expo
  • React Native CLI
  • Next
  • Web
  • Android
  • iOS

Other Platform

No response

Additional Information

No response

@mathis-kdio mathis-kdio added the bug Something isn't working label Dec 3, 2023
@Viraj-10
Copy link
Collaborator

Viraj-10 commented Dec 4, 2023

Hey @mathis-kdio, Thanks for reporting this issue. can you please give me a your requirement? I will provide you with work around if possible for now.
In current API we have Pressable on native where as on web it implements li tag that's why onPress doesn't work on web.
We are working on new API which will bridge this gap.

@Viraj-10 Viraj-10 added the enhancement New feature or request label Dec 4, 2023
@mathis-kdio
Copy link
Author

mathis-kdio commented Dec 4, 2023

This code works well on mobile, but not on the web. I'm interested if you have a workaround.

<Menu
  placement='bottom left'
  trigger={({ ...triggerProps }) => {
    return (
      <Button {...triggerProps} bgColor='#0594ae'>
        <ButtonText>Menu</ButtonText>
      </Button>
    )
  }}
  closeOnSelect={true}
>
  <MenuItem key="Joueurs" textValue={t("liste_joueurs")} onPress={() =>  this.props.navigation.navigate('ListeJoueur')}>
    <MenuItemLabel size='sm'>{t("liste_joueurs")}</MenuItemLabel>
  </MenuItem>
</Menu>

@Viraj-10
Copy link
Collaborator

Viraj-10 commented Dec 5, 2023

Hey @mathis-kdio, you can find workaround here.

@mathis-kdio
Copy link
Author

Thank you for this workaround. I've tested it and it works well

@hamsterhomka
Copy link

Hey @mathis-kdio, you can find workaround here.

Unfortunately, it doesn't work as expected with Expo 49. The menu doesn't close when pressing on MenuItem

@Viraj-10 Viraj-10 assigned rajat693 and unassigned Viraj-10 Dec 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
No open projects
Status: Done
Development

No branches or pull requests

6 participants