electrolobzik
01/30/2024, 5:35 PMinit {
lifecycle.doOnResume {
store.accept(Intent.Refresh)
}
}
but I don’t get the event triggered when the component is brought to front via navigation.bringToFront
Arkadii Ivanov
01/30/2024, 5:52 PMelectrolobzik
01/30/2024, 5:53 PMelectrolobzik
01/30/2024, 5:53 PMArkadii Ivanov
01/30/2024, 5:56 PMArkadii Ivanov
01/30/2024, 5:56 PMEvery child component needs its own ComponentContext. Never pass parent's ComponentContext to children
electrolobzik
01/30/2024, 5:57 PMArkadii Ivanov
01/30/2024, 6:00 PMelectrolobzik
01/30/2024, 6:14 PMprivate val previousPlacesComponent by lazy { createPreviousPlacesComponent(childContext("PreviousPlaces")) }
Arkadii Ivanov
01/30/2024, 6:15 PMArkadii Ivanov
01/30/2024, 6:16 PMelectrolobzik
01/30/2024, 6:17 PMchildFactory
I am using childContext()
?electrolobzik
01/30/2024, 6:19 PMelectrolobzik
01/30/2024, 6:22 PMArkadii Ivanov
01/30/2024, 6:32 PMComponentContext
. Only the owner (the creator) of the ComponentContext
instance can control its lifecycle. When you create ComponentContext
using childContext
function, then the lifecycle is the as as the parent. Though, the lifecycle can be also controlled manually as described in the docs.
When you use navigation, then the navigation creates and controls the child ComponentContext
.Arkadii Ivanov
01/30/2024, 6:32 PMIs the component recreated each time it is brought to front?Only if the configuration has changed (i.e. not
equal
to the previous one).electrolobzik
01/30/2024, 6:36 PM