Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

143
Vistas
How do I pass the onClick parameter in this one?

This is my OTP screen function to receive and read OTP.
The function has the 2 parameters as shown,

fun OTPScreen(
    navController : NavController,
    onClick: (mobileNum: String,otp: String) -> Unit,
)

This is my navhost function that navigates to the OTP screen.
Can someone tell me how do I pass the onClick parameter in this case?

composable(
    route = Screen.Otpscreen.route,
) {  
    OTPScreen(navController = navController, onClick = (" "))
}

I'm new to jetpack and functions are always confusing.
Let me know if I need to elaborate further.

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

I'm not familiar with compose but assuming it works like any other kotlin you could write it like this

OTPScreen(navController = navController, onClick = {mobileNum, otp ->
    //your code here
})

as noted by Karsten Gabriel, this can also be written shorter as

OTPScreen(navController) { mobileNum, otp -> 
  //your code here
}

Or, if you want to use an existing function like

fun myFunction(mobileNum: String, otp: String) {
    //your code here
}

for example you can use that like

OTPScreen(navController = navController, onClick = ::myFunction)
over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda