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

Unable to get the Keyboard controller to work in iPhone with multiple inputs #574

Closed
franferns opened this issue Aug 31, 2024 · 4 comments · Fixed by #575
Closed

Unable to get the Keyboard controller to work in iPhone with multiple inputs #574

franferns opened this issue Aug 31, 2024 · 4 comments · Fixed by #575
Assignees
Labels
🐛 bug Something isn't working

Comments

@franferns
Copy link

Describe the bug
Unable to get the Keyboard controller to work when run on ios simulator or iphone

Code snippet
image

Repo for reproducing
Sample expo app.

To Reproduce
Steps to reproduce the behavior:
1.Open the my-app
2. tap on the green textbox or the red textbox keyboard pop ups and the input is hidden

Expected behavior
When clicked on the textbox which is Red or Green the the keyboard should push those inputs up . Have not been able to get this working . I have tried with the exact code given at the expo site

Screenshots
https://github.com/user-attachments/assets/9033b2ae-c60b-4485-9cbf-f57d13faba94

Smartphone (please complete the following information):
-iPhone 15 / iPhone 15 Simulator

@kirillzyusko
Copy link
Owner

@franferns I think it happens only in latest version (1.13.x) because I re-worked the way how listeners are attached. And in new flow there could be a case when view is not mounted yet, but we are trying to attach a listener. Thank you for a detailed repo - I'll fix this bug next week. ❤️

And in a meantime you can try to use 1.12.x - that issue shouldn't be present in this version 👀

@kirillzyusko kirillzyusko added the 🐛 bug Something isn't working label Aug 31, 2024
@kirillzyusko
Copy link
Owner

@franferns I fixed a problem in #575

May I ask you to test these changes and confirm whether it fixes a problem or not? 👀

kirillzyusko added a commit that referenced this issue Sep 2, 2024
## 📜 Description

Defer attaching workelt handlers if ref is not initialized yet.

## 💡 Motivation and Context

When we use `KeyboardAwareScrollView` next to `KeyboardProvider` we end
up in situation when ref is not initialized yet and in this case we can
not attach our handler.

This is a common scenario because documentation page tells is's a valid
code but developers can be confused by that fact that sample code is not
working and may not want to integrate the library in the code.

To fix this problem I'm deferring attaching till `ref` is initialized
(`setImmediate` does the job).

Also I added meaningful warning that will spot potential problems in
future:

<p align="center">
<img width="300"
src="https://github.com/user-attachments/assets/0686fc7b-2194-4220-8289-c202416f9912">
</p>

With all these changes I think a new code gets a better revision and
handles more edge-cases.

Closes
#574

## 📢 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 -->

### JS

- check `viewRef` for nullability and defer initialization if it's
`null`;
- check if `viewTag` is null and if it's null then print a warning.

## 🤔 How Has This Been Tested?

Tested on iPhone 15 Pro.

## 📸 Screenshots (if appropriate):

|Before|After|
|-------|-----|
|<video
src="https://github.com/user-attachments/assets/f116dafb-2f67-41d7-9d57-8d3a70fd497a">|<video
src="https://github.com/user-attachments/assets/d70994cb-18bf-439e-bd01-8319e209fcdd">|


## 📝 Checklist

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

@kirillzyusko just checked with the commit it works fine . Thanks for your quick fix :)

@kirillzyusko
Copy link
Owner

@franferns My pleasure 😊

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

Successfully merging a pull request may close this issue.

2 participants