Hildebrandt Tobias
04/17/2025, 9:50 AMwith(this)
out here?
/**
* FC with Internationalization
*/
fun <P : Props> FCI(
block: @ReactDsl context(IntlShape) ChildrenBuilder.(P) -> Unit,
) = FC<P> { props ->
val intl = useIntl()
block(intl, this, props)
}
val TestView = FCI<Props> { props ->
with(this) {
Grid { /* works */ }
}
Grid {
/** 'fun <P : Props> ElementType<P>.invoke(noinline block: @JsoDsl() P.() -> Unit): Unit'
* cannot be called in this context with an implicit receiver.
* Use an explicit receiver if necessary.
*/
}
}
The only other way I found would have been to have IntlShape
as a value parameter so that it is always in the lambda parameters.Youssef Shoaib [MOD]
04/17/2025, 9:52 AMGrid
method that takes a context parameter, and delegates to the normal methodHildebrandt Tobias
04/17/2025, 10:00 AMGrid
comes from Kotlin-Wrappers and there are hundres of others like it.
I hope that the folks over there provide those Bridge methods 😞
Thank you for your help.Youssef Shoaib [MOD]
04/17/2025, 10:02 AM