javascript - How to show keyboard done button in multiline text in React Native - Stack Overflow

I'm having a multiline text in my react native view. When user types , in keyboard view I need to

I'm having a multiline text in my react native view. When user types , in keyboard view I need to show done (tick mark) button. Instead of that it shows next line icon. Is there any way to achieve this. If I use text input I can do that , but I need multiple lines to be added. This is my text input

<TextInput style = {styles.contactInput}
           underlineColorAndroid="transparent"
           multiline = {true}
           placeholder="Type your feedback here"/>

I'm having a multiline text in my react native view. When user types , in keyboard view I need to show done (tick mark) button. Instead of that it shows next line icon. Is there any way to achieve this. If I use text input I can do that , but I need multiple lines to be added. This is my text input

<TextInput style = {styles.contactInput}
           underlineColorAndroid="transparent"
           multiline = {true}
           placeholder="Type your feedback here"/>
Share Improve this question edited Feb 21, 2018 at 7:13 Tomasz Mularczyk 36.3k19 gold badges118 silver badges174 bronze badges asked Feb 20, 2018 at 18:01 venuravenura 1253 silver badges15 bronze badges 3
  • The done button on the keyboard? Sorry, not entirely sure what you're looking for. – MattyK14 Commented Feb 20, 2018 at 19:09
  • 2 Are you looking to change the 'return key'? If so, there is a prop for it – MC10 Commented Feb 20, 2018 at 19:12
  • 1 @MC10 thanks. Your ment's link was broken but the URL pointed me in the right direction, so I made an answer out of it. – ahron Commented Jan 24, 2022 at 5:35
Add a ment  | 

3 Answers 3

Reset to default 1

You can add blurOnSubmit={true} in order to show the submit button rather than the return key

<TextInput style = {styles.contactInput}
           underlineColorAndroid="transparent"
           multiline = {true}
           blurOnSubmit={true}
           placeholder="Type your feedback here"/>

The ment by @MC10 points in the right direction, but the link in his ment doesn't work anymore.

The React Native TextInput has a few different return key types. I quote below from the official docs page

Determines how the return key should look.

Cross platform

The following values work across platforms:

done
go
next
search
send

So, depending on what you want your return key to look like and do, you should be able to choose one of the above values. There are other OS specific values as well which you can read in the docs.

multiline input is meant to be multiline, meaning that you need enter key to create a new line, for that reason, you cannot change enter key to anything else

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745340581a4623308.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信