Is there a way to use a custom composable as a parameter type in another custom composable? Trying this only throws an unresolved reference
compiler error. However, using build-in composables provided by Jetpack Compose as parameters like an AlertDialog
don't throw any errors. I want to use the slots API pattern in a custom composable but restrict the slots to only other custom composables.
Example structure
@Composable
fun Permission(
PermissionNotGrantedContent: CustomDialog, //Unresolved reference error here
PermissionNotAvailableContent: CustomDialog, //unresolved reference error here
PermissionGrantedContent: @Composable () -> Unit
) { ... }
Permission(
PermissionNotGrantedContent = {
CustomDialog(...)
},
PermissionNotAvailableContent = {
CustomDialog(...)
}
) {
Text("Thanks for granting the permission!")
}