cashapp / redwood

Multiplatform reactive UI for Android, iOS, and web using Kotlin and Jetpack Compose
https://cashapp.github.io/redwood/0.x/docs/
Apache License 2.0
1.54k stars 66 forks source link

ComposeUI api for non-scoped Modifier unusable #2056

Open Alex009 opened 1 month ago

Alex009 commented 1 month ago

We try to use Modifier without scope. For iOS we got in WidgetFactory additional method

fun Clickable(value: UIView, modifier: Clickable)

and we can do additional configuration of UIView. but for android ComposeUI we got:

fun Clickable(value: @Composable () -> Unit, modifier: Clickable)

and we can't change @Composable lambda. we can only create new lambda.

i think better to do next api:

fun Clickable(value: T, modifier: Clickable): T

in this case we can map current value to some another to give some modifiers

JakeWharton commented 1 month ago

The original design was to return a new value, optionally, but it has quite a bit of complexity. Since we only use views and UIViews internally, it was decided to only implement the mutating version to start with.

I also don't think returning is sufficient to solve Compose UI, and the widget type of Compose UI probably needs changed to have a Modifier parameter.