-
Notifications
You must be signed in to change notification settings - Fork 261
Update state based #619
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update state based #619
Conversation
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.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. a few suggestions to make example more copy/paste able
You can see sample here for more details https://cs.android.com/androidx/platform/frameworks/support/+/androidx-main:compose/foundation/foundation/samples/src/main/java/androidx/compose/foundation/samples/BasicTextFieldSamples.kt?q=BasicTextFieldCustomInputTransformationSample
} | ||
val phoneNumberState = rememberTextFieldState("123456789") | ||
|
||
TextField( |
There was a problem hiding this comment.
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, "-")
}
)
There was a problem hiding this 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
* 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) ...
Update issue in state based TF snippets