- Sponsor
-
Notifications
You must be signed in to change notification settings - Fork 111
e2e: use google_apis device #488
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
Merged
Merged
+65
−18
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
📊 Package size report
|
2 tasks
kirillzyusko
added a commit
that referenced
this pull request
Jul 4, 2024
Loading
Loading status checks…
## 📜 Description Fixed an issue where `scrollPosition.value` is updated with out-of-date value. ## 💡 Motivation and Context <!-- Why is this change required? What problem does it solve? --> <!-- If it fixes an open issue, please link to the issue here. --> The problem happens, because without animation `onMove`/`onEnd` dispatched almost simultaneously. But js handler can not update `position.value` and in `onEnd` handler in `scrollPosition.value = position.value;` code we set `scrollPosition.value = 0`. When text input grows: ```tsx layout.value = input.value; scrollPosition.value += maybeScroll(keyboardHeight.value, true); ``` We call `maybeScroll`, but `scrollPosition.value === 0` and because of that we scroll by 16px (though we had to scroll for `actualScroll (170) + 16` but we do `0 + 16`, and because of that position is incorrect. To fix the problem `onEnd` should actually update `scrollPosition` to the expected value, and to achieve that we need to update a value from worklet. Now it's slightly problematic, because current REA doesn't support both: js + worklet handlers (see software-mansion/react-native-reanimated#6204), so I'm always re-dispatching `nativeEvent` manually via `runOnJS`. The issue was caught originally in #488 ## 📢 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 - fix race condition between scroll position update and keyboard movement. ## 🤔 How Has This Been Tested? - Set focus to `TextInput#3` - press enter 2 times Tested on Android 12 (Pixel 2) with disabled animations (detox). ## 📸 Screenshots (if appropriate): |Before|After| |-------|-----| |<img width="399" alt="image" src="https://github.com/kirillzyusko/react-native-keyboard-controller/assets/22820318/5511fb3e-54c3-4495-9955-13e933839941">|<img width="397" alt="image" src="https://github.com/kirillzyusko/react-native-keyboard-controller/assets/22820318/00d679ba-5986-4fb6-a41a-9c6a1944c98d">| ## 📝 Checklist - [x] CI successfully passed - [x] I added new mocks and corresponding unit-tests if library API was changed
8bfa473
to
f0bf177
Compare
Loading status checks…
7f603f9
to
beb37c3
Compare
Loading status checks…
Loading status checks…
Loading status checks…
Loading status checks…
Loading status checks…
Loading status checks…
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
📜 Description
Enable tests on real Android image (not AOSP).
💡 Motivation and Context
The motivation is to execute tests on devices that are close to a real one. AOSP has its own advantages, such as stable tests. However one year later (since I added e2e tests support in GitHub) GitHub has upgraded its runners and now we can run real Android images and it opens a new opportunities:
But this addition comes with own price - existing e2e tests will fail, because of asynchronous nature of "input focused" and "onApplyWindowInsets" events. In not AOSP these events are asynchronous, and current
KeyboardAwareScrollView
works in the next way:And since these events are asynchronous - we can end up in various states:
bottomOffset
constraint;And because of that it's really hard to cover such functionality by e2e tests. In this PR I added
SOFT_CHECK
variable - if it'strue
, then we perform checks via matchers (since we can not assure pixel-perfect precision).📢 Changelog
E2E
🤔 How Has This Been Tested?
Tested on CI.
📸 Screenshots (if appropriate):
See in files changed 👀
📝 Checklist