You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With the code below I'm getting multiple onPress invocations when scrolling in the list.
It only seems to happen when the list is short enough to fit on one screen. If I include all 13 items the issue goes away and an actual click/press is required to fire the onPress event, and it's only fired once.
Here's a video of the behavior I'm seeing. Look at all those console logs. Especially the last one is weird. It keeps invoking onPress even after I stop scrolling. And I've seen that behavior many times by now
I expect scrolling to do nothing when the list is short enough to not require any scrolling to display all items. No onPress actions should be fired when scrolling
To Reproduce
Run the code above and scroll in the list.
So far I've only tried to reproduce this in an Android Emulator.
I'm using expo and it seems to happen both with Expo Go and with a proper dev build of the app.
The behavior is the same both with new and old architecture
I'm scrolling using a two-finger gesture on my touchpad.
Platform:
iOS
Android
Environment
1.7.1
The text was updated successfully, but these errors were encountered:
Workaround for now (still only tested in the Android emulator)
// Keep these outside the component so we can track clicks across all list// itemsletclickCount=0;letclickTime=0;exportconstSingleItem=({ item }: SingleItemProps)=>{constrouter=useRouter();return(<PressableonPressIn={()=>{if(Date.now()-clickTime>500){clickCount=0;}clickTime=Date.now();clickCount++;}}onPressOut={()=>{if(clickCount!==1){return;}router.push({pathname: LINKS.MY_SINGLE_ITEM,params: {id: item.id},});}}>
// ... etc
Current behavior
With the code below I'm getting multiple
onPress
invocations when scrolling in the list.It only seems to happen when the list is short enough to fit on one screen. If I include all 13 items the issue goes away and an actual click/press is required to fire the
onPress
event, and it's only fired once.Here's a video of the behavior I'm seeing. Look at all those console logs. Especially the last one is weird. It keeps invoking
onPress
even after I stop scrolling. And I've seen that behavior many times by nowScreen.Recording.2025-01-03.at.23.14.22.mov
Expected behavior
I expect scrolling to do nothing when the list is short enough to not require any scrolling to display all items. No
onPress
actions should be fired when scrollingTo Reproduce
Run the code above and scroll in the list.
So far I've only tried to reproduce this in an Android Emulator.
I'm using expo and it seems to happen both with Expo Go and with a proper dev build of the app.
The behavior is the same both with new and old architecture
I'm scrolling using a two-finger gesture on my touchpad.
Platform:
Environment
1.7.1
The text was updated successfully, but these errors were encountered: