React Native textInput max length

How do you set such attribute? For example the CCV field of credit card should have a max length of 3. Expiry date should have a max length of 2 for month and 4 for years.


Solution 1:

The maxLength prop is now part of React Native:

<TextInput value={this.state.text} maxLength={4} />

Solution 2:

<TextInput value={this.state.text} maxLength={1000} />

ot is working for me to set the input text length.

Solution 3:

Please make sure you are using maxLength with camel case and not maxlengh

it seems obvious but it wasn't to me when i was breaking my head trying to figure it out hope this helps