Skip to content

Android style #22

Open
Open

Description

The element in Android is not responding to the same style declarations as in iOS. In my case, I cannot seem to find a way to center the text inside of the button in Android.

Any thoughts on this?

Activity

  1. mhollweck commented on Feb 11, 2016

    @mhollweck

    +1 experienced the same.

    I wrapped a few around the button to set the paddings and then used justifyContent on the button.

  2. andrewljohnson commented on Mar 3, 2016

    @andrewljohnson
    Contributor

    @iagomr or @mhollweck Can you give a specific example... do some styles work, others don't? I am putting react-native-button in a cross-platform project too, so I'll debug a little bit.

  3. jatazoulja commented on Jul 26, 2016

    @jatazoulja

    Vertical Alignment of the button is at the top, not aligning in the middle...

  4. xyz1hang commented on Oct 17, 2016

    @xyz1hang

    Same issue for me but I managed to center the text by setting justifyContent to center as @mhollweck suggested :). However the fontFamily doesn't seems working on Android neither. I used a TypoGraphica font on the button and it worked on iOS but not on Android. I am pretty sure I used the fonts correctly on Android as the fontFamily worked in other places in my app on Android. This is how I used it:

    <Button
                containerStyle={styles.my_btn}
                style={{
                  fontSize: 20,
                  fontFamily: 'typographica',
                  color: 'black'
                }}
                onPress={this.goToNext.bind(this)}>
                Press me !
     </Button>
    

    I will be really appreciated If you could have a look.

    Thanks

  5. t2 commented on Jan 30, 2017

    @t2

    @Phoenix1708 I found a solution to the Android custom fonts issue. Try adding fontWeight: 'normal' to your style declaration.

  6. jacks205 commented on Feb 13, 2017

    @jacks205

    Adding fontWeight: 'normal' worked for the same issue on iOS also. Thanks.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions