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

CardView on Android doesn't support flexbox layout #3

Closed
aranda-adapptor opened this issue May 2, 2017 · 10 comments
Closed

CardView on Android doesn't support flexbox layout #3

aranda-adapptor opened this issue May 2, 2017 · 10 comments
Projects

Comments

@aranda-adapptor
Copy link

Am I right in thinking this?

I'm trying this and all the text elements appear on top of each other on Android, but on iOS it works as expected:

          <CardView
            style={{ flex: 1, justifyContent: "center", alignItems: "center", height: 100, margin: 20 }}
            cardElevation={2}
            cardMaxElevation={2}
            cornerRadius={0}
          >
            <Text>Elevation 1</Text>
            <Text>Elevation 2</Text>
            <Text>Elevation 3</Text>
            <Text>Elevation 4</Text>
          </CardView>

Having a shadow is nice, but If I can't layout my card contents in the same way on Android and iOS, the component is not very useful.

@aranda-adapptor
Copy link
Author

Strangely, wrapping the children in a normal RN View doesn't work either:

          <CardView
            style={{ height: 100, margin: 20 }}
            cardElevation={2}
            cardMaxElevation={2}
            cornerRadius={0}
          >
            <View
              style={{
                flex: 1,
                justifyContent: "center",
                alignItems: "center"
              }}
            >
              <Text>Elevation 1</Text>
              <Text>Elevation 2</Text>
              <Text>Elevation 3</Text>
              <Text>Elevation 4</Text>
            </View>
          </CardView>

@Kishanjvaghela
Copy link
Owner

@aranda-adapptor Thanks for issue. I will look into this and fix by end of the day.

@Kishanjvaghela
Copy link
Owner

@aranda-adapptor I am closing this issue. Please latest version now.

@aranda-adapptor
Copy link
Author

Thanks for the quick fix!

@Sundin
Copy link

Sundin commented Aug 16, 2017

I'm still having layout problems on Android, the child views are not centered properly using alignItems: "center". Works as it should on iOS.

@est7
Copy link

est7 commented Sep 30, 2017

@Sundin if u dont send cardElevation value nor send '0',it works?

@est7
Copy link

est7 commented Sep 30, 2017

@Sundin i have same issues,did u solve it?

@Sundin
Copy link

Sundin commented Oct 2, 2017

@est7 Unfortunately I didn't find a workaround. I used a normal View component with a borderRadius instead (and thus had to sacrifice the shadow/elevation effect). I didn't try cardElevation: 0 but it should have the same effect if it works like you said.

@githubdoramon
Copy link

Elevation 0 fixes the issue, but of course removes the shadow. Any updates on this issue?

@YouCii
Copy link

YouCii commented Aug 13, 2018

Is 'height' props must required? I think it would be better like View, which 'height' is adaptive according to the height of its sub-layouts

@Kishanjvaghela Kishanjvaghela added this to Done in cardview Nov 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
cardview
  
Done
Development

No branches or pull requests

6 participants