TextInput Cursor keep reset to starting position when setState,

Author: TaymindisCreated May 2, 2020Updated Aug 12, 2024
Labelsbug

Describe the bug TextInput Cursor keep reseting to first position when setState on event of changeText,

To Reproduce

javascript
<View style={{ flex: 1, flexDirection: 'column' }}>
            <TextInput
              onBlur={() => {
                console.log('blur');
              }}
              onChangeText={text => {
                this.setState({ text });
              }}
              value={this.state.text}
              style={{ flex: 1 }}
              multiline
            />
          </View>

Expected behavior It should be back to the position where it lay