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

[BUG] - DropdownItem Events onPress doesn't work #2923

Closed
ayushkavad opened this issue May 1, 2024 · 3 comments
Closed

[BUG] - DropdownItem Events onPress doesn't work #2923

ayushkavad opened this issue May 1, 2024 · 3 comments

Comments

@ayushkavad
Copy link

ayushkavad commented May 1, 2024

NextUI Version

2.3.6

Describe the bug

I have one Dropdown component with one item logout, I want to run a function and log string when i click on logout, I used one of DropdownItem event onClick and pass anonymous function that log string but it doesn't show me anything on console when i click on logout. I have also read the documentation there were also mention one thing that onClick is Deprecated use onPress insted but this also give me the same result.

 <Dropdown placement="bottom-end">
        <DropdownTrigger>
             <Avatar
                  isBordered
                  as="button"
                  className="transition-transform"
                  src="https://i.pravatar.cc/150?u=a042581f4e29026704d"
              />
        </DropdownTrigger>
        <DropdownMenu aria-label="Profile Actions" variant="flat">
            <DropdownItem key="profile" className="h-14 gap-2">
                 <p className="font-semibold">Signed in as</p>
                 <p className="font-semibold">[email protected]</p>
            </DropdownItem>
            <DropdownItem key="settings">My Settings</DropdownItem>
            <DropdownItem key="team_settings">Team Settings</DropdownItem>
            <DropdownItem key="analytics">Analytics</DropdownItem>
            <DropdownItem key="system">System</DropdownItem>
            <DropdownItem key="configurations">
                    Configurations
            </DropdownItem>
            <DropdownItem key="help_and_feedback">
                    Help & Feedback
            </DropdownItem>
            <DropdownItem
                 key="logout"
                 color="danger"
                 onClick={() => {
                    console.log('hhh');
                 }}
                  >
                    Log Out
           </DropdownItem>
      </DropdownMenu>
</Dropdown>

Your Example Website or App

No response

Steps to Reproduce the Bug or Issue

Click on logout

Expected behavior

it should log "hhh" string

Screenshots or Videos

No response

Operating System Version

linux

Browser

Chrome

Copy link

linear bot commented May 1, 2024

@wingkwong
Copy link
Member

I couldn't reproduce the issue.

image

Maybe you can check if you have disabled the info log.

image

@wingkwong
Copy link
Member

Closing due to inactivity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants