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

SwipeAction where an action opens a popup disallows clicking its child #5655

Open
yergom opened this issue Sep 12, 2022 · 4 comments
Open

SwipeAction where an action opens a popup disallows clicking its child #5655

yergom opened this issue Sep 12, 2022 · 4 comments
Labels

Comments

@yergom
Copy link

yergom commented Sep 12, 2022

Version of antd-mobile

5.22.0

Operating system and its version

iOS, Android, Others

Browser and its version

No response

Sandbox to reproduce

https://codesandbox.io/s/mobile-antd-swipearea-popup-v6b5zu?file=/src/App.tsx

What happened?

The example is a simple modification from the SwipeAction demo in the official documentation. Instead of opening a Modal, I open a Popup. After the popup is closed, I would have expected that the List.Item is clickable. However, it is not! the user has to click somewhere outside the List.Item (or slide it again) to be able to click on it.

I've researched a bit what's going on. The problematic part is somewhere around here. This line calculates the pointer-events css property. Somehow, in the presence of a popup, react-spring in not updating the dom element of that animated.div.

Relevant log output

No response

@yergom yergom added the bug label Sep 12, 2022
@miracles1919
Copy link
Contributor

I tried it out and found the problematic part is

<SwipeAction
  ref={ref}
  rightActions={[
  {
    onClick: () => {
     ref.current?.close();
+    setVisible(true);
    }
  }
  ]}
 >

animated.div is not update when use setState

@awmleer
Copy link
Member

awmleer commented Sep 14, 2022

This is probably a bug of react-spring. We'll forward an issue to them.

@iamppz
Copy link

iamppz commented Apr 21, 2023

The problem still exists, here is my workaround:

setVisible(false);
const contents = document.querySelectorAll(
  ".adm-swipe-action-content"
) as any[];
contents.forEach((content) => {
  content.firstChild.style.pointerEvents = null;
});

@WE5T3
Copy link

WE5T3 commented Jul 25, 2024

The problem still exists, here is my workaround:

setVisible(false);
const contents = document.querySelectorAll(
  ".adm-swipe-action-content"
) as any[];
contents.forEach((content) => {
  content.firstChild.style.pointerEvents = null;
});

This solution works, thanks so much

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

No branches or pull requests

5 participants