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

Image: imageResource vs. vectorResource #69

Open
pocmo opened this issue Sep 27, 2020 · 0 comments
Open

Image: imageResource vs. vectorResource #69

pocmo opened this issue Sep 27, 2020 · 0 comments
Labels
bug Something isn't working

Comments

@pocmo
Copy link
Owner

pocmo commented Sep 27, 2020

Currently a drawable value in ImageView will always be written as:

Image(imageResource(R.id.the_drawable), ...)

This works for drawable resources that are PNGs. But it fails if the drawable is a vector image. In that case it needs to be:

Image(vectorResource(R.id.the_drawable), ...)

From the XML alone we cannot know if the drawable is a vector resource or not. We could try finding the drawable (assuming default folders are used), but this fails if the resource is not in the app itself (e.g. provided by a library or a different module).

Alternatively the plugin in the IDE could try to figure out what kind of drawable is used - but this will only work in the plugin and not in the CI.

In general I am surprised to see Jetpack Compose force making this distinction unto the consumer. Wouldn't it be more convenient to provide a drawable resource to Compose and it can figure out itself what it is?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant