|
4 | 4 | */ |
5 | 5 | import { Component, NO_ERRORS_SCHEMA, ChangeDetectionStrategy, signal, OnInit, OnDestroy, ViewChild, ElementRef } from '@angular/core'; |
6 | 6 | import { NativeScriptCommonModule, RouterExtensions } from '@nativescript/angular'; |
7 | | -import { ScrollView, isIOS } from '@nativescript/core'; |
| 7 | +import { ScrollView, isIOS, isAndroid } from '@nativescript/core'; |
8 | 8 | import { Streamdown } from '@nstudio/nstreamdown/angular'; |
9 | 9 | import type { StreamdownConfig } from '@nstudio/nstreamdown/angular'; |
10 | 10 |
|
| 11 | +// Platform-specific code example |
| 12 | +const PLATFORM_CODE_EXAMPLE = isIOS |
| 13 | + ? `And here's some Swift for iOS: |
| 14 | +
|
| 15 | +\`\`\`swift |
| 16 | +import UIKit |
| 17 | +
|
| 18 | +class ViewController: UIViewController { |
| 19 | + override func viewDidLoad() { |
| 20 | + super.viewDidLoad() |
| 21 | + print("Hello from NativeScript!") |
| 22 | + } |
| 23 | +} |
| 24 | +\`\`\`` |
| 25 | + : `And here's some Kotlin for Android: |
| 26 | +
|
| 27 | +\`\`\`kotlin |
| 28 | +import android.os.Bundle |
| 29 | +import androidx.appcompat.app.AppCompatActivity |
| 30 | +
|
| 31 | +class MainActivity : AppCompatActivity() { |
| 32 | + override fun onCreate(savedInstanceState: Bundle?) { |
| 33 | + super.onCreate(savedInstanceState) |
| 34 | + println("Hello from NativeScript!") |
| 35 | + } |
| 36 | +} |
| 37 | +\`\`\``; |
| 38 | + |
11 | 39 | // Sample AI response that demonstrates all markdown features |
12 | 40 | const DEMO_MARKDOWN = `# NativeScript Streamdown 🚀 |
13 | 41 |
|
@@ -38,18 +66,7 @@ export class DemoComponent { |
38 | 66 | } |
39 | 67 | \`\`\` |
40 | 68 |
|
41 | | -And here's some Swift for iOS: |
42 | | -
|
43 | | -\`\`\`swift |
44 | | -import UIKit |
45 | | -
|
46 | | -class ViewController: UIViewController { |
47 | | - override func viewDidLoad() { |
48 | | - super.viewDidLoad() |
49 | | - print("Hello from NativeScript!") |
50 | | - } |
51 | | -} |
52 | | -\`\`\` |
| 69 | +${PLATFORM_CODE_EXAMPLE} |
53 | 70 |
|
54 | 71 | ## Tables |
55 | 72 |
|
|
0 commit comments