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

KeyboardAwareScrollView not work with text input in nested ScrollView #442

Closed
kiethuynh0904 opened this issue May 14, 2024 · 3 comments · Fixed by #443
Closed

KeyboardAwareScrollView not work with text input in nested ScrollView #442

kiethuynh0904 opened this issue May 14, 2024 · 3 comments · Fixed by #443
Assignees
Labels
🐛 bug Something isn't working 📚 components Anything related to the exported components of this library 🍎 iOS iOS specific KeyboardAwareScrollView 📜 Anything related to KeyboardAwareScrollView component

Comments

@kiethuynh0904
Copy link

kiethuynh0904 commented May 14, 2024

Thank you for creating an awesome library. However, I have a specific case and was wondering if you could take a look and help me out?
Describe the bug
The KeyboardAwareScrollView does not work with nested ScrollView, Is there any specific way I can make it work?

The code looks like
Nested Scrollview (1)

@kirillzyusko kirillzyusko added the 📚 components Anything related to the exported components of this library label May 14, 2024
@kirillzyusko
Copy link
Owner

Hello @kiethuynh0904

Can you check if #443 fixes the problem?

@kirillzyusko kirillzyusko added 🐛 bug Something isn't working 🍎 iOS iOS specific labels May 14, 2024
@kiethuynh0904
Copy link
Author

Hi @kirillzyusko thanks for the quick reply. It works like a charm!

@kirillzyusko
Copy link
Owner

@kiethuynh0904 awesome! I'll merge it to main and will publish under 1.12.1 tag (though I don't have an exact dates when I publish a new release). In a meantime you can patch it using patch-package 👀

kirillzyusko added a commit that referenced this issue May 14, 2024
## 📜 Description

`parentScrollViewTarget` returns only vertical `ScrollView`.

## 💡 Motivation and Context

Actually it was an inconsistency between Android and iOS. On Android we
are checking that instance belongs to `ScrollView`. If it's `<ScrollView
horizontal` then on Android it'll render `HorizontalScrollView` so will
not go into `if (parentView is ScrollView) {` statement.

To achieve a similar behavior on iOS I added a check where compare
`frame` and `contentSize` to assure that `ScrollView` is a vertical.

Closes
#442

## 📢 Changelog

### iOS

- compare `frame` and `contentSize` to assure that `ScrollView` is a
vertical for detection `parentScrollViewTarget`;

## 🤔 How Has This Been Tested?

Tested on iPhone 14 Pro.

## 📸 Screenshots (if appropriate):

|Before|After|
|-------|-----|

|![image](https://github.com/kirillzyusko/react-native-keyboard-controller/assets/22820318/85e46d85-318b-4866-9bb9-0ad669107ea5)|![image](https://github.com/kirillzyusko/react-native-keyboard-controller/assets/22820318/d3b1390a-c074-4f1b-ab2a-fc888901dad9)|

## 📝 Checklist

- [x] CI successfully passed
- [x] I added new mocks and corresponding unit-tests if library API was
changed
@kirillzyusko kirillzyusko added the KeyboardAwareScrollView 📜 Anything related to KeyboardAwareScrollView component label May 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working 📚 components Anything related to the exported components of this library 🍎 iOS iOS specific KeyboardAwareScrollView 📜 Anything related to KeyboardAwareScrollView component
Projects
None yet
2 participants