Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why my toolbar does not display properly? #91

Closed
ghost opened this issue Feb 8, 2017 · 10 comments
Closed

Why my toolbar does not display properly? #91

ghost opened this issue Feb 8, 2017 · 10 comments
Assignees
Labels

Comments

@ghost
Copy link

ghost commented Feb 8, 2017

simulator screen shot feb 8 2017 20 17 11

Commands executed to install:

npm i react-native-material-ui --save
react-native link react-native-vector-icons
react-native run-ios

index.ios.js

import React, { Component } from 'react';
import {
  AppRegistry,
  StyleSheet,
  Text,
  View
} from 'react-native';
import { COLOR, ThemeProvider, Toolbar } from 'react-native-material-ui';
import { Navigator, NativeModules, StatusBar } from 'react-native';

const uiTheme = {
    palette: {
        primaryColor: COLOR.green500,
    },
    toolbar: {
        container: {
            height: 50,
        },
    },
};

const UIManager = NativeModules.UIManager;

const Container = (props) => {
  return (
    <View style={styles.container}>
      {props.children}
    </View>
  );
};

export default class Bar extends Component {
componentWillMount() {
        if (UIManager.setLayoutAnimationEnabledExperimental) {
            UIManager.setLayoutAnimationEnabledExperimental(true);
        }
    }

  render() {
    return (
      <ThemeProvider uiTheme={uiTheme}>
        <Container>
          <StatusBar backgroundColor="rgba(0, 0, 0, 0.2)" translucent />
          <View style={{ backgroundColor: COLOR.green500, height: 24 }} />
          <Container>
            <Toolbar
                key="toolbar"
                leftElement="menu"
                centerElement={'foo'}
            />
          </Container>
        </Container>
      </ThemeProvider>
    );
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    // justifyContent: 'center',
    // alignItems: 'center',
    // backgroundColor: '#F5FCFF',
  },
  welcome: {
    fontSize: 20,
    textAlign: 'center',
    margin: 10,
  },
  instructions: {
    textAlign: 'center',
    color: '#333333',
    marginBottom: 5,
  },
});

AppRegistry.registerComponent('Bar', () => Bar);
@xotahal xotahal self-assigned this Feb 8, 2017
@xotahal
Copy link
Owner

xotahal commented Feb 8, 2017

Thank you - @AndoSuguru. Do you have the same problem with demo-app? https://github.com/xotahal/react-native-material-ui-demo-app

@HofmannZ
Copy link
Contributor

HofmannZ commented Feb 8, 2017

I can confirm this bug, had to hold back from 1.7.0. I think the problem might be in the fact that styles are passed to the new LeftElement component, I'm not sure though.

@dipernaa
Copy link

dipernaa commented Feb 8, 2017

I am getting the same issue across all platforms (iOS, Android, UWD)

@ghost
Copy link
Author

ghost commented Feb 9, 2017

@xotahal

Do you have the same problem with demo-app?

No, it did not occur in the demo application.

Note: my package.json

{
  "name": "Foo",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "start": "node node_modules/react-native/local-cli/cli.js start",
    "test": "jest"
  },
  "dependencies": {
    "react": "15.4.2",
    "react-native": "0.41.2",
    "react-native-material-ui": "^1.7.0",
    "react-native-vector-icons": "^3.0.0"
  },
  "devDependencies": {
    "babel-jest": "18.0.0",
    "babel-preset-react-native": "1.9.1",
    "jest": "18.1.0",
    "react-test-renderer": "15.4.2"
  },
  "jest": {
    "preset": "react-native"
  }
}

@HofmannZ
Copy link
Contributor

HofmannZ commented Feb 9, 2017

I see the demo app is running react-native version 0.39.2. I have the issue on version 0.40.0. I have some time tonight, so I will dive into this.

@NourDT
Copy link

NourDT commented Feb 10, 2017

So I ran into the same issue on but only on iOS and not on android,
screen shot 2017-02-10 at 2 54 43 pm

how ever when trying to install the demo app, I had to yarn update in order to build as i was running into some errors previously with a node module

What info can I provide to help you address this ?

@mortezaalizadeh
Copy link

Hey guys, have the same issue here, would be great if we can fix it. I will look at it later tonight on my fork version anyway. :)

@ryanstinson
Copy link

Temp fix for this is wrap the Toolbar in a View.
<View style={{ flex: 1 }}> <View> <Toolbar style={{ zindex: -1 }} leftElement="menu" centerElement="Searchable" searchable={{ autoFocus: true, placeholder: 'Search', }} /> </View>

@xotahal
Copy link
Owner

xotahal commented Feb 21, 2017

Hey guys, I've just fixed it - sorry for that. There missed just { overflow: 'hidden' }

It's fixed in master. I'll publish it in next release - 1.8.0

@ghost
Copy link
Author

ghost commented Feb 24, 2017

thx!!

matthewfbenjamin pushed a commit to theemployeeapp/react-native-material-ui that referenced this issue Jul 17, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants