Skip to content
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

iOS TextField issues with Center and Right text alignment #3098

Closed
etolstoy opened this issue Apr 24, 2023 · 1 comment · Fixed by JetBrains/compose-multiplatform-core#1354
Assignees
Labels
bug Something isn't working ios text

Comments

@etolstoy
Copy link
Contributor

Describe the bug
There are some bugs with Center or Right text alignment on iOS. Sample code:

TextField(
        value = text,
        onValueChange = {
            text = it
        },
        textStyle = LocalTextStyle.current.copy(textAlign = TextAlign.Right),
    )

Bug #1: In empty TextField the caret is placed always on the left side, and doesn't respect text alignment. Same happens with each new line.

2023-04-24.17.11.32.mov

Bug #2: With Right layout a whitespaces after a symbol aren't displayed until a next symbol is entered. It works fine with Left and Center layouts.

2023-04-24.17.15.32.mov

Affected platforms

  • iOS

Versions

  • Kotlin version*: 1.8.20
  • Compose Multiplatform version*: 1.4.0
@etolstoy etolstoy added bug Something isn't working submitted labels Apr 24, 2023
@dima-avdeev-jb dima-avdeev-jb changed the title TextField issues with Center and Right text alignment iOS TextField issues with Center and Right text alignment Jun 19, 2023
@mazunin-v-jb
Copy link
Contributor

@dima-avdeev-jb checked on Android as requested:

  1. caret is being showed according to TextField's text alignment
  2. whitespace after word is showing correctly on right text alignment

mazunin-v-jb added a commit to JetBrains/compose-multiplatform-core that referenced this issue Jun 11, 2024
…set explicitly (#1354)

After focusing on the textfield and before entering any text, now
blinking cursor will be positioned in accordance with TextAlignment.

Fixes https://youtrack.jetbrains.com/issue/COMPOSE-1360/
Fixes JetBrains/compose-multiplatform#2711
Fixes JetBrains/compose-multiplatform#3098
Fixes JetBrains/compose-multiplatform#4611

## Testing
Manual testing.

## Release Notes
<!--
Optional, if omitted - won't be included in the changelog

Sections:
- Highlights
- Known issues
- Breaking changes
- Features
- Fixes

Subsections:
- Multiple Platforms
- iOS
- Desktop
- Web
- Resources
- Gradle Plugin
-->
### Fixes - Multiple Platforms
- Fix initial cursor position in the empty `TextField` with explicitly
set `TextAlignment`.

## Google CLA
You need to sign the Google Contributor’s License Agreement at
https://cla.developers.google.com/.
This is needed since we synchronise most of the code with Google’s AOSP
repository. Signing this agreement allows us to synchronise code from
your Pull Requests as well.

---------

Co-authored-by: Ivan Matkov <ivan.matkov@jetbrains.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working ios text
Projects
None yet
3 participants