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

keyboardVerticalOffset documentation issue #887

Closed
slavko-lukic opened this issue Mar 28, 2025 · 5 comments · Fixed by #890
Closed

keyboardVerticalOffset documentation issue #887

slavko-lukic opened this issue Mar 28, 2025 · 5 comments · Fixed by #890
Assignees
Labels
documentation Improvements or additions to documentation

Comments

@slavko-lukic
Copy link

Hello.

Both this library and KeyboardAvoidingView from react-native have very vague description for keyboardVerticalOffset prop.

Distance between the top of the user screen and the React Native view. This may be non-zero in some cases. Defaults to 0.

What is this "React Native view" in question? Is it the main app view? Is it the KeyboardAvoidingView being used?
I suggest rewriting this to be more clear so that people stop tuning this randomly though trial and error until they get it right.

@kirillzyusko
Copy link
Owner

Hey @slavko-lukic

What is this "React Native view" in question? Is it the main app view? Is it the KeyboardAvoidingView being used?

This is a distance between top of the screen and your KeyboardAvoidingView

Assume if you have layout like

  • App
    • Header
    • KeyboardAvoidingView

In this case you would need to specify headerHeight as a keyboardVerticalOffset. How documentation can be improved? Do you think that a visual example should be there to show a particular layout and which keyboardVerticalOffset should be used?

Really curious to hear your thoughts 👀

@kirillzyusko kirillzyusko self-assigned this Mar 28, 2025
@kirillzyusko kirillzyusko added the documentation Improvements or additions to documentation label Mar 28, 2025
@slavko-lukic
Copy link
Author

Hey @kirillzyusko

I'd maybe just paraphrase prop annotation so that it's clear that offset should be distance from top of the screen to the KeyboardAvoidingView in question. And when you hover over prop you can easily see it.

That example you gave or visual example could be added to your website for additional clarity.

@kirillzyusko
Copy link
Owner

@slavko-lukic I'm trying to draw an example using GPT-solutions, but they fail to do that 🙈

I think I'll draw a diagram and add it to website soon + change description 🙂

@slavko-lukic
Copy link
Author

slavko-lukic commented Mar 31, 2025

@kirillzyusko That's great 🙌
You wouldn't believe the number of times i've seen this prop used incorrectly over the years.

By the way, keep up the good work. This library is solving one of the most annoying problems in react native. 👍

kirillzyusko added a commit that referenced this issue Mar 31, 2025
…anation (#890)

## 📜 Description

Added a better explanation of what `keyboardVerticalOffset` does and
when to use it.

## 💡 Motivation and Context

Clearer documentation -> less bug reports 😎 

Closes
#887

## 📢 Changelog

<!-- High level overview of important changes -->
<!-- For example: fixed status bar manipulation; added new types
declarations; -->
<!-- If your changes don't affect one of platform/language below - then
remove this platform/language -->

### Docs

- added better explanation of `keyboardVerticalOffset property`;

## 🤔 How Has This Been Tested?

Tested via preview.

## 📸 Screenshots (if appropriate):

<img width="1003" alt="image"
src="https://github.com/user-attachments/assets/19a63ae9-305d-4828-be4a-a8af69444e11"
/>

## 📝 Checklist

- [x] CI successfully passed
- [x] I added new mocks and corresponding unit-tests if library API was
changed
@kirillzyusko
Copy link
Owner

Published new version of documentation - should be clearer now 😊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
2 participants