简体   繁体   中英

Jetpack compose and fragments

If there is some lifecycle related event like unSubscribe or dispose , how is it possible to use compose without fragments' lifecycle?

If you need to observe lifecycle events on the fragment or activity, you can use LocalLifecycleOwner .

If you want to subscribe to some observable and ensure it gets disposed when the composable leaves the comosition, you can use Disposable Effect .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM