`KeyboardAvoidingView` infinitely updates on Android
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- C++
- Star
- 127k
- Fork
- 25.3k
- Merge trung bình
- 1 ngày 23 giờ
- Pull request đã merge (30 ngày)
- 4
Mô tả
Description
The bottom state of the KeyboardAvoidingView component infinitely updates on Android. This is visible when inspecting KeyboardAvoidingView's state in React Native DevTools, it continuously changes value. Or when a component is rendered just above the keyboard, it flickers and/or bounces up and down.
Steps to reproduce
Prerequisites
- App from reproducer repo is built and open. Reproduction 1 is on branch
example-1. Reproduction 2 is on branchexample-2. For each branch, checkout,yarn installthenyarn android. - React Native DevTools is running.
Reproduction 1
Reproduction 1 is a text input and footer fixed to the bottom wrapped in a KeyboardAvoidingView. While the bottom state changes, the change is so small (<1 px) that it is not noticeable in the UI.
Steps
- Inspect
KeyboardAvoidingViewin the React Native DevTools. - Focus on text input in app.
- Check
bottomstate in DevTools. - Unfocus text input in app.
- Check
bottomstate in DevTools.
Expected behaviour
The bottom state should not continuously change.
Actual behaviour
The bottom state continuously changes.
Reproduction 2
Reproduction 2 is the same as reproduction 1 but with two screens to show the effect on the UI as the bottom state change is much larger.
Steps
- Focus on text input in the app.
- Tap "Go to screen 2".
- Inspect
Screen2'sKeyboardAvoidingViewin the React Native DevTools.
Expected behaviour
The bottom state should not continuously change. The footer should not be flickering.
Actual behaviour
The bottom state continuously changes. The footer is flickering.
React Native Version
0.74.2
Affected Platforms
Runtime - Android
Output of npx react-native info
System:
OS: macOS 14.5
CPU: (8) arm64 Apple M1
Memory: 100.70 MB / 16.00 GB
Shell:
version: 3.7.0
path: /opt/homebrew/bin/fish
Binaries:
Node:
version: 20.11.1
path: ~/.local/share/mise/installs/node/20/bin/node
Yarn:
version: 3.6.4
path: ~/.local/share/mise/installs/node/20/bin/yarn
npm:
version: 10.2.4
path: ~/.local/share/mise/installs/node/20/bin/npm
Watchman:
version: 2024.01.22.00
path: /opt/homebrew/bin/watchman
Managers:
CocoaPods:
version: 1.15.2
path: /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms:
- DriverKit 23.5
- iOS 17.5
- macOS 14.5
- tvOS 17.5
- visionOS 1.2
- watchOS 10.5
Android SDK:
API Levels:
- "33"
- "34"
Build Tools:
- 29.0.2
- 30.0.2
- 30.0.3
- 31.0.0
- 33.0.1
- 34.0.0
System Images:
- android-33 | Google APIs ARM 64 v8a
- android-34 | ARM 64 v8a
- android-34 | Google Play ARM 64 v8a
Android NDK: Not Found
IDEs:
Android Studio: 2023.2 AI-232.10227.8.2321.11479570
Xcode:
version: 15.4/15F31d
path: /usr/bin/xcodebuild
Languages:
Java:
version: 17.0.10
path: /opt/homebrew/opt/openjdk@17/bin/javac
Ruby:
version: 2.6.10
path: /usr/bin/ruby
npmPackages:
"@react-native-community/cli": Not Found
react:
installed: 18.2.0
wanted: 18.2.0
react-native:
installed: 0.74.2
wanted: 0.74.2
react-native-macos: Not Found
npmGlobalPackages:
"*react-native*": Not Found
Android:
hermesEnabled: true
newArchEnabled: false
iOS:
hermesEnabled: Not found
newArchEnabled: false
Stacktrace or Logs
N/A
Reproducer
https://github.com/winghouchan/react-native-keyboardavoidingview-infinite-update-mcve
Screenshots and Videos
Reproduction 1
https://github.com/facebook/react-native/assets/6061021/4c89d653-2030-4a65-bf47-8a2ec895fd39
Reproduction 2
https://github.com/facebook/react-native/assets/6061021/43f2a203-232a-425d-a537-91f4f96ea8b5
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Bắt đầu bằng cách checkout các branch example-1 và example-2 của reproducer được liên kết, chạy yarn install và yarn android, sau đó kiểm tra KeyboardAvoidingView trong React Native DevTools. So sánh hành vi trên Android khi focus và bỏ focus khỏi input cũng như điều hướng đến Screen2; được coi là hoàn thành khi trạng thái ở dưới cùng vẫn ổn định và footer không còn nhấp nháy hoặc nảy lên nảy xuống.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- android, react-native
- Lĩnh vực
- mobile
- Loại issue
- Lỗi
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 35/100