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

[Android]TextInput selection order is different if backspace is pressed or any other key #25044

Closed
ahmed-hararaa opened this issue May 27, 2019 · 2 comments
Labels
Bug Component: TextInput Related to the TextInput component. Platform: Android Android applications. Stale There has been a lack of activity on this issue and it may be closed soon.

Comments

@ahmed-hararaa
Copy link

If subtext is selected then i press backspace then order of events is the following

onSelection {start: 3, end: 8}

onSelection {start: 8, end: 8}

onChange

onSelection {start: 3, end: 3}

and if i press anything else the order is the following

onSelection {start: 3, end: 8}

onChange

onSelection {start: 4, end: 4}

React Native version:

React Native Environment Info:
System:
OS: Windows 10
CPU: (4) x64 Intel(R) Core(TM) i5-2520M CPU @ 2.50GHz
Memory: 1.07 GB / 5.89 GB
Binaries:
Yarn: 1.13.0 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
npm: 6.7.0 - C:\Program Files\nodejs\npm.CMD
IDEs:
Android Studio: Version 3.3.0.0 AI-182.5107.16.33.5314842

Steps To Reproduce

import React from 'react' import {TextInput, View} from 'react-native'

export default class Test extends React.Component {

state = {
    text: ''
}
handleSelectionChange = ({ nativeEvent: { selection } }) => {
    console.log("onSelection", selection)
}

onChange = ({text}) => {
    console.log("onChange")
    this.setState({
        text
    })
}
render () {
    const {text} = this.state
    return(
        <View style={{flex:1, justifyContent:'center'}}>
            <TextInput onSelectionChange={this.handleSelectionChange} style={{width:'100%'}} value={text} onChange={this.onChange}/>
        </View>
    )
}

}

@react-native-bot react-native-bot added Component: TextInput Related to the TextInput component. Platform: Android Android applications. labels May 27, 2019
@stale
Copy link

stale bot commented Aug 25, 2019

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as a "Discussion" or add it to the "Backlog" and I will leave it open. Thank you for your contributions.

@stale stale bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label Aug 25, 2019
@stale
Copy link

stale bot commented Sep 1, 2019

Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to create a new issue with up-to-date information.

@stale stale bot closed this as completed Sep 1, 2019
@facebook facebook locked as resolved and limited conversation to collaborators Sep 2, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug Component: TextInput Related to the TextInput component. Platform: Android Android applications. Stale There has been a lack of activity on this issue and it may be closed soon.
Projects
None yet
Development

No branches or pull requests

2 participants