composeuisuite / ohteepee

A Simple, Customizable, Easy-to-use OTP/Pin Jetpack Compose Library
Apache License 2.0
142 stars 9 forks source link

text field stuck in second field box #5

Closed mohsiniqbalcui closed 7 months ago

mohsiniqbalcui commented 10 months ago

i am unable to enter the text field values in sumsang device but it's working fine in pixel device. your sample project is working fine but any implementation as a library getting stuck in 2nd field. Kindly sync your project or update library code

tarikyasar commented 10 months ago

Will look into it as soon as possible.

tarikyasar commented 10 months ago

@mohsiniqbalcui Hi there, just tried with a Samsung device and seems like there is no problem with my use case. Can you send yours so I can look into it furthermore.

mohsiniqbalcui commented 10 months ago

it's getting stuck in second field in sumsang a03 and in vivo s1 pro.

tarikyasar commented 10 months ago

I cannot create your issue with Samsung Galaxy S20 FE. Need more detailed scenario and code.

aliCashGate commented 8 months ago

Hi @tarikyasar Yes its stucking on the second box:

OtpInput(otpValue = otpValue, onValueChange = { newValue, isValid -> otpValue = newValue })

        @Composable

fun OtpInput(otpValue: String, onValueChange: (String, Boolean) -> Unit) {

// this config will be used for each cell
val defaultCellConfig = OhTeePeeCellConfiguration.withDefaults(
    borderColor = Color.LightGray,
    borderWidth = 1.dp,
    shape = RoundedCornerShape(16.dp),
    textStyle = TextStyle(
        color = Color.Black
    )
)

OhTeePeeInput(
    value = otpValue,
    onValueChange = onValueChange,
    configurations = OhTeePeeConfigurations.withDefaults(
        cellsCount = 6,
        emptyCellConfig = defaultCellConfig,
        cellModifier = Modifier
            .padding(horizontal = 4.dp)
            .size(48.dp),
    ),
)

}

aliCashGate commented 8 months ago

The value is not updating

canonall commented 8 months ago

I am also having the same problem with the following configurations:

var otpValue by remember { mutableStateOf("") }

    Column {
        val defaultConfig = OhTeePeeCellConfiguration.withDefaults(
            backgroundColor = MaterialTheme.colors.onSurface,
            shape = RoundedCornerShape(12.dp),
            borderColor = MaterialTheme.colors.primary,
            borderWidth = 1.dp
        )

        OhTeePeeInput(
            value = otpValue,
            onValueChange = { newValue, isValid ->
                otpValue = newValue
            },
            isValueInvalid = otpValue == "1111",
            configurations = OhTeePeeConfigurations.withDefaults(
                cellsCount = 4,
                emptyCellConfig = defaultConfig,
                activeCellConfig = defaultConfig,
                cellModifier = Modifier
                    .padding(horizontal = 4.dp)
                    .size(48.dp)
            )
        )
    }

The issue appears when using the device's keyboard. If I press a button from my computer's keyboard, the issue disappears and device's keyboard also starts working.

tarikyasar commented 8 months ago

Thanks for detailed explanation @canonall, @aliCashGate. I will be looking into it as soon as possible.

aliCashGate commented 8 months ago

@tarikyasar Any update regarding this?

tarikyasar commented 8 months ago

Hi @aliCashGate, me and @ilyasipek spent a fair amount of time trying to replicate the issue but sadly we couldn't be able to. Since it's an open source library, we would be really happy if you would give it a try :)

mlmesa2 commented 7 months ago

@tarikyasar I am also having the same problem but it happens when I use it as a library in other projects, in the example project works very well

ilyasipek commented 7 months ago

@mlmesa2 oh I see, I will try it out in another project today and let you know.

litrik commented 7 months ago

I'm also experiencing this. Interesting fact: everything worked fine when I only had a dependency on compose-bom = "2023.10.01" but as soon as I added an extra dependency on compose-material3 = "1.2.0-alpha11" it stopped working.

litrik commented 7 months ago

FYI: Specifying the alpha version of material3 means that 1.1.2 is no longer used:

androidx.compose.material3:material3:1.1.2 -> 1.2.0-alpha11

Using the alpha version of material3 pulls in a whole bunch of other alpha versions of compose libraries:

+--- androidx.compose.material3:material3:1.2.0-alpha11
|    +--- androidx.compose.foundation:foundation:1.6.0-alpha08 (*)
|    +--- androidx.compose.foundation:foundation-layout:1.6.0-alpha08 (*)
|    +--- androidx.compose.material:material-icons-core:1.6.0-alpha08
|    |    +--- androidx.compose.ui:ui:1.6.0-alpha08 (*)
|    |    \--- androidx.compose.material:material-ripple:1.6.0-alpha08 (c)
|    +--- androidx.compose.material:material-ripple:1.6.0-alpha08
|    |    +--- androidx.compose.foundation:foundation:1.6.0-alpha08 (*)
|    |    +--- androidx.compose.runtime:runtime:1.6.0-alpha08 (*)
|    |    \--- androidx.compose.material:material-icons-core:1.6.0-alpha08 (c)
|    +--- androidx.compose.runtime:runtime:1.6.0-alpha08 (*)
|    +--- androidx.compose.ui:ui-graphics:1.6.0-alpha08 (*)
|    \--- androidx.compose.ui:ui-text:1.6.0-alpha08 (*)

There's probably something in of of these alpha versions that breaks ohteepee :(

aminekarimii commented 7 months ago

I got the same issue in several devices! any updates about this problem?

ilyasipek commented 7 months ago

Fix with 1.0.4 version, can you test that. Thanks for your feedbacks and @litrik you were right it's a material3 issue we solved it after your comment thanks 🙏