react-native-phone-input
react-native-phone-input copied to clipboard
How to limit the input number to only 13 and user cannot enter invalid characters?
Hi :wave: ,
I appreciate your effort and struggle to develop this library. I just wanted to limit the input of phone number.
I didn't know is there any way exist to do this but I make some changes in index.js
on line number 196.
<View style={{ flex: 1, marginLeft: this.props.offset || 10 }}>
<TextComponent
ref={ref => {
this.inputPhone = ref;
}}
editable={!disabled}
autoCorrect={false}
style={[styles.text, this.props.textStyle]}
onChangeText={text => {
this.onChangePhoneNumber(text);
}}
keyboardType="phone-pad"
underlineColorAndroid="rgba(0,0,0,0)"
value={formattedNumber}
{...this.props.textProps}
// Custom add this to limit the number input
maxLength={13}
/>
</View>
So, would you like to add this feature or is this already exist then kindly enlighten me about this.
Thank you Happy Code! :+1:
+1
+1
Hey @badarshahzad , were you able to find a way to do this?