Skip to content

Commit

Permalink
Rename characterLimit param to maxLength
Browse files Browse the repository at this point in the history
  • Loading branch information
msasikanth committed Sep 20, 2023
1 parent 5986aaf commit f092e91
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ import org.hisp.dhis.mobile.ui.designsystem.resource.provideStringResource
* @param notation controls the decimal notation to be used, will be European
* by default
* @param onCallActionClicked callback to when call phone number button is clicked
* @param characterLimit number of digits to be entered
* @param maxLength number of characters/digits that can be entered
*/
@Composable
fun InputPhoneNumber(
title: String,
onCallActionClicked: () -> Unit,
modifier: Modifier = Modifier,
characterLimit: Int = 10,
maxLength: Int = 12,
state: InputShellState = InputShellState.UNFOCUSED,
legendData: LegendData? = null,
inputText: String? = null,
Expand All @@ -44,7 +44,7 @@ fun InputPhoneNumber(
imeAction: ImeAction = ImeAction.Next,
notation: RegExValidations = RegExValidations.PHONE_NUMBER,
) {
val hasPhoneNumber = inputText?.length == characterLimit
val hasPhoneNumber = inputText?.length == maxLength
val supportingText = if (state == InputShellState.ERROR) {
listOf(
SupportingTextData(
Expand All @@ -65,7 +65,7 @@ fun InputPhoneNumber(
isRequiredField = isRequiredField,
onNextClicked = onNextClicked,
onValueChanged = {
if ((it?.length ?: 0) <= characterLimit) {
if ((it?.length ?: 0) <= maxLength) {
onValueChanged?.invoke(it)
} else {
// no-op
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ class InputPhoneNumberTest {
InputPhoneNumber(
title = "Phone Number",
inputText = inputValue,
maxLength = 10,
onValueChanged = {
if (it != null) {
inputValue = it
Expand Down

0 comments on commit f092e91

Please sign in to comment.