Skip to content

Set UIStatusBarStyleLightContent #4

Description

@nick

Is it possible to set the status bar to light? I'm working on a dark background.

Also, is this the right place to ask questions like this?

Activity

  1. vjeux commented on Jan 30, 2015

    @vjeux
    Contributor

    This is totally the right place, please keep the issues coming :)

    We haven't had the need for changing UIStatusBarStyleLightContent yet so we haven't figured out a solution for it (you'll keep this same statement a lot :p). I would love to get your opinion in what would be the best way to expose it to React / JS.

  2. nick commented on Jan 30, 2015

    @nick
    Author

    Perhaps we could have a root level component called <Application> or similar that has props like statusBarStyle. That way we can update that prop from within our app if we need to change the style while the app is running

  3. amccloud commented on Jan 30, 2015

    @amccloud

    @nick For now you could set View controller-based status bar appearance to NO in your Info.plist and then add the following to your AppDelegate's application:didFinishLaunchingWithOptions:launchOptions method.

    [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];

    @vjeux Status bar style could be a barStyle property on NavigatorIOS. Another idea would be to add barStyle as an additional attribute to RKNavigatorItem. I think i'm leaning towards the latter because it allows each route to define a bar style.

  4. vjeux commented on Jan 30, 2015

    @vjeux
    Contributor

    @amccloud: the status bar is not tied to the navigator. If you have an empty view, you still have the status bar.

    Maybe we can have a module

    var { StatusBarIOS } = require('react-native');
    
    StatusBarIOS.setStyle(StatusBarIOS.style.lightContent);

    And, the way you would do it is in the root react component

    componentDidMount: function() {
      StatusBarIOS.setStyle(StatusBarIOS.style.lightContent);
    },

    What do you think about this API?

  5. vjeux commented on Jan 30, 2015

    @vjeux
    Contributor

    Then, if you have this API, you can create the <Application> component that you suggested @nick

    var Application = React.createClass({
      componentWillReceiveProps(nextProps) {
        if (this.props.statusBarStyle !== nextProps.statusBarStyle) {
          StatusBarIOS.setStyle(nextProps.statusBarStyle); 
        }
      },
      render() {
        var {statusBarStyle, children, ...props} = this.props;
        return <View {...props}>{children}</View>
      }
    });
  6. frantic commented on Jan 30, 2015

    @frantic
    Contributor

    I like StatusBarIOS suggestion. Some people will definitely want to .hide() and .show() status bar, and it gives enough power to implement higher level abstractions like <Application> or navigator/routing integration.

  7. nick commented on Jan 30, 2015

    @nick
    Author

    StatusBarIOS sounds great :)

  8. vjeux commented on Jan 30, 2015

    @vjeux
    Contributor

    @nick: want to give a shot at implementing it?

  9. amccloud commented on Jan 30, 2015

    @amccloud

    I also like StatusBarIOS. Trying to implement it now to learn the internals of react-native.

  10. nick commented on Jan 30, 2015

    @nick
    Author

    @vjeux Unfortunately I have no experience whatsoever with iOS or Objective C otherwise I'd be happy to help. @amccloud good luck - would love to give it a try if you succeed

  11. vjeux commented on Jan 30, 2015

    @vjeux
    Contributor

    @nick: gotta start somewhere? :p

  12. nick commented on Jan 30, 2015

    @nick
    Author

    @vjeux haha you're right I should dive in. Right now I'm working on a clone of the iOS weather app to see how far I can get it. Looking good so far! My fork is at nick/react-native - when I'm a bit further along perhaps we could use it as another example.

    screen shot 2015-01-30 at 1 21 27 pm

  13. vjeux commented on Jan 30, 2015

    @vjeux
    Contributor

    Oh, that's pretty cool already!

  14. nick commented on Jan 30, 2015

    @nick
    Author

    Yup no prior iOS experience and about 3 hours work I got it to that. It's using https://github.com/erikflowers/weather-icons for the icons. Looking forward to seeing how far I can push it

  15. jamesgpearce commented on Jan 30, 2015

    @jamesgpearce
    Contributor

    @nick no regrets about giving you access :) - demo looks sick!

  16. 4 remaining items

  17. vjeux commented on Jan 31, 2015

    @vjeux
    Contributor

    @amccloud do you mind doing a pull request on this repo?

  18. amccloud commented on Jan 31, 2015

    @amccloud

    Yes. That is my intention. I just want to fix the issue with the BOOL values first.

  19. vjeux commented on Jan 31, 2015

    @vjeux
    Contributor

    @a2 @nicklockwood do you know what's going on with the BOOL value?

  20. a2 commented on Jan 31, 2015

    @a2
    Contributor

    Just catching up on email. I commented on why that's not working. Hopefully that helps. :)

  21. nick commented on Jan 31, 2015

    @nick
    Author

    @amccloud @vjeux do you think I can use the same method to expose a location API? Trying to get location for my Weather app and was thinking of using this code as a template.

  22. vjeux commented on Jan 31, 2015

    @vjeux
    Contributor

    @nick: yeah, integrations with the native apis will follow a similar pattern.

    It turns out that we already have the location api implemented internally but haven't yet had the time to put it on the open source version. Give us some time on this (you can expose it for yourself in the meantime, shouldn't be super hard)

  23. vjeux commented on Feb 7, 2015

    @vjeux
    Contributor

    Was added 9674c99 :)

  24. added a commit that references this issue on Jan 4, 2018
  25. locked as resolved and limited conversation to collaborators on May 29, 2018
  26. added a commit that references this issue on Sep 24, 2021
    caac792
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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions