garganurag893 / react-native-phone-number-input

React Native component for phone number.
MIT License
377 stars 219 forks source link

Registers callbacks for onBlur and onFocus events #165

Open den-ii opened 4 months ago

den-ii commented 4 months ago

This PR enables users run functions, like style changes e.t.c, when the phone number input is on focus or blur state.

             <PhoneInput
                ref={phoneInput}
                layout="first"
                containerStyle={{
                  borderRadius: 10,
                  borderColor: Colors.black,
                  borderWidth: 1,
                }}
                onChangeText={(text) => {
                  setValue(text);
                }}
                onFocus={() => setContainerStyle("containerActive")}
                onBlur={() => setContainerStyle("container")}
                onChangeFormattedText={(text) => {
                  setFormattedValue(text);
                }}
                textContainerStyle={{
                  borderRadius: 10,
                }}
                textInputStyle={{
                  fontFamily: "Rubik_400Regular",
                  color: Colors.black,
                }}
                withShadow
                autoFocus
              />