Skip to content

Commit 1e7bab2

Browse files
committed
Revert "Debug why the demo fails to run and add a workaround for it"
This reverts commit d39f6ec. Remove the workaround code for issue as JetBrains/compose-multiplatform#2806 is already resolved
1 parent f449611 commit 1e7bab2

File tree

3 files changed

+9
-37
lines changed

3 files changed

+9
-37
lines changed

compose-multiplatform-material/src/androidxCommonMain/kotlin/com/huanshankeji/compose/material/ListAndLazyColumn.androidxCommon.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ import com.huanshankeji.compose.ui.toModifier
1111
actual abstract class ListElement : Element()
1212

1313
actual class ListScope(val lazyListScope: LazyListScope) {
14-
actual fun itemInternal(key: Any?, contentType: Any?, content: @Composable ItemScope.() -> Unit) =
14+
actual fun item(key: Any?, contentType: Any?, content: @Composable ItemScope.() -> Unit) =
1515
lazyListScope.item(key, contentType) { ItemScope(this).content() }
1616

17-
actual fun itemsInternal(
17+
actual fun items(
1818
count: Int,
1919
key: ((index: Int) -> Any)?,
2020
contentType: (index: Int) -> Any?,
@@ -23,7 +23,7 @@ actual class ListScope(val lazyListScope: LazyListScope) {
2323
lazyListScope.items(count, key, contentType) { ItemScope(this).itemContent(it) }
2424

2525
@OptIn(ExperimentalFoundationApi::class)
26-
actual fun groupInternal(
26+
actual fun group(
2727
key: Any?,
2828
contentType: Any?,
2929
headerContent: @Composable HeaderScope.() -> Unit,

compose-multiplatform-material/src/commonMain/kotlin/com/huanshankeji/compose/material/ListAndLazyColumn.kt

Lines changed: 3 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -7,56 +7,28 @@ import com.huanshankeji.compose.ui.ModifierOrAttrs
77

88
expect abstract class ListElement : Element
99

10-
1110
/** @see LazyListScope */
1211
expect class ListScope {
13-
/*
14-
There is a compiler bug of calling the functions below with default arguments.
15-
The issue link (already resolved): https://github.com/JetBrains/compose-multiplatform/issues/2806
16-
*/
17-
18-
internal fun itemInternal(key: Any? = null, contentType: Any? = null, content: @Composable ItemScope.() -> Unit)
12+
fun item(key: Any? = null, contentType: Any? = null, content: @Composable ItemScope.() -> Unit)
1913

20-
internal fun itemsInternal(
14+
fun items(
2115
count: Int,
2216
key: ((index: Int) -> Any)? = null,
2317
contentType: (index: Int) -> Any? = { null },
2418
itemContent: @Composable ItemScope.(index: Int) -> Unit
2519
)
2620

27-
internal fun groupInternal(
21+
fun group(
2822
key: Any? = null,
2923
contentType: Any? = null,
3024
headerContent: @Composable HeaderScope.() -> Unit,
3125
content: ListScope.() -> Unit
3226
)
3327
}
3428

35-
36-
fun ListScope.item(key: Any? = null, contentType: Any? = null, content: @Composable ItemScope.() -> Unit) =
37-
itemInternal(key, contentType, content)
38-
39-
fun ListScope.items(
40-
count: Int,
41-
key: ((index: Int) -> Any)? = null,
42-
contentType: (index: Int) -> Any? = { null },
43-
itemContent: @Composable ItemScope.(index: Int) -> Unit
44-
) =
45-
itemsInternal(count, key, contentType, itemContent)
46-
47-
fun ListScope.group(
48-
key: Any? = null,
49-
contentType: Any? = null,
50-
headerContent: @Composable HeaderScope.() -> Unit,
51-
content: ListScope.() -> Unit
52-
) =
53-
groupInternal(key, contentType, headerContent, content)
54-
55-
5629
expect class ItemScope
5730
expect class HeaderScope
5831

59-
6032
@Composable
6133
expect fun ScrollableList(modifierOrAttrs: ModifierOrAttrs<ListElement> = null, content: ListScope.() -> Unit)
6234

compose-multiplatform-material/src/jsMain/kotlin/com/huanshankeji/compose/material/ListAndLazyColumn.js.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,11 @@ actual class ListScope(
4242
}
4343

4444

45-
actual fun itemInternal(key: Any?, contentType: Any?, content: @Composable ItemScope.() -> Unit) = addComposable {
45+
actual fun item(key: Any?, contentType: Any?, content: @Composable ItemScope.() -> Unit) = addComposable {
4646
mdcListScope.ListItem { ItemScope(this).content() }
4747
}
4848

49-
actual fun itemsInternal(
49+
actual fun items(
5050
count: Int,
5151
key: ((index: Int) -> Any)?,
5252
contentType: (index: Int) -> Any?,
@@ -57,7 +57,7 @@ actual class ListScope(
5757
}
5858
}
5959

60-
actual fun groupInternal(
60+
actual fun group(
6161
key: Any?,
6262
contentType: Any?,
6363
headerContent: @Composable HeaderScope.() -> Unit,

0 commit comments

Comments
 (0)