Not sure where to ask this, is it possible to align a button centered in the screen? Or do i need to wrap it in a view to do this?
Just had the same problem. I looked into a buttons code and found that I had to set the buttons style toalignSelf: 'auto' because otherwise it would be overwritten to flex-start in this line
(alignSelf: (this.props.block) ? 'stretch' : 'flex-start').
I don't know if it makes sense to default to flex-start or what was the motivation for it 馃槃
@ansgarm For now you can wrap it in View for alignment.
And yes, we have been receiving many upvotes for this. It's on our list
@ansgarm Does alignSelf: flex-start not work when you use it to style the button? Also if what does it default to, if we don't set any alignSelf at all? Just curious?
@robtaireeo You can wrap it inside a view or use alignSelf: flex-start for the time being.
@sankhadeeproy007 @SupriyaKalghatgi BTW, this still happens in 2.3.3 and I'm pretty curious why this is the case. After changing from RN's Button to NativeBase's button, I have a parent ImageBackground with alignItems=center and RN's Button centered it, while NativeBase's Button I have to add alignSelf=auto.
Why is this? And if it's intentional then this I suggest this be better mentioned in the docs.
Most helpful comment
Just had the same problem. I looked into a buttons code and found that I had to set the buttons style to
alignSelf: 'auto'because otherwise it would be overwritten toflex-startin this line(
alignSelf: (this.props.block) ? 'stretch' : 'flex-start').I don't know if it makes sense to default to flex-start or what was the motivation for it 馃槃