react / react/react-native

Flatlist onMomentumScrollEnd called inconsistently between Android and iOS

Đang mở
#48,423 8 bình luận 4 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Needs: Triage :mag: Platform: Android Platform: iOS
Ngôn ngữ chính
C++
Star
127k
Fork
25.3k
Merge trung bình
1 ngày 23 giờ
Pull request đã merge (30 ngày)
4

Mô tả

Description

it seems the behavior isn't consistent between android and ios.

on android it works when you flick and release, it also works when you scroll and hold thereby controlling the scrolling.

on IOS it only works when you flick and let the scroll momentum end by itself.

https://reactnative.dev/docs/scrollview#onmomentumscrollend
Called when the momentum scroll ends (scroll which occurs as the ScrollView glides to a stop).
in this case, i believe it means the behavior is incorrect on Android because it's called when it glides to a stop and when the user controls the stop.
or since there's no specific event for when both the scroll and glide are ended by the user controlling it, we should fix the behavior on iOS to behave the same on Android and update the docs to Called when the momentum scroll ends (scroll which occurs as the ScrollView stops).

Steps to reproduce
  1. android: flick and release -> momentum end event called
  2. android: scroll and hold at one position then release -> momentum end event called
  3. ios: flick and release -> momentum end event called
  4. ios: scroll via scrollbar, hold then release -> momentum end event is called
  5. ios: flick and release via scrollbar -> momentum end event is called
  6. ios: scroll, hold at one position then release -> momentum end event is not called
React Native Version

0.76.5

Same behavior on both the new and old architecture

Affected Platforms

Runtime - Android, Runtime - iOS

Output of npx react-native info
expo-env-info 1.2.1 environment info:
    System:
      OS: macOS 14.3.1
      Shell: 5.9 - /bin/zsh
    Binaries:
      Node: 20.18.0 - ~/.nvm/versions/node/v20.18.0/bin/node
      Yarn: 1.22.22 - ~/.nvm/versions/node/v20.18.0/bin/yarn
      npm: 10.8.2 - ~/.nvm/versions/node/v20.18.0/bin/npm
    Managers:
      CocoaPods: 1.16.2 - /opt/homebrew/bin/pod
    SDKs:
      iOS SDK:
        Platforms: DriverKit 23.2, iOS 17.2, macOS 14.2, tvOS 17.2, visionOS 1.0, watchOS 10.2
    IDEs:
      Android Studio: 2022.3 AI-223.8836.35.2231.11090377
      Xcode: 15.2/15C500b - /usr/bin/xcodebuild
    npmPackages:
      expo: ~52.0.23 => 52.0.23 
      expo-router: ~4.0.15 => 4.0.15 
      react: 18.3.1 => 18.3.1 
      react-dom: 18.3.1 => 18.3.1 
      react-native: 0.76.5 => 0.76.5 
      react-native-web: ~0.19.13 => 0.19.13 
    npmGlobalPackages:
      eas-cli: 13.4.2
    Expo Workflow: managed
Stacktrace or Logs
no errors, just inconsistent behavior
Reproducer

https://snack.expo.dev/@hichemfa/onmomentumscrollend-example

Screenshots and Videos

Android:

https://github.com/user-attachments/assets/706f34b0-c19c-49c2-887c-d035d2119fee

iOS:

https://github.com/user-attachments/assets/9a0cafe0-7370-4359-bd63-4dcc16cb9a51

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Bắt đầu với trình tái hiện Snack được liên kết và tài liệu về ScrollView và onMomentumScrollEnd, sau đó so sánh sáu bước tái hiện trên Android và iOS. Xác định hành vi nào của nền tảng là đúng theo chủ đích và xác minh kết quả trên cả kiến trúc mới lẫn cũ. Công việc được coi là hoàn tất khi hành vi của sự kiện nhất quán với ngữ nghĩa đã thống nhất và tài liệu mô tả chính xác hành vi đó.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
android, ios, react-native
Lĩnh vực
mobile
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Ít trao đổi
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
48/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.