Nativebase: Expo Web is stretching the buttons on browser

Created on 20 Aug 2019  路  4Comments  路  Source: GeekyAnts/NativeBase

I have gone through these following points

Issue Description

I am using expo sdk v34 and trying to work out an example on web. I created new project using expo init and then did yarn add native-base along with expo install expo-font. On start expo web, the web page comes up but the button that I added is stretched from left to right completely.

Issue Image

Where as if I clone the repo that was given by Evan Bacon (and use my simplified App.js) then it works fine. But the catch there is if I remove yarn.lock file from the repo then it also shows the same behavior.

node, npm, react-native, react and native-base version, expo version if used, xcode version

Expected behaviour

Button should be of right size and not stretched from left to right.

Actual behaviour

Button comes as stretched.

Steps to reproduce

  • expo init sample-project && cd sample-project
  • yarn add native-base --save
  • expo install expo-font
  • Use below App.js
  • import React from 'react';
    import { AppLoading } from 'expo';
    import * as Font from 'expo-font';
    import { Ionicons } from '@expo/vector-icons';
    
    import { Container, Header, Content, Button, Text } from 'native-base';
    
    export default class App extends React.Component {
      constructor(props) {
        super(props);
        this.state = {
          isReady: false,
        };
      }
    
      async componentDidMount() {
        await Font.loadAsync({
          Roboto: require('native-base/Fonts/Roboto.ttf'),
          Roboto_medium: require('native-base/Fonts/Roboto_medium.ttf'),
          ...Ionicons.font,
        });
        this.setState({ isReady: true });
      }
    
      render() {
        return (
          <Container>
            <Header />
            <Content>
              <Button rounded>
                <Text>Click Me!</Text>
              </Button>
            </Content>
          </Container>
        );
      }
    }
    

    Is the bug present in both iOS and Android or in any one of them?

    Have not tried.

    Any other additional info which would help us debug the issue quicker.

    NA

    web

    Most helpful comment

    Same problem here. Button styles working weird with Expo.

    All 4 comments

    Closed by mistake.

    It can be fixed by alignSelf for Button component or by alignItems for the parent of the Button component

    Same problem here. Button styles working weird with Expo.

    I have same problem in React Native. Is there anybody to can solve this?

    Was this page helpful?
    0 / 5 - 0 ratings

    Related issues

    mcpracht picture mcpracht  路  3Comments

    natashache picture natashache  路  3Comments

    kitsune7 picture kitsune7  路  3Comments

    Bundas picture Bundas  路  3Comments

    omerdn1 picture omerdn1  路  3Comments