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 multiline={true} not functioning as expected #12717

Closed
JPig opened this issue Mar 5, 2017 · 84 comments
Closed

TextInput multiline={true} not functioning as expected #12717

JPig opened this issue Mar 5, 2017 · 84 comments
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@JPig
Copy link

JPig commented Mar 5, 2017

Description

TextInput multiline set to true no longer does newline on enter press. just blurs the TextInput instead.

Reproduction

Just change from 0.41.2 to 0.42.0 using the default AutoExpandingTextInput Example from the TextInput Docs to see it happening

Additional Information

  • React Native version: 0.42.0
  • Platform: Android ( Possibly iOS havent tested )
  • Operating System: MacOS
@jonasb
Copy link

jonasb commented Mar 7, 2017

I can reproduce it on Android. But not on iOS.

<TextInput multiline style={{ height: 100, backgroundColor: '#ccc' }} />

@teh-obeng
Copy link

It blurs on Sony's Swift Keyboard,
but it's working fine when I changed it to Google's GBoard

@Yadro
Copy link

Yadro commented Mar 8, 2017

+1

@LMDavid
Copy link

LMDavid commented Mar 10, 2017

It blurs on Samsung Galaxy S6 keyboard.
Like @hermantotang said, it works fine with Google's GBoard or the default keyboard in the Android emulator.

@JPig
Copy link
Author

JPig commented Mar 10, 2017

Yeah it was happening to me on a Samsung s6

@zhangzhhz
Copy link

Google English keyboard works as in that Enter will give a new line. Google Japanese keyboard does not work. A chinese input method I have also does not work.

Android.

@studio3w
Copy link

Had the same problem with SwiftKey Keyboard. Following fixed it for me:
#12923

@cbjs
Copy link

cbjs commented Mar 21, 2017

+1

@goodhyun
Copy link

#12923 didn't fix our case. We tried to replace the entire ReactAndroid folder, but in vain.
We had to roll back to 0.41.2
Hope this is fixed in 0.43

@studio3w
Copy link

@astapinski
Copy link

+1 on this, we need a fix for this for our app because it affects Samsung.

@codewithpassion
Copy link

I have the same issue while using Expo. The Expo SDK 15 brought RN 0.42 and broke my input field.
See #13159.

@goodhyun
Copy link

goodhyun commented Apr 7, 2017

Sorry @studio3w I didn't know that I had to rebuild RN again from source.
Even 0.43.1 didn't solve this issue, and I rebuilt 0.43.1 with #12923 fix and it just worked like a charm.

This is a really annoying issue though.

@Yadro
Copy link

Yadro commented Apr 8, 2017

Doesn't work onContentSizeChange event in release 0.43.2. wtf

@faverex
Copy link

faverex commented Apr 11, 2017

+1

@cjmling
Copy link

cjmling commented Apr 11, 2017

Having same issue. :'( same version , using expo , swiftkey

@xuyuanzhou
Copy link

+1

@Ehesp
Copy link
Contributor

Ehesp commented Apr 17, 2017

Can confirm onContentSizeChange also not working in 43.*

@BCGen
Copy link

BCGen commented Apr 17, 2017

Below is useful to me, use expo SDK 17, RN 0.44, wrote by Typescript.
for multiline={true} not add new line and onContentSizeChange issue

https://gist.github.com/BCGen/9ba9f7d96459fd063e42bd53f9839217

@RobTS
Copy link

RobTS commented Apr 21, 2017

+1 Same here for Sony Z5 Compact. Why isn't this fixed yet? I'm a SwiftKey user as well, it seems to affect only those. Native Sony Keyboard works like a charm.

@Ehesp
Copy link
Contributor

Ehesp commented Apr 21, 2017

I don't think it's just swift key, I'm using a bog standard emulator and have the issue.

@smallpath
Copy link

Same here, totally failed on my three android devices, any updating?

@IOriens
Copy link

IOriens commented May 8, 2017

Having same issue: pressed enter and got submit triggered not entering a newline.
It works with google English input method, but all Chinese input method failed.

Platform: android 7.1.1
Input Method: Google Chinese Input Method.
RN Version: 0.44.0

@kevinluvian
Copy link
Contributor

any update on this issue?

@Thyiad
Copy link

Thyiad commented May 12, 2017

Same problem

@danielemontecchi
Copy link

I've solved setting the blurOnSubmit props to false: https://facebook.github.io/react-native/docs/textinput.html#bluronsubmit

<TextInput
	multiline={true}
	numberOfLines={4}
	blurOnSubmit={false}
/>

By default, blurOnSubmit is set to true. So every time you press enter on the keyboard, the TextInput loses focus. If instead you set this property to false, this does not happen and, with enter, go to a new line 👍

@goodhyun
Copy link

goodhyun commented Aug 8, 2017

0.48.0-rc.0 and 0.47.1 are not yet good.

@vendramini
Copy link

People, I did a search and I found other related issues opened here in github. Did someone solve this or got a better workaround than inserting newline on demand?

@holyxiaoxin
Copy link
Contributor

Tried to Build ReactAndroid from source from: https://facebook.github.io/react-native/docs/android-building-from-source.html, with this patch: e694199.

Bug still persist on Samsung keyboard and Google Chinese keyboard. Don't think this will be resolved anytime soon since this has been dragging for months. Meanwhile using wrapper class from https://gist.github.com/catchin/47afe706256604959c13dc25e7bb9383, while waiting for patch.

@shergin
Copy link
Contributor

shergin commented Aug 23, 2017

@holyxiaoxin That's sad. Probably different keyboard has different problems. 😢
Could you please share exact keyboard app name (or app id) which does not work for you?

@shergin
Copy link
Contributor

shergin commented Aug 23, 2017

@vendramini That issue discuss iOS specific problem, this one discuss Android specific one.

@ceefour
Copy link

ceefour commented Aug 27, 2017

@shergin Bug reproduced on ASUS ZenUI keyboard, Android 7.0, Expo SDK 20 / RN 0.47 ... Please try installing this keyboard

@shergin
Copy link
Contributor

shergin commented Aug 28, 2017

@ceefour Thank you! I will try!

@poongnewga
Copy link

It still has errors on Samsung Galaxy S6 keyboard also S7 keyboard.
It works fine with Google's GBoard or the default keyboard in the Android emulator.

@ceefour
Copy link

ceefour commented Aug 28, 2017

Agree with @poongnewga , this seems to be a behavior of certain third-party keyboards (which are in common usage). I think it's independent of Android version or manufacturer, since with my Asus Zenfone 3, I see similar behavior as him, i.e. the bug only occurs when I use ZenUI keyboard, and disappears when I switch to GBoard.

@superandrew213
Copy link

@shergin can you point to commit where this was fixed?

@zhangzhhz
Copy link

Finally this is fixed in 0.48. Setting blurOnSubmit={false} does it.

Fixed new line and prioritise blurOnSubmit in multiline text input (e694199) - @kevinluvian

@ceefour
Copy link

ceefour commented Sep 4, 2017

@zhangzhhz While I appreciate if it's really "fixed", the docs say

blurOnSubmit?: bool #

If true, the text field will blur when submitted. The default value is true for single-line fields and false for multiline fields.

Why the need to set to it false when it should default to false in the first place!

@ericwooley
Copy link

Probably to maintain backward comparability

@shergin
Copy link
Contributor

shergin commented Sep 4, 2017

@ceefour Do you mean that in your opinion it should be always false by default or you mean that the current behavior does not respect the docs?

@ceefour
Copy link

ceefour commented Sep 5, 2017

@shergin it doesn't respect the docs, so either one should be changed to match the other. I prefer behavior stated in the docs. much less "unexpected surprise" that way. AFAIK React Native is the only framework where setting "blurOnSubmit=false" explicitly is required on multline text input. Same component in Ionic and Xamarin just works out of the box.

@codewithpassion
Copy link

I've tried it with Expo v20 and manually moving to react-native 0.48.1.
Still no luck with Swiftkey

@RSNara
Copy link
Contributor

RSNara commented Sep 12, 2017

@codewithpassion, have you tried explicitly setting blurOnSubmit={false}?

@shergin
Copy link
Contributor

shergin commented Sep 18, 2017

@ceefour The adb6646 finally fixes issue with wrong default value on Android! 🎉

Thanks @RSNara!

@suvodeep-pyne
Copy link

Nope. Still seeing this on 0.49.0. Had to manually set blurOnSubmit={false} to get it to work.

@shergin
Copy link
Contributor

shergin commented Nov 22, 2017

@suvodeep-pyne Yep. Starting on 0.50.

@sturmenta
Copy link

I added this line and it worked correctly:
style={{minHeight: 150, height: 'auto'}}

<TextInput
	onChangeText={val => this.setState({ text: val})}
	value={this.state.text}
	multiline
	style={{minHeight: 150, height: 'auto'}}
/>

@athulmurali
Copy link

@sturmenta your solution worked for me!

@facebook facebook locked as resolved and limited conversation to collaborators Jul 23, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Jul 23, 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
None yet
Development

No branches or pull requests