Hi!
Im trying to manage Notifications. I have component class with
PublishSubject
. I also have
@Composable
function where I want to show notification based on data received from subject. How to do that?
Copy code
@Composable
fun test(component: MainComponent){
val subject: Observable<NotificationData> = component.notification
val trayState = rememberTrayState()
Tray(state = trayState,
icon = TODO())
val n = rememberNotification("Title From NotificationData", "Message from NotificationData")
trayState.sendNotification(n)
}
a
Alexander Kurasov[JB]
10/18/2021, 11:08 AM
Easiest way is to have some State, use it in Composable function and update it with the necessary data. Compose engine will do the rest