Nativebase: Is there a way to make a card take the whole screen width?

Created on 16 Nov 2017  Â·  6Comments  Â·  Source: GeekyAnts/NativeBase

react-native, react and native-base version

"react-native": "0.42.0",
"native-base": "2.1.0",

Expected behaviour

I'd like to make a card take the whole width of my sreen, or any other value I want.

Actual behaviour

Card has default width value, that I don't know how to change

Thanks ;)

awaiting response

Most helpful comment

@hpbl just override the style of component. The spaces are due to the default margin given to the card.

To take the whole width

<Card style={{marginLeft:0,marginRight:0}}/>

To set a custom width

<Card style={{width:100}}/>

All 6 comments

@hpbl just override the style of component. The spaces are due to the default margin given to the card.

To take the whole width

<Card style={{marginLeft:0,marginRight:0}}/>

To set a custom width

<Card style={{width:100}}/>

I thought I had tried that before, but it didn't work. Guess I was mistaken, since now that I've tried what you said, it works fine. Thank you!

Do ejectTheme and edit native-base-theme/components/Card.js
change marginHorizontal: 0, then use ejected theme

what about how to change the card height?

@jerryheir Why do you want to change height of card?
Depending upon the components you wrap within Card, the height is set accordingly

Okay, that what I wanted to know...
On Apr 23, 2018 07:15, "Supriya Kalghatgi" notifications@github.com wrote:

@jerryheir https://github.com/jerryheir Why do you want to change
height of card?
Depending upon the components you wrap within Card, the height is set
accordingly

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/GeekyAnts/NativeBase/issues/1374#issuecomment-383465972,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AcZ8pwC3o9zCZfqu1tYxZ9ITLvqgh1UOks5trXGZgaJpZM4Qgj8e
.

Was this page helpful?
0 / 5 - 0 ratings