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

KeyboardProvider , UI bug after device rotate , using keyboard-controller and react-navigation #547

Closed
term51 opened this issue Aug 13, 2024 · 8 comments · Fixed by #550
Closed
Assignees
Labels
🤖 android Android specific 🐛 bug Something isn't working

Comments

@term51
Copy link

term51 commented Aug 13, 2024

Describe the bug
When I finished the UI I decided to test the display with a horizontal screen and noticed that the UI shifts depending on the screen rotation. Initially, I didn't use the react-native-safe-area-context component, when I figured out what the problem was I saw that your example used it, I put it in but it didn't work. I don't know what to do with it, I tried removing components from the list one by one, but the problem disappeared only after removing KeyboardProvider. At this point, the only option is to remove your library and consider how to customize the Keyboard from react-native to make it work properly. If you need additional information, please reply as soon as possible.

versions of some of the usable libraries
"react-native-reanimated": "3.15.0",
"react-native-paper": "5.12.5",
"@react-navigation/bottom-tabs": "6.6.1",
"@react-navigation/native": "6.1.18",
"@react-navigation/native-stack": "6.11.0",
"@react-navigation/stack": "6.4.1",

Code snippet

return (
    <SafeAreaProvider initialMetrics={initialWindowMetrics}>
      <KeyboardProvider >
        <PaperProvider theme={selectedTheme}>
          <NotificationToastProvider>
            <ConfirmationDialogProvider>
              <Portal.Host>
                <Navigation />
              </Portal.Host>
            </ConfirmationDialogProvider>
          </NotificationToastProvider>
        </PaperProvider>
      </KeyboardProvider>
    </SafeAreaProvider>
  );

To Reproduce
Steps to reproduce the behavior:

  1. Set up according to the instruction
  2. Click rotate on the emulator
  3. See the problem

Expected behavior
bottom and top are formatted to fit the width of the screen

Screenshots
Normal
image

Rotated
image

Smartphone (please complete the following information):

  • Desktop OS: Windows 11
  • Device: Pixel 8, Samsung m21
  • OS: Android 7, 12, 14
  • RN version: 0.74.0
  • RN architecture: old
  • JS engine: Hermes
  • Library version: 1.12.7
@term51 term51 changed the title UI bug after device rotate when using keyboard-controller and react-navigation KeyboardProvider , UI bug after device rotate , using keyboard-controller and react-navigation Aug 13, 2024
@kirillzyusko
Copy link
Owner

@term51 very interesting! Actually I'm always testing rotation and in my example app it works without artificial paddings (Pixel 7 Pro, Android 14):

Circle test Chat test
telegram-cloud-photo-size-2-5323577763023676150-y telegram-cloud-photo-size-2-5323577763023676149-y

I think it could be related to the usage of BottomTabBar navigator (this is the only one difference that I see between my app and yours) 🤔

Would you mind to provide a minimal reproduction repo?

I'll try to play around with bottom tabs navigation etc., but it would significantly speed up the fix development if you could provide a minimal code needed to reproduce the problem ❤️

@kirillzyusko kirillzyusko added 🐛 bug Something isn't working 🤖 android Android specific labels Aug 13, 2024
@kirillzyusko
Copy link
Owner

Also tested bottom tabs in example app (on API 28) and it seems to be working fine - let me know if I'm doing something wrong:

Screenshot 2024-08-14 at 00 09 01

@term51
Copy link
Author

term51 commented Aug 14, 2024

Okay, I'm doing it now.

@term51
Copy link
Author

term51 commented Aug 14, 2024

https://github.com/term51/for-fix-ui-bug

The problem remains, by the way, the shift is relative to the turn.

image

@kirillzyusko
Copy link
Owner

Thank you for reproduction @term51!
It looks like it happens because I add paddings to the view, but when the view gets rotated - the paddings are associated with the same borders (i. e. I add bottom padding, but when screen gets rotated - it should be left/right, but not bottom).

I tend to think that the problem is in react-native-keyboard-controller package - I'll try to change paddings depends on orientation and see the new behavior.

@term51 do you think that you can strictly specify portrait mode in your application (as a workaround) while I'm preparing a fix? 🤔

@term51
Copy link
Author

term51 commented Aug 14, 2024

No problem, it can be wait, thank you for such a quick response

@kirillzyusko kirillzyusko mentioned this issue Aug 16, 2024
2 tasks
@kirillzyusko
Copy link
Owner

@term51 can you please check if #550 fixes the problem?

@kirillzyusko
Copy link
Owner

The fix is published under 1.13.1! Let me know if the issue is still there so that I can re-open this issue!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🤖 android Android specific 🐛 bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants