React Native textInput max length
React NativeReact Native Problem Overview
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.
React Native Solutions
Solution 1 - React Native
The maxLength
prop is now part of React Native:
<TextInput value={this.state.text} maxLength={4} />
Solution 2 - React Native
<TextInput value={this.state.text} maxLength={1000} />
ot is working for me to set the input text length.
Solution 3 - React Native
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