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

Handle zero bottom inset on iOS #4184

Merged
merged 2 commits into from
May 23, 2024
Merged

Handle zero bottom inset on iOS #4184

merged 2 commits into from
May 23, 2024

Conversation

haileyok
Copy link
Contributor

Why

It is fairly difficult on iOS for us to calculate our real safe area because our bottom is clamping the padding based on the device's inset. For example, on an iPhone 8 or lower, the padding gets set to 15 - because the real bottom inset is 0. However, on other devices it becomes 30 because the inset is set (an iPhone X or higher has a bottom inset of 34).

this results in some bad behavior with the message input in the chat screen. We need to account for this missing padding in these circumstances.

On most devices this offset is very small, even on Android devices. Newer iPhone devices have the tallest offsets, so for thos devices we want to set the max to 76. The minimum - when the offset is zero - should be 60.

Test Plan

With the adjusted offset for these circumstances, all devices should appear to have the same style for the text input

Screenshot 2024-05-22 at 7 10 24 PM

Copy link

render bot commented May 23, 2024

@haileyok haileyok force-pushed the hailey/handle-zero-inset branch from feb51bc to 9ffb12a Compare May 23, 2024 02:11
@haileyok haileyok force-pushed the hailey/handle-zero-inset branch from 9ffb12a to 39935c6 Compare May 23, 2024 02:12
Copy link

Old size New size Diff
7.29 MB 7.29 MB 2 B (0.00%)

@@ -221,8 +222,7 @@ export function MessagesList({

// -- Keyboard animation handling
const {bottom: bottomInset} = useSafeAreaInsets()
const nativeBottomBarHeight = isIOS ? 42 : 60
const bottomOffset = isWeb ? 0 : bottomInset + nativeBottomBarHeight
const bottomOffset = isWeb ? 0 : clamp(60 + bottomInset, 60, 75)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This 15 pixel range comes from

{paddingBottom: clamp(safeAreaInsets.bottom, 15, 30)},

@haileyok haileyok merged commit 69f4684 into main May 23, 2024
6 checks passed
@haileyok haileyok deleted the hailey/handle-zero-inset branch May 23, 2024 02:44
haileyok added a commit that referenced this pull request May 23, 2024
* set message padding to a minimum of 60 and max of 70

* adjust range

(cherry picked from commit 69f4684)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants