kirillzyusko / react-native-keyboard-controller

Keyboard manager which works in identical way on both iOS and Android
https://kirillzyusko.github.io/react-native-keyboard-controller/
MIT License
1.58k stars 63 forks source link

Add information about useReanimatedKeyboardAnimation in installation instructions #561

Closed kapir closed 2 weeks ago

kapir commented 3 weeks ago

Is your feature request related to a problem? Please describe. We where experiencing an issue where the useAnimatedKeyboard from reanimated was reporting wrong values, usually that the height was not set to 0 after we do a heavy render while closing the keyboard.

The fix was to switch to the useReanimatedKeyboardAnimation from this library

Describe the solution you'd like As long as my assumption is right that this library is not just reexporting the useAnimatedKeyboard hook from reanimated:

We where already using reanimated when adding this library, adding that we should switch the hook would be a nice addition to the documentation.

kirillzyusko commented 3 weeks ago

Hey @kapir 👋

You are right, this library doesn't re-export useAnimatedKeyboard from reanimated 🙂

This library heavily relies on worklet/etc. concept coming from reanimated and using these concepts brings advanced tools to keyboard handling. But I'm using my own keyboard tracking solution.

Where you would like to see a note about that? And maybe you would like to see some kind of comparison between functionality of this library and hook from reanimated?

I think it would be definitely good to mention the difference between reanimated and this library 😊

kapir commented 3 weeks ago

Thank you for the for rapid response ;)

  1. Does the keyboard controller library effect the useAnimatedKeyboard hook from reanimated? The error occured after adding keyboard-controller and updating some dependencies.

  2. If yes, it could be mentioned in the installation instructions or the troubleshooting section. If no, I think it would be beneficial for the library to have a comparison with reanimated showcasing the benefits of using this instead of reanimated.

kirillzyusko commented 3 weeks ago

Does the keyboard controller library effect the useAnimatedKeyboard hook from reanimated?

@kapir on iOS both hooks from reanimated and keyboard-controller should work simultaneously. On Android I'm not sure - potentially two hooks can conflict with each other. Which platform did you test? What is the error do you see? Which keyboard-controller and reanimated version do you use?

If yes, it could be mentioned in the installation instructions or the troubleshooting section. If no, I think it would be beneficial for the library to have a comparison with reanimated showcasing the benefits of using this instead of reanimated.

Okay, cool, I'll think on how and where to add the information.

kapir commented 3 weeks ago

Hi, sorry for lack of detail.

This was on ios:

We have a screen with a textinput and some list items. Pressing the listitem opens up a "complex" navigation screen containing some nestet navigators from react-navigation. Including a tab bar, we have a custom tab bar, that we hide with the keyboard height (translating positive) so that it is hidden when keyboard is visible. The option on the react-navigation tabbar has not worked very well for us, therefore this custom solution.

The issue was that sometimes (seemingly randomly) when pressing an list item, the keyboard would close, but the tabbar would jump (maybe 50 pixels up, then down, then disappear). It disappeared because the animated keyboard height would report as if the keyboard was open. The jumping still appear but the tabbar does no longer disappear. If i would guess the reason for the jumping is that the render is a bit heavy slowing the listeners on the keyboard navigation down.

kirillzyusko commented 2 weeks ago

@kapir I updated documentation in https://github.com/kirillzyusko/react-native-keyboard-controller/pull/567

Can you check installation and comparison page?

kapir commented 2 weeks ago

This looks great, and further clarifies the differences, and the reason for it 👍

Great work 🤩

kirillzyusko commented 2 weeks ago

@kapir cool! I merged the PR! Thank you for raising this issue 🙌