APSL / react-native-keyboard-aware-scroll-view

A ScrollView component that handles keyboard appearance and automatically scrolls to focused TextInput.
MIT License
5.24k stars 643 forks source link

Using Animated.ScrollView with listenToKeyboardEvents #573

Closed zgordon02 closed 8 months ago

zgordon02 commented 8 months ago

I am trying to use Animated.ScrollView alongside this package. I tried to do this to no avail. With my code, a traditional ScrollView does indeed work, so I can confidently say that this is an issue with the package's compatibility with an animated component.

import { Animated, ScrollView } from 'react-native';
// import Animated from 'react-native-reanimated'; <- what I want to do, but for demonstration purposes showing that RN's Animated component does not work

  const KeyboardAwareAnimatedScrollView = listenToKeyboardEvents( // DOES NOT WORK
    Animated.ScrollView
  );
  const KeyboardAwareAnimatedScrollView = listenToKeyboardEvents( // WORKS
   ScrollView
  );

return (
    <KeyboardAwareAnimatedScrollView
    // ...

Here is the warning I'm getting. Does anyone have insight as to what's going on?

Screenshot 2023-10-26 at 4 27 26 PM

zgordon02 commented 8 months ago

Well this is interesting. I tried this from the docs and it appears to be working now.

  const KeyboardAwareAnimatedScrollView = listenToKeyboardEvents({})(
    Animated.ScrollView
  );