Better documentation for extending native classes
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Anfängerfreundlichkeit
- 35/100
- Issue-Typ
- Dokumentation
- Klarheit
- Muss geklärt werden
- Aktivitätsstatus
- Veraltet
- Tech-Stack
- android, typescript
- Bereich
- documentation, mobile
Rechercherichtung
Beginne mit dem vorhandenen Dokumentationsabschnitt, der das Beispiel mit TypeScript NativeClass und android.widget.Button enthält. Kläre die Imports, die Platzierung der Klasse und wie eine abgeleitete native View in einem StackLayout gerendert wird, einschließlich der Verwendung mit NativeScript, Vue und Svelte; fertig ist die Aufgabe, wenn die Seite diese Fragen mit vollständigen Beispielen beantwortet und erklärt, wie XML mit dem Code zusammenhängt.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Is your feature request related to a problem? Please describe.
I need to have access to a native method for the ListView component. The documentation is very unclear about how I would go about doing this. It says that I can subclass android components and has a short example of what this would look like, but the example is frankly very unhelpful:
let constructorCalled = false
@NativeClass
class MyButton extends android.widget.Button {
constructor() {
super()
constructorCalled = true
// necessary when extending TypeScript constructors
return global.__native(this)
}
setEnabled(enabled: boolean): void {
this.super.setEnabled(enabled)
}
}
const button = new MyButton(context)
This example refers to the NativeClass decorator and the android.widget.Button class. Presumeable these would have to be imported from some nativescript modules, but there are no import statements at the top of the file. Where are these coming from? Also, how do I then use this class after extending the base class? If I want it to show up in a stack layout on my main page, for example, how would I do this using nativescript? What about with Vue? Or Svelte? Just instantiating it at the bottom of the file does nothing to tell the application where it should be placed. Also, do I need to place this code in some specific file or directory for it to be picked up by the rest of my code, like from the .xml file?
None of this is mentioned.
Describe the solution you'd like
I'd be satisfied if someone could answer my questions here, but I think the documentation could benefit a lot from this information being added to it directly.
Describe alternatives you've considered
I've searched through the docs, and searched the web too. Nothing is helpful.
Anything else?
No response
Please accept these terms
- I have searched the existing issues as well as StackOverflow and this has not been posted before
- I agree to follow this project's Code of Conduct
- Vorherrschende Sprache
- JavaScript
- Sterne
- 17
- Forks
- 31
- Ø Merge
- 8 Std. 51 Min.
- Gemergte PRs (30 T.)
- 2
Beitragsleitfaden
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus NativeScript/docs
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 68/100
NativeScript/docs#177 ·
-
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 38/100
NativeScript/docs#189 ·
-
Label: maxLines Offen
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 48/100
NativeScript/docs#182 ·
-
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 45/100
NativeScript/docs#178 · 1 Kommentar ·
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 35/100
NativeScript/docs#159 ·
Alle Issues in NativeScript/docs
Ähnliche Issues
-
bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
avniproject/avni-client#2135 ·
-
enhancement
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 70/100
babalae/bettergi-scripts-list#3674 ·
-
A-Release-Notes C-Editing D-Modest S-Ready-For-Implementation
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
bevyengine/bevy-website#2595 ·
-
ecosystem wording
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 90/100
matrix-org/matrix.org#3649 ·
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 88/100
vadimdemedes/ink#1029 ·