react / react/react-native

Different TextInput behavior with flex-basis:0

Abierto
#38,517 0 comentarios 1 reacción 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Component: TextInput Issue: Author Provided Repro Needs: Triage :mag:
Lenguaje dominante
C++
Estrellas
127k
Forks
25.3k
Merge medio
1 d 23 h
PR fusionados (30 d)
4

Descripción

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>

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

Comienza con la reproducción en Snack enlazada en el issue y ejecútala en Android, iOS y web. Compara el diseño de TextInput en el ejemplo de View anidado proporcionado, especialmente el borde superior de 20px, el dimensionamiento con flex:1 y la colocación del texto multilínea. Se considera completado cuando las plataformas tienen en cuenta el borde de forma coherente y el texto y el fondo se renderizan con un espaciado equivalente.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
android, ios, react-native
Área
mobile
Tipo de issue
Error
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
35/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.