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

[v5] onScroll event handler of BottomSheetScrollView ignored on Web #1742

Closed
jer-sen opened this issue Feb 16, 2024 · 2 comments
Closed

[v5] onScroll event handler of BottomSheetScrollView ignored on Web #1742

jer-sen opened this issue Feb 16, 2024 · 2 comments
Labels
bug Something isn't working no-issue-activity

Comments

@jer-sen
Copy link

jer-sen commented Feb 16, 2024

Bug

On Web, a handler passed to onScroll props of BottomSheetScrollView is never called.
Indeed, undefined is passed to React Native original component through scrollHandler here:

This patch should be applied, tested successfully on my side:

@@ -3,7 +3,9 @@ import { useSharedValue } from 'react-native-reanimated';
 import { useBottomSheetInternal } from './useBottomSheetInternal';
 import { ANIMATION_STATE, SCROLLABLE_STATE } from '../constants';
 import { getRefNativeTag } from '../utilities/getRefNativeTag';
-export const useScrollHandler = () => {
+
+// We add onScroll handler otherwise lost on Web
+export const useScrollHandler = (_, onScroll) => {
   //#region refs
   const scrollableRef = useRef();
   //#endregion
@@ -107,7 +109,7 @@ export const useScrollHandler = () => {
   //#endregion
 
   return {
-    scrollHandler: undefined,
+    scrollHandler: onScroll,
     scrollableRef,
     scrollableContentOffsetY
   };

Environment info

Library Version
@gorhom/bottom-sheet 5.0.0-alpha.6
react-native 0.72.6
react-native-reanimated 3.3.0
react-native-gesture-handler 2.12.1

Steps To Reproduce

Cf bug section

Reproducible sample code

Cf bug section

@jer-sen jer-sen added the bug Something isn't working label Feb 16, 2024
Copy link

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

Copy link

This issue was closed because it has been stalled for 5 days with no activity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working no-issue-activity
Projects
None yet
Development

No branches or pull requests

1 participant