Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FlashList TextInput: Focus/Text Duplication on Scroll #1547

Open
2 tasks done
krishnan-456 opened this issue Mar 4, 2025 · 0 comments
Open
2 tasks done

FlashList TextInput: Focus/Text Duplication on Scroll #1547

krishnan-456 opened this issue Mar 4, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@krishnan-456
Copy link

krishnan-456 commented Mar 4, 2025

Current behavior

I have rendered a list of 40 TextInput fields. When I focus or typed on the last TextInput and scroll up, I notice that the focus and typed text is also applied to the first rendered TextInput.

"@shopify/flash-list": "^1.7.1",
"react-native": "^0.75.5"

Expected behavior

Focusing and typing in a TextInput within a long list should only affect the selected TextInput.

To Reproduce

import React from 'react'
import { View, TextInput, StyleSheet } from 'react-native'
import { FlashList } from '@shopify/flash-list'

const App = () => {
  const data = Array.from({ length: 40 }, (_, index) => ({
    key: index.toString(),
    question: `Question ${index + 1}`,
  }));

  // Render each TextInput
  const renderItem = ({ item }: { item: { question: string; answer: string } }) => (
    <View style={styles.itemContainer}>
      <TextInput
        style={styles.input}
        placeholder={item.question}
      />
    </View>
  );

  return (
    <View style={styles.container}>
      <FlashList
        data={data}
        renderItem={renderItem}
        keyExtractor={(item) => item.key}
        estimatedItemSize={50}
      />
    </View>
  );
};

const styles = StyleSheet.create({
  container: {
    flex: 1,
    padding: 16,
  },
  itemContainer: {
    marginBottom: 10,
  },
  input: {
    height: 40,
    borderColor: 'gray',
    borderWidth: 1,
    paddingHorizontal: 8,
  },
});

export default App;
Flashlist.Text.Duplication.1.mp4

Platform:

  • iOS
  • Android

Environment

1.7.1

@krishnan-456 krishnan-456 added the bug Something isn't working label Mar 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant