Skip to content

fix(topic-list): Android topics list pin button unresponsive + add pin/unpin reorder animation - #462

Open
chengcheng84 wants to merge 3 commits into
CherryHQ:v0.2from
chengcheng84:fix/android-pin-button-animation
Open

fix(topic-list): Android topics list pin button unresponsive + add pin/unpin reorder animation#462
chengcheng84 wants to merge 3 commits into
CherryHQ:v0.2from
chengcheng84:fix/android-pin-button-animation

Conversation

@chengcheng84

Copy link
Copy Markdown
Contributor

Changes

Fix: Pin button on Android (TopicPinAction)

  • Replace Pressable from react-native with RectButton from
    react-native-gesture-handler. RectButton registers a native gesture
    handler that correctly negotiates priority with the parent
    PanGestureHandler within the same gesture system, so taps are delivered
    reliably.

Animation: Pin/unpin reorder

  • Switch from LegendList (@legendapp/list/react-native) to
    AnimatedLegendList (@legendapp/list/reanimated) — the reanimated
    variant supports itemLayoutAnimation.
  • Add itemLayoutAnimation={LinearTransition.duration(280)} so pinned
    topics animate smoothly to the top section and unpinned topics animate
    back to the chronological list, with surrounding items easing into their
    new positions.

…n/unpin reorder animation

- Replace react-native Pressable with RNGH RectButton in TopicPinAction to
  prevent Pan gesture from intercepting touches on Android
- Use AnimatedLegendList from @legendapp/list/reanimated with
  itemLayoutAnimation={LinearTransition.duration(280)} for smooth
  pin/unpin reorder animation
…s for Jest

- Mock @legendapp/list/reanimated with AnimatedLegendList
- Mock react-native-gesture-handler with Gesture, GestureDetector, RectButton
- Add LinearTransition to react-native-reanimated mock
@eeee0717

Copy link
Copy Markdown
Collaborator

I dug into the left/right asymmetry, and I don't think the parent PanGestureHandler is the underlying cause here.

This project is using react-native-gesture-handler@2.32.0. In that version, ReanimatedSwipeable renders both action containers with StyleSheet.absoluteFill; the right-actions container is rendered after the left-actions container, so it sits above it in z-order. When inactive, an action container is only changed to opacity: 0. On Android, an opacity-zero view can still receive touches. The hidden right-actions container therefore covers the visible left Pin action, while the right Rename/Delete actions remain clickable because their container is already on top. This explains the stable direction-specific behavior more precisely than a general Pan/Pressable gesture race.

This is the upstream issue reported in software-mansion/react-native-gesture-handler#3223 and fixed by #4192. The upstream fix disables pointer events on whichever action container is hidden:

pointerEvents: showLeftProgress.value === 0 ? 'none' : 'auto'
pointerEvents: showRightProgress.value === 0 ? 'none' : 'auto'

Expo SDK 57 currently expects RNGH ~2.32.0, and this repository already uses pnpm.patchedDependencies. I recommend backporting #4192 as a pnpm patch and keeping the existing React Native Pressable, rather than changing only the Pin action to RectButton. RectButton may work around the event delivery, but it does not address the overlapping hidden container that causes the bug.

The AnimatedLegendList/LinearTransition change is independent of the click fix and can remain if the reorder animation is desired, ideally treated separately. Also, the current Jest mock invokes only renderLeftActions and never renders the overlapping renderRightActions, so the passing test verifies the Pin callback but does not provide regression coverage for this Android hit-testing bug.

@chengcheng84
chengcheng84 force-pushed the fix/android-pin-button-animation branch from 1168610 to d6c7f75 Compare July 25, 2026 10:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants