Comments (12)
Ah. Thank you.
It appears that iOS requires this to be done at the app delegate level. You have to set the info.plist
(located in app/App_Resources/iOS
) key turning off View Controller based Status Bar Appearance...
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
You then have to specify the status bar style in the app delegate....
import application = require("application");
class MyDelegate extends UIResponder implements UIApplicationDelegate {
public static ObjCProtocols = [UIApplicationDelegate];
applicationDidFinishLaunchingWithOptions(application: UIApplication, launchOptions: NSDictionary): boolean {
// set the status bar to light content
UIApplication.sharedApplication().statusBarStyle = 1;
return true;
}
applicationDidBecomeActive(application: UIApplication): void {
console.log("applicationDidBecomeActive: " + application)
}
}
application.ios.delegate = MyDelegate;
application.start({ moduleName: "pages/home/home" });
from nativescript-statusbar.
Thanks Burke. That did the job.
For those using js rather than ts, here it is in JavaScript:
var AppDelegate = UIResponder.extend({
applicationDidFinishLaunchingWithOptions: function () {
// Set the status bar to light content
UIApplication.sharedApplication().statusBarStyle = 1;
return true;
}
}, {
name: "AppDelegate",
protocols: [UIApplicationDelegate]
});
application.ios.delegate = AppDelegate;
from nativescript-statusbar.
Just to note, if you don’t want to hardcode the 1
here, iOS does provide an enum you can use. UIStatusBarStyle.LightContent
=== 1
from nativescript-statusbar.
sharedApplication
is now a property.
UIApplication.sharedApplication().statusBarStyle = 1;
should now be
UIApplication.sharedApplication.statusBarStyle = 1;
Tripped me up there for a while.
from nativescript-statusbar.
Experiencing the same issue as well.
from nativescript-statusbar.
Did you try removing the ios attribute and adding the
backgroundSpanUnderStatusBar to the page XML?
On Wed, Feb 24, 2016 at 7:17 PM Donald King [email protected]
wrote:
Experiencing the same issue as well.
—
Reply to this email directly or view it on GitHub
#2 (comment)
.
from nativescript-statusbar.
@burkeholland This is my set up:
<Page xmlns="http://schemas.nativescript.org/tns.xsd" loaded="pageLoaded" xmlns:x="nativescript-statusbar" class="mainGreen" backgroundSpanUnderStatusBar="true"> <x:StatusBar ios:barStyle="light" android:barStyle="#00C0F5" />
from nativescript-statusbar.
Yes. I tried that too.
<Page xmlns="http://schemas.nativescript.org/tns.xsd"
xmlns:x="nativescript-statusbar" loaded="loaded"
backgroundSpanUnderStatusBar="true">
Raef Akehurst
[email protected]
+61 (0)402 884 406
On Thu, Feb 25, 2016 at 12:26 PM, Donald King [email protected]
wrote:
@burkeholland https://github.com/burkeholland This is my set up:
xmlns:x="nativescript-statusbar"
class="mainGreen"
backgroundSpanUnderStatusBar="true">—
Reply to this email directly or view it on GitHub
#2 (comment)
.
from nativescript-statusbar.
I assume you're getting a white status bar on iOS? What happens when you
remove the statusbar component?
On Wed, Feb 24, 2016 at 8:11 PM Raef Akehurst [email protected]
wrote:
Yes. I tried that too.
<Page xmlns="http://schemas.nativescript.org/tns.xsd" xmlns:x="nativescript-statusbar" loaded="loaded" backgroundSpanUnderStatusBar="true">
Raef Akehurst
[email protected]
+61 (0)402 884 406On Thu, Feb 25, 2016 at 12:26 PM, Donald King [email protected]
wrote:@burkeholland https://github.com/burkeholland This is my set up:
xmlns:x="nativescript-statusbar"
class="mainGreen"
backgroundSpanUnderStatusBar="true">—
Reply to this email directly or view it on GitHub
<
#2 (comment).
—
Reply to this email directly or view it on GitHub
#2 (comment)
.
from nativescript-statusbar.
@burkeholland How do you remove it? since it wasn't specifically added?
from nativescript-statusbar.
I mean, without the status bar specified, does the
backgroundSpanUnderStatusBar work? If so, does it stop working when you
then add the StatusBar?
On Thu, Feb 25, 2016 at 5:53 AM Donald King [email protected]
wrote:
@burkeholland https://github.com/burkeholland How do you remove it?
since it wasn't specifically added?—
Reply to this email directly or view it on GitHub
#2 (comment)
.
from nativescript-statusbar.
Hi Burke. StatusBar works with and without backgroundSpanUnderStatusBar ... just not on the first page. In the attached image I have the difference scenarios. I hope this helps.
Top Image:
First page of my app (intro.xml) without backgroundSpanUnderStatusBar. Status bar is white as you would expect.
Middle Image:
First page of my app (intro.xml) with backgroundSpanUnderStatusBar. Status bar text is black but you would expect it to be white.
Bottom Image:
Login page of my app (login.xml). Same code uses as in the example above. Given it is not the firsst page the plugin seems to kick in and work because the status bar text is white.
from nativescript-statusbar.
Related Issues (16)
- Previous color statusbar persist after back button on Android HOT 3
- Does this work with NNG2? HOT 1
- isnt compatible with webpack HOT 2
- Crashing on both iOS and Android HOT 1
- Status Bar Color
- can not hide a status bar
- Support for NS + Angular HOT 4
- Changing programmatically
- NativeScript 4 HOT 2
- Project is dead ? HOT 1
- After closing App status bar changes color to black
- Not working with Angular modals in Android
- Works in VueJS too !!! HOT 3
- forked into nativescript-systemui HOT 4
- Issue with Angular 10 Nativescript 7 Incompatibility HOT 1
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 nativescript-statusbar.