Ali Khiti
Ali Khiti

Reputation: 275

React native TextInput going off my screen

I want to have a TextInput with react native to wrap to the next line once the text goes over the line. I read the docs and I saw the multiline prop. The problem with multiline set to true is that when you hit return key it goes to a new line.

Is there a way that you can have a multiline TextInput with react native with the return to new line disabled?

Upvotes: 0

Views: 604

Answers (2)

Asusoft
Asusoft

Reputation: 362

Try this:

<TextInput
   value={}
   onChangeText={}
   returnKeyType= "send" or "done" //depending on what you want to do.
   multiline
   />

Or just put the returnKeyType="" and look at the suggestions to choose your desired action.

Upvotes: 0

Luechen
Luechen

Reputation: 101

You could try this:

<TextInput
  multiline={true}
  value={this.state.fieldValue}
  onChangeText={(text) => { this.setState({ fieldValue: text.replace('\n', '') }) }} />

Upvotes: 1

Related Questions