Comments (26)
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.
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.
@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.
@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.
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.
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.
StatusBarIOS
sounds great :)
from react-native.
@nick: want to give a shot at implementing it?
from react-native.
I also like StatusBarIOS. Trying to implement it now to learn the internals of react-native.
from react-native.
@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.
@nick: gotta start somewhere? :p
from react-native.
@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.
from react-native.
Oh, that's pretty cool already!
from react-native.
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.
@nick no regrets about giving you access :) - demo looks sick!
from react-native.
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.
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.
Wow, so fast! Looking
from react-native.
I merged in @amccloud 's change to my fork and its working great :-)
from react-native.
@amccloud do you mind doing a pull request on this repo?
from react-native.
Yes. That is my intention. I just want to fix the issue with the BOOL values first.
from react-native.
@a2 @nicklockwood do you know what's going on with the BOOL value?
from react-native.
Just catching up on email. I commented on why that's not working. Hopefully that helps. :)
from react-native.
@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.
@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.
Was added 9674c99 :)
from react-native.
Related Issues (20)
- REACT NATIVE 0.74.3 Signed Release APK Issue HOT 5
- [IOS] Compile Issue. It was working fine previously but now it stops working. HOT 2
- java.lang.Exception: React Native needs Node.js >= 18 HOT 5
- backgroundColor is not being applied to Text and View when giving borderStyle as 'dotted' or 'dashed' HOT 1
- Xcode Unsupported Swift Version HOT 3
- Execution failed for task ':app:compileDebugJavaWithJavac'. HOT 2
- How to use https agent in React Native? HOT 4
- NativeModules is {} HOT 1
- Platform.constants.reactNativeVersion.prerelease should be a string HOT 5
- App restarts / crashes when enabling remote debugging with RN 0.73.9 for Android HOT 4
- 0.75.0-rc.4 - App build failed for task ':app:generateAutolinkingPackageList'. HOT 12
- `headers` defined in Image `source` prop are not sent along with the request for a remote image HOT 3
- Invariant Violation: "App" has not been registered. This can happen if: * Metro (the local dev server) is run from the wrong folder. Check if Metro is running, stop it and restart it in the current project. HOT 2
- AppState 'change' fires redundant 'active' when app is already active the first time the listener is added on Android iOS Prod HOT 3
- Build failure in Fabric when implementing custom Shadow Node with Swift integration
- build error HOT 3
- Strange Issue with PagerView/Image in a Full Screen Overlay (iOS only) HOT 3
- TextInput menu is not hidden even contextMenuHidden is true on Android HOT 2
- onEndReached does not trigger even though onEndReachedThreshold is set HOT 2
- [iOS] Hash Generated Using Broken Cryptography API (SHA1) HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-native.