Skip to content

Conversation

MagicalMeghan
Copy link
Contributor

Update issue in state based TF snippets

Copy link

snippet-bot bot commented Sep 10, 2025

Here is the summary of changes.

You are about to add 1 region tag.
You are about to delete 1 region tag.

This comment is generated by snippet-bot.
If you find problems with this result, please file an issue at:
https://github.com/googleapis/repo-automation-bots/issues.
To update this comment, add snippet-bot:force-run label or use the checkbox below:

  • Refresh this comment

Copy link

@objcode objcode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

}
val phoneNumberState = rememberTextFieldState("123456789")

TextField(
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggest two changes to this sample: Specify keyboard options (since it will be copy/paste) and add maxLength

TextField(
    state = phoneNumberState,
    keyboardOptions = KeyboardOptions(
        keyboardType = KeyboardType.Phone
    ),
    inputTransformation = InputTransformation.maxLength(10).then {
        if (asCharSequence().isDigitsOnly()) {
            revertAllChanges()
        }
    },
    outputTransformation = OutputTransformation {
        if (length > 0) insert(0, "(")
        if (length > 4) insert(4, ")")
        if (length > 8) insert(8, "-")
    }
)

Copy link

@objcode objcode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving. Please update the input transformaiton example to merge

@MagicalMeghan MagicalMeghan merged commit 9436a8d into main Sep 11, 2025
5 checks passed
@MagicalMeghan MagicalMeghan deleted the update-state-based branch September 11, 2025 05:29
dturner added a commit that referenced this pull request Sep 23, 2025
* main: (74 commits)
  Add basic WindowInsetsRulers cases (#621)
  Adding shadows code snippets (#620)
  Update the wear preview code
  Update state based (#619)
  add WindowInsetsRulers snippet (#616)
  Migrate snippets from dac/training/wearables/tiles/screen-size (#617)
  Resolve warnings in the Wakelock code snippets (#615)
  Disabling some "unused" warnings (#610)
  Add android_wear_tile_version_fallback (#614)
  Add viewmodel screen for KMP (#613)
  Fix missing snippet (#612)
  Add KMP ViewModel snippets (#611)
  docs(modifiers): Add TODOs for inspectableProperties lint warnings (#589)
  Fix: Prevent memory leak from implicit SAM conversion (#588)
  Fix(gestures): Handle pointer events inside awaitPointerEventScope (#590)
  Lint: Use specialized state holders to avoid autoboxing (#591)
  Refactor: Rename Composable functions to follow naming conventions (#592)
  Refactor(text): Use KTX extension for isDigitsOnly check (#593)
  Refactor(SearchBar): Reorder modifier parameter to follow convention (#594)
  Add padding to avoid overwriting TimeText (#529)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants