Skip to content

Card contents can no longer fill card on web because of "fix" #3646

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

Closed
SleeplessByte opened this issue Feb 1, 2023 · 2 comments
Closed

Card contents can no longer fill card on web because of "fix" #3646

SleeplessByte opened this issue Feb 1, 2023 · 2 comments

Comments

@SleeplessByte
Copy link
Contributor

Current behaviour

It should be possible to fill a card by its contents, which is no longer possible due to #3469, based on the issue raised in #1775.

Why does this matter? Without explicitly setting the card contents size (not in percentages, like 100%), we can no longer add a background that fills, which is vital for complex backgrounds that cannot be set on Card directly.

Why would you want this? For example what we do a lot is set the AspectRatio of the Card via a parent:

<AspectRatio w="16" h="9">
  <Card>
    ...
  </Card>
</AspectRatio>

This is no longer possible. The fix in #3469 was a breaking change.

Expected behaviour

We have control over the fill behaviour, for example by exposing another style prop to set on the "inner card".

How to reproduce?

https://snack.expo.dev/@derk-jan/card

Preview

image

What have you tried so far?

Workaround is to inject css on the page to overwrite the behaviour.

@lukewalczak
Copy link
Member

I think we can introduce the prop contentStyle property to allow customize the styles of the View wrapping the children.

        <View style={[styles.innerContainer, contentStyle]}>

@SleeplessByte
Copy link
Contributor Author

Yeah, that's probably a good idea because then depending on case and platform, the flex styles can be set.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants