@Composable WhatsAppMessageTopBar takes WhatsAppMessagesViewModel as a parameter and since we cannot instantiate ViewModel in Previews, it doesn't render the Preview.
Before
After
✍️ Explain examples
Setup a callback to trigger a function in ViewModel instead (takes videoCall flag as a param to be passed onto VM).
@Composable
fun WhatsAppMessageTopBar(
.
navigateToVideoCall: (Boolean) -> Unit,
.
)
🎯 Goal
Fix "MessageTopBar Preview is broken" issue https://github.com/GetStream/whatsApp-clone-compose/issues/192
🛠 Implementation details
@Composable WhatsAppMessageTopBar
takesWhatsAppMessagesViewModel
as a parameter and since we cannot instantiate ViewModel in Previews, it doesn't render the Preview.Before
After
✍️ Explain examples
Setup a callback to trigger a function in ViewModel instead (takes
videoCall
flag as a param to be passed onto VM).