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.4k stars 55 forks source link

Animations with KeyboardAwareScrollView have poor performance on iOS release #422

Closed Moreno97 closed 2 months ago

Moreno97 commented 2 months ago

Describe the bug Animations with KeyboardAwareScrollView have poor performance on iOS release.

Code snippet

    <>
      <KeyboardAwareScrollView
        testID="keyboard-aware-scroll-view"
        keyboardShouldPersistTaps="handled"
        contentContainerStyle={{
               flexGrow: 1,
               padding: 16,
               backgroundColor: 'white',
        }}
        keyboardDismissMode="on-drag"
      >
      <View style={{ flex: 1 }}
       ...
      </View>
    </>

To Reproduce Steps to reproduce the behavior: Have an input and focus. I we have some buttons at the bottom, when placing at the top, animations are laggy.

Expected behavior Animations shouldnยดt be laggy and perfomance as 60/120 fps depending on device.

Screenshots

Release:

https://github.com/kirillzyusko/react-native-keyboard-controller/assets/17690283/e35b4b0b-c9da-43c8-876f-f0745700bfda

Debug:

https://github.com/kirillzyusko/react-native-keyboard-controller/assets/17690283/1472a29e-aaeb-4938-80b6-ca6787145f28

Smartphone (please complete the following information):

Additional context Seems to happen only on iOS devices and release flavour. On debug, everything is working fine ๐Ÿ‘๐Ÿป .

kirillzyusko commented 2 months ago

Hello @Moreno97

Would you mind to attach debug video as well so that I can compare two of them and have a better understanding of where performance drop happens?

Moreno97 commented 2 months ago

Hello @Moreno97

Would you mind to attach debug video as well so that I can compare two of them and have a better understanding of where performance drop happens?

Sure, is attached now ๐Ÿ‘๐Ÿป , thanks. Seems that is not noticiable on the video, but it works way better on Simulator than Release flavour on real device.

kirillzyusko commented 2 months ago

Sure, is attached now ๐Ÿ‘๐Ÿป , thanks. Seems that is not noticiable on the video, but it works way better on Simulator than Release flavour on real device.

Interesting, I'll have a look into it.

But may I ask you to try to comment out this line and see if it improves situation?

Moreno97 commented 2 months ago

Sure, is attached now ๐Ÿ‘๐Ÿป , thanks. Seems that is not noticiable on the video, but it works way better on Simulator than Release flavour on real device.

Interesting, I'll have a look into it.

But may I ask you to try to comment out this line and see if it improves situation?

I can try it building the app release on my device. I'll try it and update as soon as I can. Thanks ๐Ÿ™‚.

kirillzyusko commented 2 months ago

@Moreno97 potentially it can be fixed in https://github.com/kirillzyusko/react-native-keyboard-controller/pull/412

Can you try to install a library from latest main and check if it works better or not? ๐Ÿ‘€

Moreno97 commented 2 months ago

@Moreno97 potentially it can be fixed in #412

Can you try to install a library from latest main and check if it works better or not? ๐Ÿ‘€

Hello! I'll try as soon as possible. Thanks! And KUDOS!

Moreno97 commented 2 months ago

@kirillzyusko installing the library from main seems to be working better on real device!! At least, animations are less laggy and now are "pretty almost native and at full speed". Thanks!! We can close the issue <3.

kirillzyusko commented 2 months ago

@Moreno97 yoohoo ๐ŸŽ‰ Thank you for the report and testing! ๐Ÿ˜Š

There is still some room for further improvements, so I'm going to make them even better/smoother/precise, but I'll do it slightly later ๐Ÿ‘€