Closed VITYQ closed 3 months ago
My example
@Composable
actual fun ChatView() {
val jivoChatFragment = remember { JivoChatFragment() }
AndroidView(
factory = { context ->
val contentViewId = View.generateViewId()
val frame = FrameLayout(context).apply { id = contentViewId }
val activity = context as AppCompatActivity
activity.supportFragmentManager.commit { add(contentViewId, jivoChatFragment) }
frame
},
modifier = Modifier
.statusBarsPadding()
.imeMinPadding()
.fillMaxSize()
.clearFocusOnDispose()
.onDispose { jivoChatFragment.onPause() }
)
}
val imeMinInset: WindowInsets
@Composable
@Stable
get() = WindowInsets.ime.exclude(WindowInsets.navigationBars)
fun Modifier.imeMinPadding(): Modifier = composed {
windowInsetsPadding(imeMinInset)
}
fun Modifier.clearFocusOnDispose(): Modifier = composed {
val hideKeyboard by rememberHideKeyboard()
DisposableEffect(Unit) {
onDispose {
hideKeyboard.invoke()
}
}
this
}
Как мы можем добавить ваш чат в приложение написанное на Compose?