Skip to content
This repository was archived by the owner on Nov 17, 2022. It is now read-only.

Commit 3e57813

Browse files
authored
Merge pull request #1302 from NativeScript/niliev/action-bar-prop
docs: removing property startPageActionBarHidden from docs
2 parents 374b94e + 95b7eaa commit 3e57813

File tree

2 files changed

+42
-32
lines changed

2 files changed

+42
-32
lines changed

docs/core-concepts/angular-bootstrap.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ One of our major design goals here is to provide virtually the same interface as
2727
Application options in NativeScript are configured at the time the application boots. That could be problematic for Angular apps since the usual application start up process is hidden inside the `platformNativeScriptDynamic` black box. To allow for customizations, we introduced an additional `AppOptions` parameter to the platform initialization function that lets you preconfigure certain aspects of your application behavior. At the moment those are:
2828

2929
* `cssFile`: overrides the path to the file containing global CSS rules that are applied to all visual objects in the application. The default path is `app.css`.
30-
* `startPageActionBarHidden`: a boolean setting controlling whether your app will display the action bar on startup. The default setting is platform-specific: it displays the action bar on Android and hides it on iOS.
30+
* `createFrameOnBootstrap`: In cases where your application **don't use `page-router-outlet`** , you will not get the default `Page` and `Frame`, which means you will not be able to inject them in your components or show the `ActionBar`. There is special `createFrameOnBootstrap` boolean option you can pass on bootstrap to make things as before 4.0.0:
3131

32-
```typescript
33-
platformNativeScriptDynamic({startPageActionBarHidden: true});
32+
```TS
33+
platformNativeScriptDynamic({ createFrameOnBootstrap: true });
3434
```
3535

3636
## Customizing DI Providers

docs/ui/action-bar.md

Lines changed: 39 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -9,28 +9,7 @@ previous_url: /cookbook/ui/action-bar
99

1010
# Action Bar
1111

12-
The article describes how to use the ActionBar component in a non-Angular NativeScript application as well as some iOS and Android specifics. All described scenarios are demonstrated with the appropriate code snippet.
13-
14-
* [Defining The ActionBar](#defining-the-actionbar)
15-
* [Title](#title)
16-
* [Setting the Title Text](#setting-the-title-text)
17-
* [Using a Custom Title View](#using-a-custom-title-view)
18-
* [Using Custom View in Action Items](#using-custom-view-in-action-items)
19-
* [Setting the App Icon for Android](#setting-the-app-icon-for-android)
20-
* [Navigation Button](#navigation-button)
21-
* [iOS Specifics](#ios-specifics)
22-
* [Android Specifics](#android-specifics)
23-
* [Action Items](#action-items)
24-
* [Positioning](#positioning)
25-
* [Setting Icons](#setting-icons)
26-
* [How To](#how-to)
27-
* [Showing or Hiding the ActionBar](#showing-or-hiding-the-actionbar)
28-
* [Hiding Action Items](#hiding-action-items)
29-
* [Styling](#styling)
30-
* [Creating SideDrawer Button](#creating-sidedrawer-button)
31-
{% angular %} * [Adding Actions To Existing ActionBar](#adding-actions-to-existing-actionbar){% endangular %}
32-
33-
The `ActionBar` is the NativeScript common abstraction over the Android ActionBar and iOS NavigationBar.
12+
The article describes how to use the ActionBar component in a non-Angular NativeScript application as well as some iOS and Android specifics. All described scenarios are demonstrated with the appropriate code snippet. The `ActionBar` is the NativeScript common abstraction over the Android ActionBar and iOS NavigationBar.
3413

3514
## Defining The ActionBar
3615
{% nativescript %}
@@ -41,7 +20,7 @@ Here is how to define the ActionBar inside your page:
4120
<ActionBar title="My ActionBar"/>
4221
</Page.actionBar>
4322

44-
<!-- page content ... -->
23+
<!-- Page content ... -->
4524
</Page>
4625
```
4726
We will include only the `ActionBar` tag in the rest of the code-snippets in this article.
@@ -53,11 +32,7 @@ To define the ActionBar include the `ActionBar` tag inside a component template:
5332
```
5433
If more than one component defines an `ActionBar` - the last definition will be respected. You can also [add items to the current ActionBar](#adding-actions-to-existing-actionbar).
5534

56-
>Note: To show the ActionBar on the initial page of your application use the `startPageActionBarHidden: false` app option when bootstrapping the application.
57-
58-
```TypeScript
59-
platformNativeScriptDynamic({startPageActionBarHidden: false}).bootstrapModule(AppModule);
60-
```
35+
>Note: To hide the ActionBar on the initial page of your Angular application use the `actionBarHidden` boolean property while accesing the current `Page` instance.
6136
6237
{% endangular %}
6338

@@ -337,8 +312,43 @@ Values for `ios.systemIcon` are numbers from the [`UIBarButtonSystemItem`](https
337312
### Showing or Hiding the ActionBar
338313

339314
You can explicitly control the visibility of the `ActionBar` by setting the `actionBarHidden` property of the `Page`.
315+
{% nativescript %}
316+
317+
Hidng the `ActionBar` via XML.
318+
```XML
319+
<Page actionBarHidden="true" loaded="onPageLoaded">
320+
</Page>
321+
```
322+
Hidng the `ActionBar` via code-behind (TypeScript).
323+
```TS
324+
export function onPageLoaded(args: EventData) {
325+
const page = <Page>args.object;
326+
page.actionBarHidden = true;
327+
}
328+
329+
```
330+
{% endnativescript %}
340331
{% angular %}
341-
You can inject a reference to the current `Page` in the constructor of your component using the Angular DI.
332+
You can inject a reference to the current `Page` in the constructor of your component using the Angular Dependency Injection (DI).
333+
```TypeScript
334+
import { Component } from "@angular/core";
335+
import { isAndroid } from "tns-core-modules/platform";
336+
import { Page } from "tns-core-modules/ui/page";
337+
338+
@Component({
339+
selector: "ns-items",
340+
moduleId: module.id,
341+
templateUrl: "./items.component.html",
342+
})
343+
export class ItemsComponent {
344+
345+
constructor(private page: Page) {
346+
if (isAndroid) {
347+
this.page.actionBarHidden = true;
348+
}
349+
}
350+
}
351+
```
342352
{% endangular %}
343353

344354
In **Android**, the application bar is visible by default and shows the name of the application as title. The navigation button is visible only when it is explicitly defined in the application.

0 commit comments

Comments
 (0)