How to preview hoist component in AS that have as ...
# compose
c
How to preview hoist component in AS that have as argument also function with multi parameter?
ComponentToPreview(
data = dataAsState....,
function1FromViewModel : (String) -> Unit,
function2FromViewModel : (String, Int) -> Unit,
....
)
ScreenViewModel(): ViewModel() {
fun function1(text: String) {
.....
}
fun function2(text: String, number: Int) {
.....
}
}
for a single argument function on the preview I can pass empty function function1FromViewModel = {} for function2FromViewModel I can’t use = {} and even if i create a fake function (locally into the preview Composable)
fun funcForPreview(text: String, number: Int) {}
I can’t get preview compile by using
@Preview
fun PreviewComponent(
@PreviewParameter …… define data for the preview
) {
ComponentToPreview(
data = data,
function1FromViewModel = { }
function2FromViewModel :: funForPreview,
....
)
Android studio complain and doesn’t show any preview!