CodenameOne icon indicating copy to clipboard operation
CodenameOne copied to clipboard

Constraint(TextField.NUMERIC|TextField.NON_PREDICTIVE) NOT WORK ON IOS

Open DurankGts opened this issue 9 months ago • 5 comments

please provide a solutions to this contraint that doesn't work in TextField and TextArea

tfTokenDigit1.setConstraint(TextField.NUMERIC|TextField.NON_PREDICTIVE);

DurankGts avatar Mar 06 '25 14:03 DurankGts

Does it work for tfTokenDigit1.setConstraint(TextField.NUMERIC); ?

shai-almog avatar Mar 07 '25 04:03 shai-almog

yes but NO_PREDICTIVE does'nt work

DurankGts avatar Mar 19 '25 21:03 DurankGts

Does NUMERIC without NON_PREDICTIVE include any predictive aspects?

When you say "not work" please elaborate. Is it crashing?

Is it showing text input instead of numeric input?

Is it showing predictive content?

shai-almog avatar Mar 21 '25 05:03 shai-almog

is showing predictive content

DurankGts avatar Apr 02 '25 19:04 DurankGts

Looking at the code here https://github.com/codenameone/CodenameOne/blob/master/Ports/iOSPort/nativeSources/CodenameOne_GLViewController.m#L367

It seems that prediction is turned off just before the numeric constraint for the single line edit. This should work out of the box for simple text fields. I don't see this for multi-line fields though. Check that:

  • You're using TextField and not TextArea
  • You didn't invoke setSingleLineTextArea(true)
  • You don't have a custom third party keyboard or similar configuration that might ignore our settings

Assuming all of the above please include a self contained sample and screenshot to verify the prediction. Also include iOS versions tested.

shai-almog avatar Apr 06 '25 02:04 shai-almog