react / react/react-native

Text in FlatList is not selectable on Android

Abierto
#46,999 5 comentarios 1 reacción 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Component: FlatList Issue: Author Provided Repro Platform: Android
Lenguaje dominante
C++
Estrellas
127k
Forks
25.3k
Merge medio
1 d 23 h
PR fusionados (30 d)
4

Descripción

Description

Bug previously opened here.

It was claimed to be fixed here but still reproduces on 0.75.4

Steps to reproduce

Try to select text in provided reproducer, it won't work for item in flat list. Note that sometimes it will work after a hot reload.

/**
 * Sample React Native App
 * https://github.com/facebook/react-native
 *
 * @format
 */

import React from 'react';
import {
  FlatList,
  SafeAreaView, StyleSheet,
  Text,
} from 'react-native';

function App(): React.JSX.Element {
  return (
    <SafeAreaView>
      <Text style={styles.text} selectable>I am selectable</Text>
      <FlatList data={[1]} renderItem={ListText}/>
    </SafeAreaView>
  );
}

const ListText = () => {
  return <Text style={styles.text} selectable>I am not selectable</Text>;
};

const styles = StyleSheet.create({
  text: {
    fontSize: 20,
    padding: 10,
  },
});

export default App;
React Native Version

0.75.4

Affected Platforms

Runtime - Android

Output of npx react-native info
info Fetching system and libraries information...
System:
  OS: macOS 15.0
  CPU: (12) arm64 Apple M3 Pro
  Memory: 206.94 MB / 36.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 20.9.0
    path: ~/.asdf/installs/nodejs/20.9.0/bin/node
  Yarn:
    version: 1.22.22
    path: /opt/homebrew/bin/yarn
  npm:
    version: 10.1.0
    path: ~/.asdf/plugins/nodejs/shims/npm
  Watchman:
    version: 2024.08.19.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.14.3
    path: /Users/johanlndll/.gem/ruby/3.1.4/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 24.0
      - iOS 18.0
      - macOS 15.0
      - tvOS 18.0
      - visionOS 2.0
      - watchOS 11.0
  Android SDK: Not Found
IDEs:
  Android Studio: 2024.2 AI-242.21829.142.2421.12409432
  Xcode:
    version: 16.0/16A242d
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.10
    path: /usr/bin/javac
  Ruby:
    version: 3.1.4
    path: /Users/johanlndll/.rubies/ruby-3.1.4/bin/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.3.1
    wanted: 18.3.1
  react-native:
    installed: 0.75.4
    wanted: 0.75.4
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: true
  newArchEnabled: false
Stacktrace or Logs
Does not crash.
Reproducer

https://github.com/LA-Johan/list-select

Screenshots and Videos

https://github.com/user-attachments/assets/480fb515-b207-4774-b5a2-78127afd9268

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

Empieza con el reproducer vinculado de list-select y compara el Text seleccionable fuera de FlatList con el elemento renderizado dentro de ella en Android. Rastrea los puntos de entrada de FlatList y Text para identificar por qué la selección puede depender de un hot reload; se considera terminado cuando el texto del elemento se puede seleccionar de forma fiable en el reproducer sin esa solución alternativa.

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

Evaluación

Stack tecnológico
android, 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.