Cannot Center Button with NativeBase
See original GitHub issueHi, I am trying to center a button on the screen, but cannot do so. Here is my code:
<Container> <Content> <Card> <CardItem> <Body> <Button>Text</Button> </Body> <CardItem> </Card> <Content> </Container>
I have tried using justify content, alignItems and a bunch of other things, but am not able to center the button with “Text”. Any help? currently, it is just on the left of the screen. I am using android.
Issue Analytics
- State:
- Created 6 years ago
- Comments:14 (4 by maintainers)
Top Results From Across the Web
Cannot Center Buttons horizontally with NativeBase
Trying to center buttons horizontally with Native Base. Any idea why the following do not work? <Container style={{ backgroundColor: '#fff', ...
Read more >Button - NativeBase
Button : The button component with support for custom icons, spinners, etc. Button.Group : Used to group buttons whose actions are related, with...
Read more >Cannot Center Buttons horizontally with NativeBase-React ...
Coding example for the question Cannot Center Buttons horizontally with NativeBase-React Native.
Read more >Button - React Native
A basic button component that should render nicely on any platform. ... me" disabled onPress={() => Alert.alert('Cannot press this one')} ...
Read more >Vertically and Horizontally Center Text in React Native
So the fix is to wrap our Text component in a view that does understand vertical orientation. That view will get justifyContent: 'center'....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Visit this:
https://stackoverflow.com/questions/52207028/cannot-center-buttons-horizontally-with-nativebase/53184100#53184100
@zmerchant17
flexDirection: "row", justifyContent: "center"
with<Body>
should do the work