r5n-labs / react-native-otp-inputs

OTP inputs for React-Native
MIT License
249 stars 91 forks source link

Keyboard closes after entering each input if custom "inputContainerStyles" is specified #237

Closed jp-xbox-gaming closed 4 years ago

jp-xbox-gaming commented 4 years ago

While trying to create OTP inputs with 6 digits and custom styles as shown below, Keyboard is getting dismissed after user enters each single input.

<OtpInputs
  numberOfInputs={6}
  keyboardType="number-pad"
  autofillFromClipboard={false}
  handleChange={otp => console.log(otp)}
  inputContainerStyles={{ height: 53 }}
  inputStyles={{
    color: "#607ca8",
    fontSize: 25,
    textAlign: "center",
    paddingVertical: 5,
    paddingHorizontal: 8,
    borderWidth: 1,
    borderRadius: 5,
    borderColor: "#adb6bc",}}
  style={{
    flexDirection: "row",
    alignItems: "center",
    justifyContent: "space-between",
    marginTop: 20,
    marginBottom: 5,
  }}
/>

If inputContainerStyles={{ height: 53 }} is commented/removed, everything works fine. Except that it adds the default style which gives bottom border to all the input fields. The only way to avoid bottom border is to provide custom inputContainerStyles which strangely seems to be affecting Keyboard dismiss behavior.

This behavior was observed while using react-native-otp-inputs version "5.0.0-alpha.0" on Android studio's Pixel 3 emulator running Android Pi.

ELBEQQAL94 commented 2 years ago

You have to remove keyboardType="number-pad" that's work for me

ELBEQQAL94 commented 2 years ago

Same problem for me, Any update on this issue?

baladin commented 1 year ago

I have similar issue. In my case anything in focusStyle causes the keyboard to be dismissed after each input.

  focusStyles={{
    borderBottomColor: "#00284F",
    borderBottomWidth: 1
  }}

removing it, works perfectly.

manjuy124 commented 9 months ago

I have similar issue. In my case anything in focusStyle causes the keyboard to be dismissed after each input.

  focusStyles={{
    borderBottomColor: "#00284F",
    borderBottomWidth: 1
  }}

removing it, works perfectly.

Its worked!

Looks like these issue is happening again on latest versions.