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

TextInput box with Limited height doesn't focus to end of line after input exceeds height (RN 47.1, 45.1) #15778

Closed
gavin-gmlab opened this issue Sep 4, 2017 · 8 comments
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@gavin-gmlab
Copy link

Is this a bug report?

YES

Have you read the Contributing Guidelines?

YES

Environment

  1. react-native -v:
    react-native-cli: 2.0.1
    react-native: 0.47.1
  2. node -v:
    v7.10.1
  3. npm -v:
    4.2.0
  4. yarn --version:

Then, specify:

  • Target Platform:
    iOS, Android - Problem only reproducable on Android right now.

  • Development Operating System: MacOS 10.12,

  • Build tools: Android Studio 2.3.3

Steps to Reproduce

  1. Create a new project with create-react-native-app AwesomeProject
  2. Change the code in App.js to the following (apologies for the styling)

`
import React from 'react';
import { StyleSheet, Text, View, TextInput, Platform } from 'react-native';

export default class App extends React.Component {
constructor(props) {
super(props)
this.state = {
value: '',
height: 20
}
this.onContentSizeChange = this.onContentSizeChange.bind(this)
}
onContentSizeChange(e) {
const contentSize = e.nativeEvent.contentSize
this.setState({height: contentSize.height > 100 ? 100 : contentSize.height})
console.log(this.state.height)
}

render() {
return (


Open up App.js to start working on your app!
Changes you make will automatically reload.
Shake your phone to open the developer menu.

<TextInput
placeholder = 'type your text here'
multiline = {true}
style = {[styles.textInput,{height: this.state.height, width: 200}]}
value = {this.state.text}
onContentSizeChange={(e)=> this.onContentSizeChange(e)}
/>

);
}
}

const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
paddingTop: 40,
paddingHorizontal: 10
},
textInput: {
marginLeft: 10,
fontSize: 16,
lineHeight: 18,
marginTop: Platform.select({
ios: 6,
android: 0,
}),
marginBottom: Platform.select({
ios: 5,
android: 3,
}),
},
});
`

  1. Run the app and start typing in the text input box until the whole text input box is filled and keep going. Past that point you can't see what you are typing any more.
  2. This behaviour happens even if we replace the height with a static value (eg. 100) instead of this.state.height

Expected Behavior

The focus of the text input should remain at the last character input.

Actual Behavior

Focus of the text input is outside the visible area

screen shot 2017-09-04 at 11 05 14 am

Reproducible Demo

See the example code listed above.

@gavin-gmlab
Copy link
Author

No one else facing this problem?

@allpwrfulroot
Copy link

Seeing something potentially related, I'm getting a weird onContentSizeChange event: the multiline TextInput's contentSize decides to increase as if it needs a new line, when the text has actually only reached ~60% of the width of a line. So my TextInput grows at very odd points and too much.

@gavin-gmlab
Copy link
Author

@allpwrfulroot, there was a bug reported about that and was supposedly fixed for 47.2. I'm seeing this problem only on Android btw and only if I limit the expanding input field to x lines by the code above. If I let the input box keep growing, no problem

@jamesreggio
Copy link
Contributor

I'm seeing this on Android, too.

@jamesreggio
Copy link
Contributor

Actually, duplicate of #12799.

@gavin-gmlab
Copy link
Author

@jamesreggio Yes, didn't see that before I submitted, even though I went through the TextInput issues before I submitted this one. So I'm not alone... So it's been broken for most of the 40+ versions of RN and hasn't been fixed...

@stale
Copy link

stale bot commented Nov 21, 2017

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Maybe the issue has been fixed in a recent release, or perhaps it is not affecting a lot of people. If you think this issue should definitely remain open, please let us know why. 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 Nov 21, 2017
@stale stale bot removed the Stale There has been a lack of activity on this issue and it may be closed soon. label Nov 27, 2017
facebook-github-bot pushed a commit that referenced this issue Nov 28, 2017
Summary:
This feature was disabled for multiline textinputs in D3528202 ... seems without a good reason.
The broken autoscroll-to-cursor feature is terribly harmful and counter-intuitive in ALL cases.
I also add a contentSize tracking in the example app to make sure that it is unaffected by this change.

https://pxl.cl/9RHP

#12799
#15778

Special thanks to konradkierus!

Reviewed By: sahrens

Differential Revision: D6405985

fbshipit-source-id: 337a390a9db7b3528200ef66c4a079b87608294e
@shergin
Copy link
Contributor

shergin commented Nov 28, 2017

Duplicate of #12799.
And, I hope, 0bef872 fixes that.

@shergin shergin closed this as completed Nov 28, 2017
ide pushed a commit that referenced this issue Nov 28, 2017
Summary:
This feature was disabled for multiline textinputs in D3528202 ... seems without a good reason.
The broken autoscroll-to-cursor feature is terribly harmful and counter-intuitive in ALL cases.
I also add a contentSize tracking in the example app to make sure that it is unaffected by this change.

https://pxl.cl/9RHP

#12799
#15778

Special thanks to konradkierus!

Reviewed By: sahrens

Differential Revision: D6405985

fbshipit-source-id: 337a390a9db7b3528200ef66c4a079b87608294e
ide pushed a commit to expo/react-native that referenced this issue Nov 29, 2017
Summary:
This feature was disabled for multiline textinputs in D3528202 ... seems without a good reason.
The broken autoscroll-to-cursor feature is terribly harmful and counter-intuitive in ALL cases.
I also add a contentSize tracking in the example app to make sure that it is unaffected by this change.

https://pxl.cl/9RHP

facebook#12799
facebook#15778

Special thanks to konradkierus!

Reviewed By: sahrens

Differential Revision: D6405985

fbshipit-source-id: 337a390a9db7b3528200ef66c4a079b87608294e
vincentriemer pushed a commit to vincentriemer/react-native-dom that referenced this issue Dec 1, 2017
Summary:
This feature was disabled for multiline textinputs in D3528202 ... seems without a good reason.
The broken autoscroll-to-cursor feature is terribly harmful and counter-intuitive in ALL cases.
I also add a contentSize tracking in the example app to make sure that it is unaffected by this change.

https://pxl.cl/9RHP

facebook/react-native#12799
facebook/react-native#15778

Special thanks to konradkierus!

Reviewed By: sahrens

Differential Revision: D6405985

fbshipit-source-id: 337a390a9db7b3528200ef66c4a079b87608294e
bowerman0 pushed a commit to bowerman0/react-native that referenced this issue Dec 5, 2017
Summary:
This feature was disabled for multiline textinputs in D3528202 ... seems without a good reason.
The broken autoscroll-to-cursor feature is terribly harmful and counter-intuitive in ALL cases.
I also add a contentSize tracking in the example app to make sure that it is unaffected by this change.

https://pxl.cl/9RHP

facebook#12799
facebook#15778

Special thanks to konradkierus!

Reviewed By: sahrens

Differential Revision: D6405985

fbshipit-source-id: 337a390a9db7b3528200ef66c4a079b87608294e
bowerman0 pushed a commit to bowerman0/react-native that referenced this issue Dec 5, 2017
Summary:
This feature was disabled for multiline textinputs in D3528202 ... seems without a good reason.
The broken autoscroll-to-cursor feature is terribly harmful and counter-intuitive in ALL cases.
I also add a contentSize tracking in the example app to make sure that it is unaffected by this change.

https://pxl.cl/9RHP

facebook#12799
facebook#15778

Special thanks to konradkierus!

Reviewed By: sahrens

Differential Revision: D6405985

fbshipit-source-id: 337a390a9db7b3528200ef66c4a079b87608294e
@facebook facebook locked as resolved and limited conversation to collaborators Nov 28, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Nov 28, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Resolution: Locked This issue was locked by the bot.
Projects
No open projects
Better <TextInput>
Awaiting triage
Development

No branches or pull requests

5 participants