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

Refactor UIKit interop implementation #1411

Merged
merged 18 commits into from
Jun 27, 2024

Conversation

elijah-semyonov
Copy link

@elijah-semyonov elijah-semyonov commented Jun 19, 2024

Refactor UIKit interop implementation:

  1. Extract UIKitView and UIKitViewController common part to UIKitInteropLayout.
  2. Move all non-Compose logic to InteropComponentHandler.
  3. Merge UIKitInteropContext into UIKitInteropContainer.

Copy link
Member

@MatkovIvan MatkovIvan left a comment

Choose a reason for hiding this comment

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

Just a minor feedback regarding naming. LGTM overall

Comment on lines 161 to 140
EmptyLayout(
modifier.onGloballyPositioned { coordinates ->
val finalModifier = modifier
Copy link
Member

Choose a reason for hiding this comment

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

It was easier without extra val

Copy link
Author

Choose a reason for hiding this comment

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

Way too much indentation and it's an idiom used in the common source set as well

val coreTextFieldModifier = Modifier
// min height is set for maxLines == 1 in order to prevent text cuts for single line
// TextFields
.heightIn(min = state.minHeightForSingleLineField)
.heightInLines(
textStyle = textStyle,
minLines = minLines,
maxLines = maxLines
)
.overscroll()
.textFieldScroll(
scrollerPosition = scrollerPosition,
textFieldValue = value,
visualTransformation = visualTransformation,
textLayoutResultProvider = { state.layoutResult },
)
.then(cursorModifier)
.then(drawModifier)
.textFieldMinSize(textStyle)
.then(onPositionedModifier)
.then(magnifierModifier)
.bringIntoViewRequester(bringIntoViewRequester)

Copy link
Member

Choose a reason for hiding this comment

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

indentation is the same, isn't it?

@elijah-semyonov elijah-semyonov marked this pull request as draft June 19, 2024 10:42
@elijah-semyonov
Copy link
Author

I'll do some more stuff along this PR

@elijah-semyonov elijah-semyonov marked this pull request as ready for review June 26, 2024 07:45
@@ -38,35 +40,124 @@ internal val LocalUIKitInteropContainer = staticCompositionLocalOf<UIKitInteropC
error("UIKitInteropContainer not provided")
}


internal enum class UIKitInteropState {
Copy link
Collaborator

Choose a reason for hiding this comment

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

IMHO, interop and enum values are too generic.
Could you please add brief comment explaining why this enum used?

Copy link
Author

Choose a reason for hiding this comment

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

Yeah, sure

@elijah-semyonov elijah-semyonov merged commit 11dfc9f into jb-main Jun 27, 2024
8 checks passed
@elijah-semyonov elijah-semyonov deleted the es/refactor-uikit-interop branch June 27, 2024 11:02
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