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

Material3 NavigationBar #984

Closed
justin-caldicott opened this issue Sep 27, 2024 · 2 comments
Closed

Material3 NavigationBar #984

justin-caldicott opened this issue Sep 27, 2024 · 2 comments
Labels
question Issue is a question, and will likely not involve a code change

Comments

@justin-caldicott
Copy link

justin-caldicott commented Sep 27, 2024

Android application type

Android for .NET (net6.0-android, etc.)

Affected platform version

dotnet 8.0.402, android

Description

I can't work out how to include the material3 NavigationBar included in Jetpack Compose: https://m3.material.io/components/navigation-bar/overview

Are there bindings for this? I've been poking around in various assemblies added from the Xamarin.AndroidX.Compose.Material3 nuget package. The closest I found is NavigationBarDefaults and NavigationBarKt but these appear to be classes, not views, so when I get errors when trying to add them to my Layout.xml.

Steps to Reproduce

  1. Start a new Android app project (not MAUI)
  2. Add the Xamarin.AndroidX.Compose.Material3 NuGet package
  3. Be unsure how to add the newer material 3 NavigationBar (I'm using Rider)

Did you find any workaround?

No response

Relevant log output

No response

@jpobst
Copy link
Contributor

jpobst commented Sep 27, 2024

If it part of Jetpack Compose then it will not be usable from .NET for Android.

Compose UIs can only be created in Kotlin, not Java. As .NET for Android bridges via Java, it cannot create them either.

https://stackoverflow.com/questions/66433437/can-i-write-jetpack-compose-components-in-java/66433621#66433621

The Compose packages we provide contain the .jar/.aar so that libraries that depend on them will function, but they do not provide C# bindings as they can't be used to create Compose UIs.

@jpobst jpobst added the question Issue is a question, and will likely not involve a code change label Sep 27, 2024
@justin-caldicott
Copy link
Author

Thanks for clarifying @jpobst. I'd not come across Jetpack Compose until yesterday (don't often get to work on our Android app). No problem, I've started to use the material-components equivalents.

Longer term I hope native UI's via .NET remains a thing if Google start to release features only via Jetpack Compose. The pattern of sharing as much as possible in view models between our apps and then using fairly thin native UIs has been working well for us. 🤞

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Issue is a question, and will likely not involve a code change
Projects
None yet
Development

No branches or pull requests

2 participants