Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save arriolac/26af72d7038c9153edefd4c3129410cb to your computer and use it in GitHub Desktop.
Save arriolac/26af72d7038c9153edefd4c3129410cb to your computer and use it in GitHub Desktop.
// Copyright 2023 Google LLC.
// SPDX-License-Identifier: Apache-2.0
class MyCustomView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyle: Int = 0
) : AbstractComposeView(context, attrs, defStyle) {
init {
// Related lifecycle may not be known at this point yet
setViewCompositionStrategy(
ViewCompositionStrategy.DisposeOnViewTreeLifecycleDestroyed
)
}
@Composable
override fun Content() {
// Compose
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment