Przejdź do treści
Biblioteka skilli
Programowanie · Budowanie i kod

nativescript

/nativescript

Doradza w NativeScript: bezpośredni dostęp do natywnych API z JavaScript i TypeScript, układy XML, własne opakowania natywne i wdrożenia wieloplatformowe aplikacji mobilnych bez WebView.

Repozytorium
Agent-Skills ↗
Licencja
MIT
Ostatnia zmiana repozytorium
01.10.2026

Ocena i bezpieczeństwo

100/ 100Klasa: dobry
Format25 / 25
Frontmatter z nazwą i opisem, poprawna nazwa, opis do 1024 znaków, nazwa zgodna z folderem.
Odkrywalność25 / 25
Opis mówi, kiedy użyć skilla, ma sensowną długość i jest w 3. osobie.
Treść35 / 35
Co najmniej 150 słów i do 500 linii, nagłówki, listy kroków, przykłady albo kod.
Higiena15 / 15
Bez zaślepek typu TODO, bez ścieżek Windows, z licencją.
Ryzykobrak sygnałów w skanie
Pliki w paczce
1
Skrypty
0
Komentarze HTML
1
Adresy URL w SKILL.md
3
Przestarzałość

Brak sygnałów. Repozytorium zmienione 01.10.2026, bez odwołań do wycofanych modeli i API.

Licencja

MIT, otwarta: można używać i zmieniać, z zachowaniem informacji o autorze.

Co sprawdzić przed instalacją
  • SKILL.md zawiera komentarze HTML (1). Nie widać ich w podglądzie Markdown, a model je czyta.

Co robi i kiedy

Doradza w NativeScript: bezpośredni dostęp do natywnych API z JavaScript i TypeScript, układy XML, własne opakowania natywne i wdrożenia wieloplatformowe aplikacji mobilnych bez WebView.

Oryginalny opis (EN)

Expert NativeScript assistance covering direct native API access from JavaScript/TypeScript, XML layouts, custom native wrappers, and cross-platform app deployment. Use when building truly native mobile apps without WebViews using JavaScript or TypeScript.

Jak działa

  1. When to Use
  2. Quick Start
  3. Core Concepts
  4. Common Patterns
  5. Best Practices
  6. Troubleshooting
  7. References
Sekcje z nagłówków SKILL.md, w oryginale · 164 linii, 599 słów
Podgląd SKILL.md
---
name: nativescript
description: Expert NativeScript assistance covering direct native API access from JavaScript/TypeScript, XML layouts, custom native wrappers, and cross-platform app deployment. Use when building truly native mobile apps without WebViews using JavaScript or TypeScript.
---

# NativeScript

NativeScript allows you to write native mobile apps using JavaScript/TypeScript, Angular, Vue, or Svelte. Unlike hybrid apps (WebView), it renders **native UI components** and provides **direct access** to all iOS and Android APIs without boilerplate wrappers.

## When to Use

- **Direct Native API Access**: Invoking 100% of native iOS (Objective-C/Swift) and Android (Java/Kotlin) APIs directly from TypeScript/JavaScript.
- **True Native Views without WebViews**: Building apps that render native UIKit/SwiftUI and Android View/Compose hierarchies without WebView overhead.
- **Familiar Web Framework Tooling**: Writing native mobile apps using modern Angular, Vue, React, or Svelte frameworks.
- **High-Performance Hardware Interop**: Interfacing directly with native device hardware libraries and third-party iOS CocoaPods or Android AARs.

## Quick Start

```bash
npm install -g nativescript
ns create my-app
# Choose flavor: Angular, Vue, React, Svelte, or TypeScript
cd my-app
ns run android
```

```typescript
// Accessing Native APIs directly (Android)
const time = new android.text.format.Time();
time.setToNow();
console.log(time.format("%d.%m.%Y"));
```

## Core Concepts

### Direct Native Runtime Bridge

NativeScript generates JavaScript runtime bindings for all platform APIs at compile time, allowing direct native instantiation:

```typescript
import { isIOS, isAndroid } from "@nativescript/core";

export function showNativeNotification(title: string, message: string) {
  if (isIOS) {
    const alert =
      UIAlertController.alertControllerWithTitleMessagePreferredStyle(
        title,
        message,
        UIAlertControllerStyle.Alert,
      );
    alert.addAction(
      UIAlertAction.actionWithTitleStyleHandler(
        "OK",
        UIAlertActionStyle.Default,
        null,
      ),
    );
    UIApplication.sharedApplication.keyWindow.rootViewController.presentViewControllerAnimatedCompletion(
      alert,
      true,
      null,
    );
  } else if (isAndroid) {
    const context = android.app.Application;
    android.widget.Toast.makeText(
      context,
      message,
      android.widget.Toast.LENGTH_SHORT,
    ).show();
  }
}
```

### Declarative Native Layout Containers

NativeScript layouts translate directly into native ViewGroup components:

```xml
<!-- app-main.xml -->
<Page xmlns="http://schemas.nativescript.org/tns.xsd" navigatingTo="onNavigatingTo">
    <ActionBar title="Inventory Manager" class="action-bar" />
    <GridLayout rows="auto, *" columns="*">
        <SearchBar row="0" hint="Search items..." text="{{ searchQuery }}" />
        <ListView row="1" items="{{ inventoryItems }}">
            <ListView.itemTemplate>
                <StackLayout class="item-card">
                    <Label text="{{ name }}" class="item-title" />
                    <Label text="{{ stockCount }}" class="item-subtitle" />
                </StackLayout>
            </ListView.itemTemplate>
        </ListView>
    </GridLayout>
</Page>
```

### Native Plugin Integration via CocoaPods & Gradle

Seamlessly bundles third-party native libraries:

```ruby
# App_Resources/iOS/Podfile
pod 'Lottie', '~> 4.0'
```

## Common Patterns

### Platform-Specific Code Splitting

**Problem**: Writing distinct native implementations for iOS and Android without polluting UI files with runtime branching.

**Solution**:
Use file suffix convention (`.ios.ts` and `.android.ts`) or conditional platform checks:

```typescript
import { isAndroid, isIOS, Application } from "@nativescript/core";

export function showToast(message: string): void {
  if (isAndroid) {
    android.widget.Toast.makeText(
      Application.android.context,
      message,
      android.widget.Toast.LENGTH_SHORT,
    ).show();
  } else if (isIOS) {
    // Present native UIAlertController on root view controller
    const alert =
      UIAlertController.alertControllerWithTitleMessagePreferredStyle(
        null,
        message,
        UIAlertControllerStyle.Alert,
      );
    Application.ios.rootController.presentViewControllerAnimatedCompletion(
      alert,
      true,
      null,
    );
  }
}
```

## Best Practices

**Do**:

- Use Modern Framework Flavors: Prefer `@nativescript/angular` or `@nativescript/vue` for modern component architectures.
- Cache Native Object Lookups: Store repeated native references instead of constantly traversing the JS-to-native reflection bridge.
- Implement Virtualized Lists: Always use `ListView` or `CollectionView` rather than repeating items inside a `ScrollView`.
- Test on Physical Devices: Native bridge behavior and memory performance differ significantly between simulators and actual devices.

**Don't**:

- Use HTML/DOM APIs: There is no browser DOM in NativeScript; do not reference `document.getElementById` or `window`.
- Block the Native UI Thread: Offload heavy computational algorithms to background Web Workers.
- Ignore Platform Differences: Account for distinct iOS navigation controllers versus Android activity back-stack lifecycles.

## Troubleshooting

| Error               | Cause                                     | Solution                                                     |
| :------------------ | :---------------------------------------- | :----------------------------------------------------------- |
| `Marshalling Error` | Passing wrong type to native interaction. | Check native docs and cast types if needed.                  |
| `Out of Memory`     | Large images or memory leaks.             | Use `image-cache-it` or proper GC disposal management.       |
| `Build Failed`      | Native dependency issues.                 | `ns clean`, remove `platforms/` and `node_modules/`, re-run. |

## References

- [NativeScript Docs](https://docs.nativescript.org/)
- [NativeScript Plugins](https://market.nativescript.org/)

Wersje

W bazie nie ma innych skilli o nazwie nativescript.

Migawka bazy z 13.11.2026 · wersja paczki 3d1f26e31830 (skrót SHA-256 całej paczki)

Pobrania w ostatnich 30 dniach: 0 · ranking

Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.

Podobne skille

  • 100screenmap
    Generuje wizualną mapę nawigacji aplikacji Expo, React Native lub NativeScript z trasami i zrzutami ekranów z symulatora.
  • 95react-native
    Pomaga tworzyć wieloplatformowe aplikacje mobilne iOS i Android w React Native i Expo, wdrażać funkcje natywne i optymalizować wydajność.
  • 100react-native-expert
    Wspiera rozwój wieloplatformowych aplikacji mobilnych w React Native: architektura, typy komponentów, hooki, nawigacja, moduły natywne i optymalizacja wydajności.
  • 95native-sdk
    Wprowadza w Native SDK, zestaw do budowy natywnych aplikacji desktopowych w TypeScript i deklaratywnym znaczniku .native, kompilowanych do kodu natywnego bez runtime JS, z opcją Zig i WebView.
  • 100javascript-typescript
    Wspiera tworzenie aplikacji w JavaScript i TypeScript: ES6+, Node.js, Express, React, frameworki testowe, REST API i dobre praktyki.
  • 100eslint
    Wspiera pracę z ESLint: Flat Config (eslint.config.js), typescript-eslint, własne reguły i automatyczne formatowanie dla jakości kodu JavaScript i TypeScript.

Uwagi i zgłoszenia

Wiadomość trafi do Bartosza Sokolińskiego. Adres e-mail jest potrzebny tylko do odpowiedzi. Szczegóły w polityce prywatności.