Skip to content

React Native TextInput in ListView value by state is stuck #14651

Closed
@rexjrs

Description

@rexjrs

Description

State value locks up when scrolling down a ListView and coming back up. I think the Optimization techniques where rows out of screen view "unrender themselves" of the ListView component messes up the TextInput's value property and locks up.

This describes what I mean.

https://www.youtube.com/watch?v=fq7ITtzRvg4&feature=youtu.be

Reproduction Steps

Set up a listview with some data. Set up a TextInput with dynamic state value property and onChangeText

Sample Code

                            <TextInput
                                style={styles.commentInput}
                                placeholder="Say something..."
                                placeholderTextColor="gray"
                                underlineColorAndroid="transparent"
                                multiline={true}
                                blurOnSubmit={true}
                                value={this.state["row"+data.id]}
                                onChangeText={(input) => {this.setState({["row"+data.id]: input})}}
                            />

See here for full code snippet:
https://stackoverflow.com/questions/44666538/react-native-listview-textinput-locks-up-from-performance-optimization-rendering

Additional Information

  • React Native version: 0.45.1
  • Platform: [FILL THIS OUT: Android confirmed. Maybe IOS?EDIT: BOTH confirmed
  • Development Operating System: [FILL THIS OUT: MAC

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions