react / react/react-native

Baseline alignment does not respect numberOfLines text property

Đang mở
#35,276 3 bình luận 1 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Needs: Triage :mag: Never gets stale
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

This issue is Android specific.

Whenever using alignItems: 'baseline' on a container which has a text element in it with numberOfRows specified, if that text does get truncated, then the container will be as large as the (partly invisible) text is.

Version

0.70.5

Output of npx react-native info

System:
OS: macOS 12.5.1
CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
Memory: 168.17 MB / 16.00 GB
Shell: 3.3.1 - /usr/local/bin/fish
Binaries:
Node: 16.14.2 - /usr/local/bin/node
Yarn: 1.22.10 - /usr/local/bin/yarn
npm: 8.5.3 - /usr/local/bin/npm
Watchman: 2022.10.17.00 - /usr/local/bin/watchman
Managers:
CocoaPods: 1.11.3 - /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 22.1, iOS 16.1, macOS 13.0, tvOS 16.1, watchOS 9.1
Android SDK: Not Found
IDEs:
Android Studio: 2020.3 AI-203.7717.56.2031.7583922
Xcode: 14.1/14B47b - /usr/bin/xcodebuild
Languages:
Java: 11.0.11 - /usr/bin/javac
npmPackages:
@react-native-community/cli: Not Found
react: 18.1.0 => 18.1.0
react-native: 0.70.5 => 0.70.5
react-native-macos: Not Found
npmGlobalPackages:
react-native: Not Found

Steps to reproduce

Wrap a Text component with a View component which has flexDirection set to row and alignItems set to baseline. Make sure the text contains enough text to at least be rendered on 2 lines. Add numberOfLines with the value of 1 on that text. Notice that the container is larger than you'd expect. You'd expect it to be only 1 line high.

Snack, code example, screenshot, or link to a repository

https://snack.expo.dev/LNZyYKCWg

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Tái hiện hành vi chỉ xảy ra trên Android từ Snack được liên kết bằng cách sử dụng một Text bên trong một View định hướng theo hàng, với alignItems được đặt thành baseline và numberOfLines được đặt thành 1. Theo dõi cách Android xử lý bố cục của Text và việc căn chỉnh theo đường cơ sở, sau đó xác minh rằng container cao một dòng sau khi cắt bớt, mà không thay đổi hành vi mong đợi đối với văn bản không bị giới hạ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ệ
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

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.