API Reference: UI.StatusBar​
This class represents the status bar object. Creating an instance of StatusBar is not valid since you can't use in anywhere. If you want to access the status bar object, you can access it via the UI.Page.statusBar property of a page.
TypeScript code blocks include examples of how to implement, override and components within the theme. You can create page with the UI Editor to make your page compatible with theming and then you can implement themable components programmatically. Once the page is created with the UI Editor, it generates a class under scripts/generated/pages
. You can then extend that class with the following TypeScript classes.
If the StatusBar visible, page starts under the StatusBar for Android but StatusBar will overlaps the page for iOS if the HeaderBar is invisible at this moment.
import PageSampleDesign from 'generated/pages/pageSample';import FlexLayout = require('sf-core/ui/flexlayout');import Application = require('sf-core/application');import Slider = require('sf-core/ui/slider');​//You should create new Page from UI-Editor and extend with it.export default class Sample extends PageSampleDesign {​mySlider: Slider;​constructor() {super();// Overrides super.onShow methodthis.onShow = onShow.bind(this, this.onShow.bind(this));// Overrides super.onLoad methodthis.onLoad = onLoad.bind(this, this.onLoad.bind(this));​this.layout.flexDirection = FlexLayout.FlexDirection.ROW;this.layout.justifyContent = FlexLayout.JustifyContent.CENTER;this.layout.alignItems = FlexLayout.AlignItems.CENTER;}}​/*** @event onShow* This event is called when a page appears on the screen (everytime).* @param {function} superOnShow super onShow function* @param {Object} parameters passed from Router.go function*/function onShow(superOnShow: () => void) {const { headerBar } = this;superOnShow();Application.statusBar.visible = true;​//@ts-ignoreApplication.statusBar.dispatch({type: "updateUserStyle",userStyle: {android: {color: "#6FCAF7"},style: "LIGHTCONTENT"}})headerBar.visible = false;}​/*** @event onLoad* This event is called once when page is created.* @param {function} superOnLoad super onLoad function*/function onLoad(superOnLoad: () => void) {superOnLoad();}​
const Page = require("sf-core/ui/page");const extend = require("js-base/core/extend");const Color = require('sf-core/ui/color');const StatusBarStyle = require('sf-core/ui/statusbarstyle');​var Page1 = extend(Page)(function(_super) {_super(this, {onShow: function(params) {Application.statusBar.visible = true;Application.statusBar.android.color = Color.create("#6FCAF7");Application.statusBar.ios.style = StatusBarStyle.DEFAULT;Application.headerBar.visible = false;}});​});module.exports = Page1;
​​
​