react / react/react-native

Different TextInput behavior with flex-basis:0

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

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

Component: TextInput Issue: Author Provided Repro Needs: Triage :mag:
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

Android and IOS exhibit different behaviors in the following scenario: a textInput with a thick border and flex:1, within a view with flex:1.

On Android, the border is not taken into account to determine the size to allot to the textInput.

Possibly related to https://github.com/facebook/react-native/issues/38518

React Native Version

0.72.3

Output of npx react-native info

System:
OS: Windows 10 10.0.19045
CPU: (32) x64 AMD Ryzen Threadripper PRO 3955WX 16-Cores
Memory: 92.13 GB / 127.86 GB
Binaries:
Node:
version: 20.4.0
path: C:\Program Files\nodejs\node.EXE
Yarn: Not Found
npm:
version: 9.8.0
path: C:\Program Files\nodejs\npm.CMD
Watchman: Not Found
SDKs:
Android SDK: Not Found
Windows SDK: Not Found
IDEs:
Android Studio: AI-222.4459.24.2221.10121639
Visual Studio:
- 17.6.33723.286 (Visual Studio Community 2022)
Languages:
Java: 1.8.0_372
Ruby: Not Found
npmPackages:
"@react-native-community/cli": Not Found
react:
installed: 18.2.0
wanted: 18.2.0
react-native:
installed: 0.72.3
wanted: 0.72.3
react-native-windows: Not Found
npmGlobalPackages:
"react-native": Not Found
Android:
hermesEnabled: true
newArchEnabled: false
iOS:
hermesEnabled: Not found
newArchEnabled: Not found

Steps to reproduce

In the example below, the text is below the textInput's border on web and iOS, but above the border on Android, leaving almost no room for the textInput's background.

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

https://snack.expo.dev/ANgohiA9k?platform=android

        <View style={{maxHeight:1000, minHeight:50, backgroundColor:'green'}}>
          <View style={{backgroundColor: 'yellow',
              flex:1,
              height:200,
              marginTop: 20,
              }}>
            <TextInput style={{borderTopWidth: 20, borderColor: 'red', backgroundColor:'blue', height:100, flex:1, padding:0 }}
              editable
              multiline
              value="bla bla bla 2"/>
          </View>
        </View>

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

Bắt đầu với bản tái hiện Snack được liên kết trong issue và chạy nó trên Android, iOS và web. So sánh bố cục TextInput trong ví dụ View lồng nhau được cung cấp, đặc biệt là border phía trên 20px, việc định kích thước bằng flex:1 và vị trí của văn bản nhiều dòng. Được xem là hoàn tất khi các nền tảng xử lý border một cách nhất quán và văn bản cùng background được render với khoảng cách tương đươ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, 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
Đì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.