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

Default Value is not working

Open Sharf8351 opened this issue 2 years ago • 5 comments

Default Value prop is not working for me. Please help me!

          <PhoneInput
            ref={phoneInput}
            defaultValue={phone}
            value={phone}
            defaultCode="DE"
            layout="first"
            placeholder="Emergency Phone Number*"
            codeTextStyle={{
              fontSize:
                Platform.OS === "ios" ? normalize(10) : normalize(12),
              color: colors.BLACK,
            }}
            textInputProps={{
              fontSize:
                Platform.OS === "ios" ? normalize(10) : normalize(12),
              placeholderTextColor: "gray",
              color: "black",
              height: Platform.OS == "android" ? 40 : 20,
            }}
            containerStyle={{
              backgroundColor: colors.WHITE,

              borderColor:
                phoneCheck && phone == null ? colors.ERROR : colors.BORDER,
              borderRadius: 4,
              borderWidth: 1,

              width: "100%",
              height: "5%",
              marginBottom: "20%",
            }}
            textContainerStyle={{
              backgroundColor: colors.WHITE,
              height: "100%",
              borderRadius: 0.6,
            }}
            // layout="first"
            onChangeText={(text) => {
              setPhoneNum(text);
            }}
            // onChangeFormattedText={(text) => {
            //   setFormattedValue(text);
            // }}
          />

Sharf8351 avatar Aug 01 '22 09:08 Sharf8351

You can refer to #85. See if it helps

baronchng avatar Aug 06 '22 18:08 baronchng

Check whether phone is string. It is worked for me when I added like this phone+''

Rejsal avatar Nov 29 '22 12:11 Rejsal

any updates on this issue? I am facing the same issue.

amit13091992 avatar Jan 28 '24 12:01 amit13091992

any updates on this issue? I am facing the same issue.

https://github.com/garganurag893/react-native-phone-number-input/pull/111/commits/e3f258f6246f91a9d75f018b09f23b8564801cde

check the above pull-request for the fix.

infomazeapps avatar Jan 30 '24 07:01 infomazeapps

any updates on this issue? I am facing the same issue.

e3f258f

check the above pull-request for the fix.

@infomazeapps Thanks It works.

amit13091992 avatar Feb 03 '24 10:02 amit13091992