Git Product home page Git Product logo

Comments (26)

vjeux avatar vjeux commented on April 20, 2024

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.

from react-native.

nick avatar nick commented on April 20, 2024

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

from react-native.

amccloud avatar amccloud commented on April 20, 2024

@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.

from react-native.

vjeux avatar vjeux commented on April 20, 2024

@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?

from react-native.

vjeux avatar vjeux commented on April 20, 2024

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>
  }
});

from react-native.

frantic avatar frantic commented on April 20, 2024

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.

from react-native.

nick avatar nick commented on April 20, 2024

StatusBarIOS sounds great :)

from react-native.

vjeux avatar vjeux commented on April 20, 2024

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

from react-native.

amccloud avatar amccloud commented on April 20, 2024

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

from react-native.

nick avatar nick commented on April 20, 2024

@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

from react-native.

vjeux avatar vjeux commented on April 20, 2024

@nick: gotta start somewhere? :p

from react-native.

nick avatar nick commented on April 20, 2024

@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

from react-native.

vjeux avatar vjeux commented on April 20, 2024

Oh, that's pretty cool already!

from react-native.

nick avatar nick commented on April 20, 2024

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

from react-native.

jamesgpearce avatar jamesgpearce commented on April 20, 2024

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

from react-native.

subtleGradient avatar subtleGradient commented on April 20, 2024

Hey nick! Long time no see.
FWIW, when I wanted to change the status bar style of my app, I did it in the Info.plist

from react-native.

amccloud avatar amccloud commented on April 20, 2024

I've pushed my initial work for StatusBarIOS. @vjeux the only issue I seem to run into is the type for attributes coming across the bridge. For example my BOOL values in RCTStatusBarManager are always NO or false.

from react-native.

vjeux avatar vjeux commented on April 20, 2024

Wow, so fast! Looking

from react-native.

nick avatar nick commented on April 20, 2024

I merged in @amccloud 's change to my fork and its working great :-)

from react-native.

vjeux avatar vjeux commented on April 20, 2024

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

from react-native.

amccloud avatar amccloud commented on April 20, 2024

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

from react-native.

vjeux avatar vjeux commented on April 20, 2024

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

from react-native.

a2 avatar a2 commented on April 20, 2024

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

from react-native.

nick avatar nick commented on April 20, 2024

@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.

from react-native.

vjeux avatar vjeux commented on April 20, 2024

@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)

from react-native.

vjeux avatar vjeux commented on April 20, 2024

Was added 9674c99 :)

from react-native.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.