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

ToolbarAndroid doesn't seem to appear? #2957

Closed
russjr08 opened this issue Sep 23, 2015 · 3 comments
Closed

ToolbarAndroid doesn't seem to appear? #2957

russjr08 opened this issue Sep 23, 2015 · 3 comments
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@russjr08
Copy link

It seems the ToolbarAndroid component doesn't want to play right with me... Either that, or I'm doing something wrong here.

I've created a test app here https://rnplay.org/apps/CHOsPg

I can't seem to get the component to work, and a couple of other users on Reddit were having issues with it too.

@foghina
Copy link
Contributor

foghina commented Sep 23, 2015

You should set alignItems to stretch (which is also the default) on your container, or give your toolbar an explicit width. With alignItems set to center and no explicit width, the toolbar is given 0 implicit width.

In the future, can you please use Stack Overflow to ask questions and tag them with react-native? http://stackoverflow.com/questions/tagged/react-native

This helps us keep track of bugs that need to be fixed in Github issues. Thanks!

@foghina foghina closed this as completed Sep 23, 2015
@xcchcaptain
Copy link

xcchcaptain commented Apr 28, 2016

met the same problem
thanks to @foghina ,that is ok.
but i think it should be add to the doc to make it more clear for the beginner

@hiteshsahu
Copy link

You need to assign both height and width to the toolbar otherwise it won't renders

This is how you need to do


    <ToolbarAndroid
            style={styles.toolbar}
            title="Movies"
            navIcon={require("../../ic_launcher.png")}
            onActionSelected={this.onActionSelected}
            titleColor= "000"
            actions = {[
              {title: "Log out", show: "never"}
            ]}
            />


 toolbar: {
   backgroundColor: '#2196F3',
   height: 56,
   alignSelf: 'stretch',
   textAlign: 'center',
 },

onActionSelected(position) {
  }


Result

screenshot_1493030133

@facebook facebook locked as resolved and limited conversation to collaborators Jul 21, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Jul 21, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

5 participants