Skip to content
Lucas Yuji edited this page Nov 3, 2022 · 1 revision

Focus

In Camposer, focus on tap it's already added as default, but if you want to disable, follow the below example:

val isFocusOnTapEnabled by remember { mutableStateOf(false) }

CameraPreview(
  // ...
  isFocusOnTapEnabled = isFocusOnTapEnabled
)

Focus Content

To add your own focus composable content, just use focusTapContent parameter from CameraPreview

CameraPreview(
  //...
  focusTapContent = { // Composable function
    AwesomeFocusTapContent()
  }
)

The default delay to composable layout gone of focusTapContent is 1 second, to override just use onFocus parameter from CameraPreview.

onFocus is a suspendable callback function that has a function parameter onComplete, when it's called, the layout is gone.

CameraPreview(
  // ...
  onFocus = { onComplete -> // suspend function
    delay(10_000L)
    onComplete()
  }
)
Clone this wiki locally