Skip to content

onScroll on KeyboardAwareScrollView is not fired #337

Closed
@kirillzyusko

Description

@kirillzyusko

Describe the bug

onScroll on KeyboardAwareScrollView is not fired

Code snippet

Just add onScroll={console.log} in example app.

Repo for reproducing

You can use example app.

To Reproduce
Steps to reproduce the behavior:

  1. Go to KeyboardAwareScrollView
  2. Scroll view
  3. See console output

Expected behavior

You should see events if you scroll ScrollView.

Smartphone (please complete the following information):

  • Desktop OS: MacOS 14.2.1
  • Device: iPhone 15 Pro
  • OS: iOS 15.2
  • RN version: 0.72.4
  • RN architecture: old
  • JS engine: Hermes
  • Library version: 1.10.2

Additional context

It can be fixed by adding next code into onScroll handler:

const onScroll = useAnimatedScrollHandler(
    {
      onScroll: (e) => {
        position.value = e.contentOffset.y;

+        if (onScrollProp) {
+          runOnJS(onScrollProp)({ nativeEvent: e });
+        }
      },
    },
    [],
  );

or assign our onScroll handler as onScrollReanimated (REA intercept all events for a given view, so there is no difference which prop to use).

Metadata

Metadata

Assignees

Labels

KeyboardAwareScrollView 📜Anything related to KeyboardAwareScrollView component🐛 bugSomething isn't working📚 componentsAnything related to the exported components of this library

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions