TextInput with multiline and fixed height shows inconsistent text positioning on initial render
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
When using a TextInput with multiline={true}, fixed height, and textAlignVertical="top", the text positioning is inconsistent depending on navigation path. When a user first opens the app and navigates to a screen containing long text that overflows the TextInput, the text appears "squashed" towards the top with content cut off under the border. However, if the user navigates back to the home screen, opens a note with shorter content first, then returns to the long note, the text positioning displays correctly.
This appears to be a layout initialization timing issue where the TextInput doesn't properly calculate its content positioning on first render when dealing with overflow content.
Steps to reproduce
- Clone the reproduction repository:
git clone https://github.com/Jakes-Git-Hub/Multi-Line-Test.git - Install dependencies with
npm install - Start the app with
npx expo start - Open the app and immediately tap on either "Long Note Example" or "Another Overflow Note"
- Observe that the text appears squashed towards the top with content cut off under the border
- Navigate back to the home screen using the back button
- Tap on the "Short" note (single word content)
- Navigate back and tap on one of the long notes again
- Observe that the text now displays correctly with proper positioning
Also if i go into another long note after initially opening a long note, the text positioning adjusts to a middle ground between squashed and what would be the text position if sequence was long note -> short note -> LN.
React Native Version
0.81.5
Affected Platforms
Runtime - iOS
Output of npx @react-native-community/cli info
System:
OS: Windows 11 10.0.26100
CPU: (12) x64 12th Gen Intel(R) Core(TM) i7-1255U
Memory: 1.77 GB / 15.68 GB
Binaries:
Node:
version: 22.14.0
path: C:\Program Files\nodejs\node.EXE
Yarn: Not Found
npm:
version: 11.6.2
path: C:\Program Files\nodejs\npm.CMD
Watchman: Not Found
SDKs:
Android SDK: Not Found
Windows SDK: Not Found
IDEs:
Android Studio: Not Found
Visual Studio: Not Found
Languages:
Java: Not Found
Ruby: Not Found
npmPackages:
"@react-native-community/cli": Not Found
react:
installed: 19.1.0
wanted: 19.1.0
react-native:
installed: 0.81.5
wanted: 0.81.5
react-native-windows: Not Found
npmGlobalPackages:
"*react-native*": Not Found
Android:
hermesEnabled: Not found
newArchEnabled: Not found
iOS:
hermesEnabled: Not found
newArchEnabled: Not found
Stacktrace or Logs
No crash occurs - this is a layout/rendering issue. The TextInput renders but with incorrect text positioning on initial load. No error messages or stack traces are generated.
MANDATORY Reproducer
https://github.com/Jakes-Git-Hub/Multi-Line-Test
Screenshots and Videos
https://github.com/user-attachments/assets/567f5f49-a871-4b1a-8614-4208b0c13a1f
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 chạy trình tái hiện Multi-Line-Test bắt buộc với React Native 0.81.5 và so sánh luồng ban đầu của ghi chú dài với luồng điều hướng của ghi chú ngắn trên iOS. Điều tra hành vi của TextInput nhiều dòng với chiều cao cố định, nội dung tràn và textAlignVertical="top". Được xem là hoàn tất khi các ghi chú dài có vị trí văn bản nhất quán ở lần render đầu tiên và sau khi điều hướng, mà không có nội dung bị cắt dưới đường viền.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- ios, 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
- Ít trao đổi
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 48/100