Skip to content
This repository has been archived by the owner on Oct 4, 2023. It is now read-only.

[PAY-1319] Fix emoji keyboard overlapping chat text input #3629

Merged
merged 13 commits into from
Jun 22, 2023
Merged

Conversation

dharit-tan
Copy link
Contributor

@dharit-tan dharit-tan commented Jun 21, 2023

Description

The bug: when switching to the emoji keyboard, the keyboard would slightly overlap the textinput (see linear issue).
Root cause: I discovered that the content inside the KeyboardAvoidingView was offset by 84 pixels, which matches the height of the BottomTabBar. For some reason it thought that it had to avoid that too. I'd gotten lucky by using keyboardHeightOffset and landed on a value that perfectly matched up with 84 pixels, but this was a house of cards. The real solution is to measure the height of BottomTabBar and subtract that from the amount to translate the content of KeyboardAvoidingView by.

EDIT: gonna stick with hardcoding. Also needed to handle ios vs android bottom padding separately for some reason.

This solution feels like a bit much for such a simple thing, open to suggestions. I did start by just hardcoding the height of BottomTabBar (see first commit) but I figured there might be cases where there are extra insets at the bottom of the screen or something, so actually measuring it felt more robust.

I tried a variety of approaches:

  • Tried to animate away BottomTabBar the same way we do when opening the NowPlayingDrawer, but KeyboardAvoidingView didn't know about the animations and still thought they were visible.
  • Set AppTabBar to return null when the keyboard was visible, but this caused the rive animations in BottomTabBar to run again when they re-entered the screen.
  • Tried to figure out how to prevent the animations from running via Rive API but couldn't find a way.

Dragons

Is there anything the reviewer should be on the lookout for? Are there any dangerous changes?

How Has This Been Tested?

https://github.com/AudiusProject/audius-client/assets/3893871/b7001f4a-01fa-4895-9b90-4168cfd3975e
Screenshot_1687397964
Screenshot_1687397970
Screenshot_1687397986
Screenshot_1687397992

How will this change be monitored?

For features that are critical or could fail silently please describe the monitoring/alerting being added.

Feature Flags

Are all new features properly feature flagged? Describe added feature flags.

@audius-infra
Copy link
Collaborator

Preview this change https://demo.audius.co/rt-bottom

@dharit-tan dharit-tan changed the title Fix emoji keyboard overlapping chat text input [PAY-1319] Fix emoji keyboard overlapping chat text input Jun 21, 2023
Copy link
Contributor

@rickyrombo rickyrombo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the bottom tab bar height dynamic? I think if we explicitly set its height to the same constant you use in the chats screen (like in your first commit) we should be good - if anyone wanted to change the height they'd see the constant's usage and would have to adjust it there anyway.

I think what you landed on is probably good too but I'm not sure if it needs to be this dynamic

@dharit-tan
Copy link
Contributor Author

Is the bottom tab bar height dynamic? I think if we explicitly set its height to the same constant you use in the chats screen (like in your first commit) we should be good - if anyone wanted to change the height they'd see the constant's usage and would have to adjust it there anyway.

I think what you landed on is probably good too but I'm not sure if it needs to be this dynamic

Yep fair enough, it's not dynamic just thought this would be safer. I was worried bottom insets would mess things up on some devices, but looked again and we're probably good.

Copy link
Contributor

@dylanjeffers dylanjeffers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work!

packages/mobile/src/screens/app-screen/AppTabBar.tsx Outdated Show resolved Hide resolved
packages/mobile/src/screens/app-screen/AppTabBar.tsx Outdated Show resolved Hide resolved
packages/mobile/src/screens/chat-screen/constants.ts Outdated Show resolved Hide resolved
Copy link
Contributor

@piazzatron piazzatron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great find!!

Re: keeping it dynamic or not - if we can show that just setting it as a fixed height works on multiple devices, IMO we should rip out the redux stuff and just use a constant. Every little bit of complexity one can avoid adding is a win :D

(As an aside, for this sort of simple pattern of setting a global var and being able to read from it elsewhere, React context is very nice - you can avoid the whole reducer/action/dispatch song and dance) and just set things directly.

This reverts commit 13cedf6.
@dharit-tan
Copy link
Contributor Author

Going to merge the hardcoded version, have the measuring version backed up on rt-bottom-bar-measure if we ever want to go back to it.

Copy link
Contributor

@rickyrombo rickyrombo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. I'd add the constant as the height of the bottom bar to make it explicitly the same as the constant - that way anyone looking to change the bottom bar height knows to modify the constant

@dharit-tan dharit-tan merged commit c2a59dc into main Jun 22, 2023
@dharit-tan dharit-tan deleted the rt-bottom branch June 22, 2023 02:30
audius-infra pushed a commit that referenced this pull request Jun 24, 2023
[fe5fda4] Fix entity button widths (#3650) Dylan Jeffers
[820e79e] Fix user profile always showing artist tabs (#3648) Dylan Jeffers
[bc34b6f] [C-2697] Fix mobile playlist qa issues (#3638) Dylan Jeffers
[3e8d7e8] Mobile chats recalculate container bottom on keyboard shown (#3644) Reed
[39928cf] Bump app versions for full release (#3643) Reed
[437e971] Update SDK to v3.0.3-beta.56 (#3641) Marcus Pasell
[3e42cb2] [PAY-1526] Mobile chat reaction picker shadow (#3642) Reed
[ab33206] Amplitude tracking for chat report abuse (#3639) Reed
[6f570c6] Put playlist-artwork generation behind flag (#3640) Dylan Jeffers
[2f1f40d] [C-2475] Add desktop favorites playlist tab (#3637) Dylan Jeffers
[394cacb] [PAY-1516] Chat report abuse flow (#3636) Reed
[82204ec] [C-2763] Fix desktop playlist qa issues (#3634) Dylan Jeffers
[3912407] Implement OAuth Write Popup C-2664 (#3628) nicoback2
[7e13b54] [C-2783] Add terms of service link (#3635) Dylan Jeffers
[bda6eeb] Refactor: extract reusable modal field component (#3631) Andrew Mendelsohn
[c2a59dc] [PAY-1319] Fix emoji keyboard overlapping chat text input (#3629) Reed
[14150ec] [C-2784] Refactor track page to use entity button (#3624) Dylan Jeffers
[5a3e74e] [PAY-1457] Add amplitude analytics to chat features (#3627) Marcus Pasell
[d1aee10] [PAY-1412] Reset player state on app load (#3632) Reed
[965330c] [PAY-1191] Finesse keyboard enter/exit animations (#3633) Michael Piazza
[c9c531e] Create grant upon making developer app (#3630) nicoback2
[a33de30] [PAY-1464] DMs: Go to chat after successful tip (#3625) Marcus Pasell
[646a5eb] [PLAT-1015] Remove entity manager feature flag (#3619) Raymond Jacobson
[31450e7] [PAY-1498][PAY-1477] Misc mobile DMs UI Fixes (#3626) Michael Piazza
[a08f3e7] [C-2760, C-2779] Fix header for playlist and artists tabs in explore screen (#3579) Kyle Shanks
[9a98157] [C-2676] Rough release date modal (#3610) Andrew Mendelsohn
[5e9a847] [C-2771, C-2772] Add duplicate add to playlist confirmation drawer and modal (#3601) Kyle Shanks
[49ca553] [PAY-1468] Fix mobile chats copy message button (#3623) Reed
[193ae1c] [PAY-1483] Patch RN to fix textinput multiline onchange not firing (#3622) Reed
@AudiusProject AudiusProject deleted a comment from linear bot Sep 11, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants