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

[Clipclops] Create useKeyboardVerticalOffset hook #3823

Merged
merged 1 commit into from
May 2, 2024

Conversation

mozzius
Copy link
Member

@mozzius mozzius commented May 2, 2024

The KeyboardAvoidingView requires adjustment to position the input correctly. Previously, I had trial-and-error'd the numbers requires for keyboardVerticalOffset. However, since the gap looks different on my base iPhone 14 vs the iPhone 15 simulator, I am fairly confident in saying that it's device specific.

On iOS: seems like it's the top safe area inset
On Android: seems like it's the navigation bar height

To handle this, I moved the logic out to a custom hook

Copy link

render bot commented May 2, 2024

@mozzius mozzius changed the title create keyboardverticaloffset hook [Clipclops]] Create useKeyboardVerticalOffset hook May 2, 2024
@mozzius mozzius changed the title [Clipclops]] Create useKeyboardVerticalOffset hook [Clipclops] Create useKeyboardVerticalOffset hook May 2, 2024
Copy link

github-actions bot commented May 2, 2024

Old size New size Diff
6.85 MB 6.85 MB 365 B (0.01%)

Comment on lines +197 to +201
return Platform.select({
ios: topInset,
android: screenWindowDifference,
default: 0,
})
Copy link
Contributor

Choose a reason for hiding this comment

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

i remember us having a problem with a Platform.select before in prod but can't remember what exactly it ended up being linked to. Do you remember?

Copy link
Member Author

Choose a reason for hiding this comment

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

That was code-spitting related, however these are just numbers so it should be fine

Copy link
Contributor

@haileyok haileyok left a comment

Choose a reason for hiding this comment

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

Let's pay attention to if it works when available on TF, but it does work in the simulator.

@mozzius mozzius merged commit 96c5db3 into main May 2, 2024
6 checks passed
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