react-native-phone-input icon indicating copy to clipboard operation
react-native-phone-input copied to clipboard

How to limit the input number to only 13 and user cannot enter invalid characters?

Open badarshahzad opened this issue 5 years ago • 3 comments

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:

badarshahzad avatar Sep 03 '18 09:09 badarshahzad

+1

luixlacrux avatar Sep 18 '18 20:09 luixlacrux

+1

cinder92 avatar Jun 25 '19 04:06 cinder92

Hey @badarshahzad , were you able to find a way to do this?

SirPhemmiey avatar Aug 31 '20 17:08 SirPhemmiey