Skip to content

Instantly share code, notes, and snippets.

@AndroidPoet
Created October 14, 2022 03:52
Show Gist options
  • Save AndroidPoet/c9da7091d351959941ee1d4294113f92 to your computer and use it in GitHub Desktop.
Save AndroidPoet/c9da7091d351959941ee1d4294113f92 to your computer and use it in GitHub Desktop.
@Composable
fun rememberMapViewWithLifecycle() {
DisposableEffect(key1 = lifecycle, key2 = mapView) {
// Make MapView follow the current lifecycle
val lifecycleObserver = getMapLifecycleObserver(mapView)
lifecycle.addObserver(lifecycleObserver)
onDispose {
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment