Open franklinblanco opened 20 hours ago
Using v2.14
of xmaterialccp
& Kotlin v2.0.0
allright am on it @franklinblanco
https://github.com/user-attachments/assets/1a0092d7-66d0-45e7-8a81-89911689d36a
@TuleSimon I managed to reproduce the error but it is not with the same country that is happening with my app, see the attached video.
Fatal Exception: java.lang.IllegalStateException: OffsetMapping.transformedToOriginal returned invalid mapping: 0 -> -1 is not in range of original text [0, 10]
at androidx.compose.foundation.text.ValidatingOffsetMappingKt.validateTransformedToOriginal(ValidatingOffsetMapping.kt:28)
at androidx.compose.foundation.text.ValidatingOffsetMappingKt.throwIfNotValidTransform(ValidatingOffsetMapping.kt:58)
at androidx.compose.foundation.text.ValidatingOffsetMappingKt.throwIfNotValidTransform$default(ValidatingOffsetMapping.kt:58)
at androidx.compose.foundation.text.ValidatingOffsetMappingKt.filterWithValidation(ValidatingOffsetMapping.kt:58)
at androidx.compose.foundation.text.CoreTextFieldKt.CoreTextField(CoreTextField.kt:32)
at androidx.compose.foundation.text.BasicTextFieldKt.BasicTextField(BasicTextField.kt:6)
at androidx.compose.material3.OutlinedTextFieldKt$OutlinedTextField$3.invoke(OutlinedTextField.kt:231)
at androidx.compose.material3.OutlinedTextFieldKt$OutlinedTextField$3.invoke(OutlinedTextField.kt:16)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:54)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:54)
at androidx.compose.runtime.CompositionLocalKt.CompositionLocalProvider(CompositionLocal.kt:225)
at androidx.compose.material3.OutlinedTextFieldKt.OutlinedTextField(OutlinedTextField.kt:16)
at com.simon.xmaterialccp.component.MaterialCountryCodePickerKt.MaterialCountryCodePicker-EcZREWE(MaterialCountryCodePicker.kt:75)
at br.com.b8.raffle.ui.raffle.RaffleScreenKt$RaffleScreen$9$2$1.invoke(RaffleScreen.kt:852)
at br.com.b8.raffle.ui.raffle.RaffleScreenKt$RaffleScreen$9$2$1.invoke(RaffleScreen.kt:852)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:46)
at androidx.compose.runtime.internal.ComposableLambdaImpl$invoke$1.invoke(ComposableLambdaImpl.java:62)
at androidx.compose.runtime.internal.ComposableLambdaImpl$invoke$1.invoke(ComposableLambdaImpl.java:52)
at androidx.compose.runtime.RecomposeScopeImpl.compose(RecomposeScopeImpl.java:585)
at androidx.compose.runtime.ComposerImpl.recomposeToGroupEnd(Composer.kt:585)
at androidx.compose.runtime.ComposerImpl.skipCurrentGroup(Composer.kt:130)
at androidx.compose.runtime.ComposerImpl.doCompose(Composer.kt:239)
at androidx.compose.runtime.ComposerImpl.recompose$runtime_release(Composer.kt:30)
at androidx.compose.runtime.CompositionImpl.recompose(Composition.kt:21)
at androidx.compose.runtime.Recomposer.performRecompose(Recomposer.kt:113)
at androidx.compose.runtime.Recomposer.access$performRecompose(Recomposer.kt:113)
at androidx.compose.runtime.Recomposer$runRecomposeAndApplyChanges$2$1.invoke(Recomposer.kt:612)
at androidx.compose.runtime.Recomposer$runRecomposeAndApplyChanges$2$1.invoke(Recomposer.java:612)
at androidx.compose.ui.platform.AndroidUiFrameClock$withFrameNanos$2$callback$1.doFrame(AndroidUiFrameClock.android.kt:1)
at androidx.compose.ui.platform.AndroidUiDispatcher.performFrameDispatch(AndroidUiDispatcher.java:48)
at androidx.compose.ui.platform.AndroidUiDispatcher.access$performFrameDispatch(AndroidUiDispatcher.java:48)
at androidx.compose.ui.platform.AndroidUiDispatcher$dispatchCallback$1.doFrame(AndroidUiDispatcher.android.kt:48)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1404)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1415)
at android.view.Choreographer.doCallbacks(Choreographer.java:1015)
at android.view.Choreographer.doFrame(Choreographer.java:941)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1389)
at android.os.Handler.handleCallback(Handler.java:959)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loopOnce(Looper.java:232)
at android.os.Looper.loop(Looper.java:317)
at android.app.ActivityThread.main(ActivityThread.java:8592)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:580)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:878)
Hey! First of all I want to thank you a lot for your work on this Widget. It saves a lot of us a bunch of time and looks amazing plus it's extremely customizable. I've integrated it into my upcoming app, and am encountering this error seemingly out of nowhere.
Replication steps
(This is what I did, not necessarily what needs to be done to trigger the crash) Using an American phone number country code, type the number 98612345 (Or any other number that isn't valid, that doesn't trigger the automatic addition of parenthesis) by the time you get to type the number 5 it crashes the entire app.
Possible fix
A google search of the exception says that it's got to do with the visualTransformation applied to the MaterialCountryCodePicker.
Complete error log:
Again, thank you so much for your work. I don't expect this to be fixed or you to put more time into it. Just trying to report the issue.