Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Cannot access 'CollapsingToolbarScopeInstance': it is internal in 'me.onebone.toolbar' #22

Closed
Nek-12 opened this issue Nov 25, 2021 · 4 comments
Labels
support Asking for help regarding to the usage of library

Comments

@Nek-12
Copy link

Nek-12 commented Nov 25, 2021

IntelliJ IDEA imports me.onebone.toolbar.CollapsingToolbarScopeInstance.road and complains that it's internal when trying to use Modifier.road() or others

IntelliJ IDEA 2021.3 RC (Ultimate Edition)
Build #IU-213.5744.125, built on November 17, 2021
Runtime version: 11.0.13+7-b1751.19 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Linux 5.15.4-arch1-1
GC: G1 Young Generation, G1 Old Generation
Memory: 4096M
Cores: 16
Kotlin: 213-1.5.10-release-949-IJ5744.125
Current Desktop: KDE

CollapsingToolbar v. 2.3.0

@onebone
Copy link
Owner

onebone commented Nov 25, 2021

This library only targets Android platform for now, are you working with Android?

@Nek-12
Copy link
Author

Nek-12 commented Nov 25, 2021

Yes I am. I can't import import me.onebone.toolbar.CollapsingToolbarScope.road
image

@onebone
Copy link
Owner

onebone commented Nov 25, 2021

Not sure though, I think it is complaining because CollapsingToolbarScope is an interface.

By the way, you don't have to import the road extension function. It automatically resolves because CollapsingToolbarScope is passed as a context parameter in the toolbar lambda.

@onebone onebone added the support Asking for help regarding to the usage of library label Nov 25, 2021
@Nek-12
Copy link
Author

Nek-12 commented Nov 25, 2021

Ah, I understand now. I'm creating my own composables for an UI Kit in the app, and this is my first time working with Compose. I have made a nooby mistake: when you move a composable to another function, you have to inherit its scope, i.e.

@Composable // \/ -- scope here
fun CollapsingToolbarScope.CollapsingToolbar(
    modifier: Modifier = Modifier,
    image: Any? = null,
    title: String = stringResource(R.string.app_name),
    state: CollapsingToolbarState,
) {

For anyone lurking here after me - inherit the scope, and don't forget about Modifier first parameter to pass to your composable.

@Nek-12 Nek-12 closed this as completed Nov 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
support Asking for help regarding to the usage of library
Projects
None yet
Development

No branches or pull requests

2 participants