Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Kotlin JS - IrLinkageError - Function 'Navigator' can not be called: No function found for symbol #315

Closed
romainbsl opened this issue Jan 21, 2024 · 8 comments
Labels
bug Something isn't working platform: web WASM or JS (Browser) related

Comments

@romainbsl
Copy link

Hello,
I am trying to work with Voyager on a Compose Web project, but I am getting an issue at runtime.

"Function 'Navigator' can not be called: No function found for symbol 
'cafe.adriel.voyager.navigator/Navigator|Navigator(cafe.adriel.voyager.core.screen.Screen;cafe.adriel.voyager.navigator.NavigatorDisposeBehavior?;kotlin.Function1<cafe.adriel.voyager.core.screen.Screen,kotlin.Boolean>?;kotlin.String?;kotlin.Function3<cafe.adriel.voyager.navigator.Navigator,androidx.compose.runtime.Composer,kotlin.Int,kotlin.Unit>?;androidx.compose.runtime.Composer?;kotlin.Int;kotlin.Int){}[0]'"

Here is my gradle.build.kts:

plugins {
    alias(libs.plugins.kotlinMultiplatform)
    alias(libs.plugins.jetbrainsCompose)
}

kotlin {
    js(IR) {
        browser()
        binaries.executable()
    }

    sourceSets {
        jsMain.dependencies {
            implementation(kotlin.compose.html.core)
            implementation(kotlin.compose.runtimeSaveable)
            implementation(libs.voyager.navigator)
        }
    }
}

compose.experimental {
    web.application {}
}

And my main.kt file:

import androidx.compose.runtime.Composable
import cafe.adriel.voyager.core.screen.Screen
import cafe.adriel.voyager.navigator.Navigator
import org.jetbrains.compose.web.dom.H1
import org.jetbrains.compose.web.dom.Text
import org.jetbrains.compose.web.renderComposableInBody

fun main() {
    renderComposableInBody {
//        H1 { Text("Voyager Test App") }
        Navigator(HomeScreen)
    }
}

object HomeScreen : Screen {
    @Composable
    override fun Content() {
        H1 { Text("Voyager Test App") }
    }
}

Here is a reproducer based on a https://kmp.jetbrains.com template.

I checked your sample project multiplatform, that works, but was getting the same issue by copy / pasting your code inside my project. Not sure of what's going on here.

@DevSrSouza DevSrSouza added bug Something isn't working platform: web WASM or JS (Browser) related labels Jan 22, 2024
@terrakok
Copy link
Contributor

terrakok commented Feb 2, 2024

The reason is: the voyager have to use the compose multiplatform version 1.6.0-beta01 or higher

@HLCaptain
Copy link

Hi I have the same issue, but using 1.6.0-rc02 Compose Multiplatform version. Works great with Android, Desktop targets, but getting the same error on Web.

Project: https://github.com/HLCaptain/butler/tree/64d0413de58ea3c91d3827bdfceea38a18ac1853

@ismai117
Copy link

Same here, it's not working on Compose Multiplatform v1.6.0-rc02

@maqsats
Copy link

maqsats commented Feb 19, 2024

Same here v1.6.0-rc03

@maqsats
Copy link

maqsats commented Feb 20, 2024

@DevSrSouza Please can you help us with this?

@DevSrSouza
Copy link
Collaborator

Should be fixed on https://github.com/adrielcafe/voyager/releases/tag/1.1.0-alpha03

We have update Compose KMP and add WASM support.

@maqsats
Copy link

maqsats commented Feb 24, 2024

JetBrains/compose-multiplatform#4361 still cannot build

@romainbsl
Copy link
Author

Just getting back at my sample project and it works.

Here is the toml updated:

[versions]
jbCompose = "1.6.0"
kotlin = "1.9.22"
voyager = "1.1.0-alpha03"

[libraries]
voyager-navigator = { module = "cafe.adriel.voyager:voyager-navigator", version.ref = "voyager" }

[plugins]
jetbrainsCompose = { id = "org.jetbrains.compose", version.ref = "jbCompose" }
kotlinMultiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" }

Thanks for the work on voyager!

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working platform: web WASM or JS (Browser) related
Projects
None yet
Development

No branches or pull requests

6 participants