Merged
Conversation
dd397ec to
c0251cd
Compare
7b04420 to
78ec253
Compare
a2d64d8 to
e1a2e1f
Compare
c4fb706 to
d3380e7
Compare
4a3c226 to
2fbdaaf
Compare
Author
|
Folks, I think this PR is ready for review, I'm only going to add automated tests for that soon and do review / small refactor fixes |
ASalavei
reviewed
Feb 2, 2026
...undation/foundation/src/iosMain/kotlin/androidx/compose/foundation/text/CoreTextField.ios.kt
Show resolved
Hide resolved
ASalavei
reviewed
Feb 2, 2026
...ose/ui/ui/src/iosMain/kotlin/androidx/compose/ui/platform/UIKitNativeTextInputContext.ios.kt
Show resolved
Hide resolved
ASalavei
reviewed
Feb 2, 2026
...ose/ui/ui/src/iosMain/kotlin/androidx/compose/ui/platform/UIKitNativeTextInputContext.ios.kt
Show resolved
Hide resolved
ASalavei
reviewed
Feb 2, 2026
...undation/foundation/src/iosMain/kotlin/androidx/compose/foundation/text/CoreTextField.ios.kt
Outdated
Show resolved
Hide resolved
ASalavei
reviewed
Feb 2, 2026
...osMain/kotlin/androidx/compose/foundation/text/input/internal/TextFieldCoreModifier.macos.kt
Outdated
Show resolved
Hide resolved
ASalavei
reviewed
Feb 2, 2026
...ui/src/skikoMain/kotlin/androidx/compose/ui/platform/PlatformTextInputMethodRequest.skiko.kt
Outdated
Show resolved
Hide resolved
ASalavei
reviewed
Feb 2, 2026
compose/ui/ui/src/iosMain/kotlin/androidx/compose/ui/window/IntermediateTextInputUIView.ios.kt
Outdated
Show resolved
Hide resolved
ASalavei
reviewed
Feb 2, 2026
...ose/ui/ui/src/iosMain/kotlin/androidx/compose/ui/platform/UIKitNativeTextInputContext.ios.kt
Outdated
Show resolved
Hide resolved
ASalavei
reviewed
Feb 3, 2026
compose/ui/ui-text/src/iosMain/kotlin/androidx/compose/ui/text/input/PlatformImeOptions.ios.kt
Outdated
Show resolved
Hide resolved
ASalavei
reviewed
Feb 3, 2026
...foundation/foundation/src/iosMain/kotlin/androidx/compose/foundation/text/ContextMenu.ios.kt
Show resolved
Hide resolved
svastven
reviewed
Feb 17, 2026
compose/ui/ui/src/iosMain/kotlin/androidx/compose/ui/platform/UIKitTextInputService.ios.kt
Outdated
Show resolved
Hide resolved
svastven
reviewed
Feb 17, 2026
compose/ui/ui/src/iosMain/kotlin/androidx/compose/ui/window/IntermediateTextInputUIView.ios.kt
Outdated
Show resolved
Hide resolved
svastven
reviewed
Feb 17, 2026
compose/ui/ui/src/iosMain/kotlin/androidx/compose/ui/platform/UIKitTextInputService.ios.kt
Outdated
Show resolved
Hide resolved
svastven
reviewed
Feb 17, 2026
compose/ui/ui/src/iosMain/kotlin/androidx/compose/ui/platform/UIKitTextInputService.ios.kt
Outdated
Show resolved
Hide resolved
7294c0c to
ea67b61
Compare
igordmn
previously requested changes
Feb 17, 2026
...c/commonMain/kotlin/androidx/compose/foundation/text/input/internal/TextFieldCoreModifier.kt
Show resolved
Hide resolved
The blockers from my feedback above were resolved
cc1cd03 to
b19d9aa
Compare
- fixed no-op context menu items with isNewContextMenu flag enabled - renamed defaultCursor back to cursor to minimize changes with AOSP - small review fixes - removed @composable annotations from CoreTextField expect/actuals, refactored to `composed` in iOS actuals - fixed objc project after rebasing, sorted imports in CMPUIKitUtils.h alphabetically - remove debug background - fixed if condition in firstSelectionRectForRange - Refactored TextInsets to use dp and toPlatformInsets to use pixels, updated the related logic in the IntermediateTextInputUIView.ios.kt and UIKitTextInputService.ios.kt - optimized unclippedTextOffsetInRoot calculation in LegacyPlatformTextInputServiceAdapter.skiko.kt - removed @internalComposeUIApi from UIKitTextInputService - review fix - omit the `Modifier.` in the CoreTextField actuals, updated android actuals - renamed textFieldCursor, textFieldDraw functions to meet the lint rules of androidx - review fixes: updated year, updated android implementation, added comma in the examples, renamed jsWasm to web - refactored CMPEditMenuCustomAction initWithTitle - renamed forgotten textUnclippingOffsetInRoot to unclippedTextOffsetInRoot - refactored cursor drawing logic on BTF2: changed signature of TextFieldCoreModifierNode.drawCursor, moved cursor drawing logic into TextFieldCoreModifierNode.drawDefaultCursor, removed unnecessary private drawCursor method - minor review fixes - added extension parameter to the TextFieldCoreModifierNode.drawDefaultCursor - moved CATransaction.flush() call to the end of updateView closure - removed unused targetRect parameter - renamed methods of UIKitNativeTextInputContext - refactored condition in internal actual fun TextFieldCoreModifierNode.drawCursor( - once again renamed niti to the native text input - renamed `textUnclippingOffsetInRoot` to the `unclippedTextOffsetInRoot` - refactored a drawSelectionHighlight for BTF2, removed redunant drawSelection - wrapped isNativeTextInputProvider() call into snapshotFlow - applied fixes of wrapping context.usingNativeTextInput() in the snapshotFlow in the ContextMenu.ios.kt to avoid race conditions - splitted updateView closure into NITI and non-NITI, reverted wrapping updateView for non-NITI path into mainScope (coroutineScope) - finally wrapped usingNativeTextInput to the mutableState - fixed non-optional casting to the IntermediateTextPosition in the characterOffsetOfPosition method - refactored updating tint color logic with passing null if current LocalTextSelectionColors is the default one - renamed ContextMenuCustomAction to the UIKitNativeTextInputContextMenuCustomAction, updated API dump - fixed typo in the actuals of Modifier.textFieldCursorModifier( - reverted TextFieldDelegate to the jb-main state - updated NITITextFields examples - forwarded selection color to the UIKitTextInputService if it differs from default one, removed updateCursorThickness method (it was redundant), added documentation for the UIKitNativeTextInputContext - changed the way of disabling compose cursor and selection area in BTF1 for native text input in iOS - changed data class ContextMenuCustomAction to class - use remember in ContextMenuArea to avoid recreating of lambdas, modify update method of NativeTextInputContextMenuUpdaterNode to avoid extra restarts - used MainScope in MemoryLeaksTest (due to changes in IntermediateTextInputUIView) and properly canceled it in tearDown - upd api dump - reverted TextToolbarStatus in UIKitTextInputService.ios.kt, split logic there with `usingNativeTextInput` - fixed doc: added parameter drawSelectionHighlight - removed `platform` prefix from expect/actuals - changing extension class of functions drawPlatformCursor and drawPlatformSelection from CompositionLocalConsumerModifierNode to the TextFieldCoreModifierNode, removed extension class from drawDefaultCursor - passed CoroutineContext from the ComposeSceneMediator.ios.kt to the UIKitTextInputService.ios.kt and IntermediateTextInputUIView.ios.kt - fixed bug with incorrect menu positioning in both cases - small review fixes - added task mention for adoption NITI in the SelectionContainer - hidden CMPEditMenuCustomAction from public exposure, introduced Kotlin wrapper for that - still renaming - continue renaming niti to nativeTextInput, review fixes - try to fix `testRefocusByTapKeyboardSizeNotChanges` test - regenerated api dump - renamed forgotten `usingNativeInputHandling` places to `usingNativeTextInput` - renamed `usingNativeInput` and similar places to `usingNativeTextInput` - documented textUnclippingOffsetInRoot, added comments about scroll synchronization, changed IntermediateTextScrollView to lazy init - moved default empty UIKitNativeTextInputContext implementation to LocalNativeTextInputContext - changed @ExperimentalComposeUiApi to the @InternalComposeUiApi for the UIKitNativeTextInputContext - renamed UIKitNativeTextInputContext to UIKitNativeTextInputContext.ios - fixed some todo's in IntermediateTextInputUIView.ios.kt - renamed uikit actuals to ios - removed outdated todos - cleaned up showMenu logic in UIKitTextInputService.ios.kt - restored accidentally deleted workaround with dictation - corrected the year and the title in NITITextFields - moved NITI Examples from TextFields examples to the iOS-specific features and moved them from common to iOS source set, updated NITI Examples deleted supplementary expect/actual in PlatfromImeHelpers, reverted TextFields.kt to the jb-main state - fixing issue with multiplied text scroll views after switching focus - provided default Skiko implementation of selection handles for macOS - moved incorrectly created actuals for desktop from jvm to desktop sourceset - updated .api file - provide default value for using native input in ios instrumented tests - provided default empty implementation for UIKitNativeTextInputContext - update api dump - fix in skiko RootNodeOwnerTest, fixed formatting in SelectionHandles.jsWasm.kt - fixed redrawer crash with non-niti scenario - rewrote context menu updating logic for NITI (changed to "update by selection change") - fixed incorrect renaming after rebase - deleted debug prints - fixed crashes during text input in NITI which had been caused by the late update of TextLayoutResult, reverted hack with checking MultiParagraph text length - Fixed crash with text autocorrection - Fix cursor width, fix context menu appearance by cursor tap - Fix tint color - Fix text field cursor activation - fixed generated comments in IOSSkikoInput.uikit.kt - clean up IntermediateTextInputUIView.uikit.kt - removed unnecessary imports from IntermediateTextInputUIView.uikit.kt, removed unnecessary method from IOSSkikoInput.uikit.kt - reverted observeSelectionChanges in commonMain part of BTF2, which seem unnecessary - reverted accidental commit of debug flags - remove unnecessary macos actuals, added one universal macos actual - fixed CMPUtils header - reverting unnecessary changes - xcodeproj fixes - Fixed lack of items in the context menu with NITI - Forwarded cursor / selection colors in TF1 / TF2 - Disabled Compose cursor in NITI mode in both TFs - Created expect / actual for the Compose text selection highlight in TF1, hidden it under NITI flag in uikit sourceset - Renamed UIKitTextContextMenuHandler.kt into more appropriate UIKitNativeTextInputContext - Created expect / actual for altering drawing selection rect on different platforms - fixed incorrect positioning of context menu - disabled back newContextMenu flag, rewrote showEditMenu logic in UIKitTextInputService.uikit.kt with using NITI toggle, created a signle entry point for context menu, removed some comments - context menu without NITI fixes + added existing obj-c files to the project which were forgotten to add during the merge - merge fixes after commit with refactoring InputViews.uikit.kt - Reverted pointerInput handling in TF1,2, reverted view hierarchy, hidden almost everything related to the NITI under the flag, added some TODOs with bad fixes - Added feature flag for NITI to platform ime options - added NITI tests screens to the example app - Forwarded custom actions to the IntermediateTextInputUIView.uikit.kt - Enabled native context menu, added public API for updating context menu state (foundation -> ui), extracted all UITextInput methods from objc file to separate class, temporarily disabled current context menu - Extracted UITextInput methods from CMPEditMenuView to CMPTextInputView, fixed NewContextMenuApi menu - (wip) commented CMPEditMenu methods calls after rebase with new context menu api on ios - (wip) turned on native selection rects (LTR only!) + fixed appearing of the text editing menu by tapping on the selection rects + more appropriate naming + fixed imports - (wip) disabled custom iOS tap handlers in TF1,2 - (wip) fixed native text views positioning in TF1 - (wip) disabled compose selection handles - (wip) fixed scroll positioning in BTF2 - (wip) fixed touch forwarding - (wip) fixed positioning of ScrollView and TextView issue - (wip) removed unnecessary comments - (wip) fixed sizing of TextScrollView and TextView - (wip) transfered changes from previous niti branch - (wip) rebase fixes
a397126 to
5a0f7e3
Compare
igordmn
reviewed
Mar 3, 2026
Collaborator
igordmn
left a comment
There was a problem hiding this comment.
LGTM regarding commonMain changes.
…ntermediateTextInputUIView
ASalavei
reviewed
Mar 3, 2026
compose/ui/ui-uikit/src/iosMain/objc/CMPUIKitUtils/CMPUIKitUtils/CMPEditMenuView.m
Outdated
Show resolved
Hide resolved
ASalavei
approved these changes
Mar 3, 2026
MatkovIvan
approved these changes
Mar 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This change introduces an opt-in Native iOS Text Input (NITI) mode for Compose
TextFieldon iOS, enabled viaPlatformImeOptions.usingNativeTextInput(enabled)in the iOS source setWith the flag set to
true, Compose text fields use UIKit-native text editing and interaction behavior, details in the release notesFixes:
https://youtrack.jetbrains.com/issue/CMP-8208/Implement-iOS-native-text-input
https://youtrack.jetbrains.com/issue/CMP-332
Key changes
PlatformImeOptionsflag:usingNativeTextInputUIKitTextInputService.ios.ktIntermediateTextInputUIView.ios.ktContextMenu.ios.ktsetNeedsRedrawwith an explicitdraw()call inupdateViewclosure inUIKitTextInputServiceto eliminate a race condition between UIKitUITextInputqueries andTextLayoutResultupdates. This could leave iOS with stale text field state, which in NITI mode resulted in incorrect caret positioning and a crash. The fix applies to both NITI and non-NITI scenarios (non-NITI impact was largely not user-visible)LaunchedEffect(throughstartNotifyingAboutContextMenuItems).isNewContextMenu = true): updates viaNitiContextMenuUpdaterElement.CMPEditMenuCustomActionCMPTextInputStringTokenizerCMPTextInputViewto ensure correct UIKit text input behavior in NITI mode.CMPEditMenuViewnow inherits fromCMPTextInputViewto unify UIKit text input handling for edit menu interactionsAdded API
UIKitNativeTextInputContextuiandfoundationmodulesLocalNativeTextInputContextUIKitNativeTextInputContextPlatformTextInputMethodRequest.textUnclippingOffsetInRootIntermediateTextInputUIViewsize/position when extra margins are applied and/or when the text field needs to be scrollableTesting
Manual
Create an expect/actual for KeyboardOptions
Common source set:
iOS source set:
Then use it on any
TextFieldin common code (BasicTextField(TextFieldState)as an example):Build an iOS application, go iOS-specific features -> NITI Examples
Automated
Release Notes
Features - iOS
BasicTextField(bothTextFieldValueandTextFieldState) enabled viaPlatformImeOptions.useNativeInputHandling(enabled)in iOS source settrue,BasicTextFielduses native UIKit editing and interaction, including: