Better documentation for extending native classes
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 35/100
- Tipo de issue
- Documentación
- Claridad
- Necesita aclaración
- Estado de actividad
- Estancado
- Stack tecnológico
- android, typescript
- Área
- documentation, mobile
Línea de trabajo
Comienza por la sección de documentación existente que contiene el ejemplo de TypeScript NativeClass y android.widget.Button. Aclara los imports, la ubicación de la clase y cómo renderizar una vista nativa derivada en un StackLayout, incluido el uso con NativeScript, Vue y Svelte; se considera terminado cuando la página responde a estas preguntas con ejemplos completos y explica cómo se relaciona XML con el código.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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
- Lenguaje dominante
- JavaScript
- Estrellas
- 17
- Forks
- 31
- Merge medio
- 8 h 51 min
- PR fusionados (30 d)
- 2
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de NativeScript/docs
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 68/100
NativeScript/docs#177 ·
-
Dificultad 3/5 1-2 días Aptitud para principiantes 38/100
NativeScript/docs#189 ·
-
Label: maxLines Abierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 48/100
NativeScript/docs#182 ·
-
Dificultad 3/5 1-2 días Aptitud para principiantes 45/100
NativeScript/docs#178 · 1 comentario ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 35/100
NativeScript/docs#159 ·
Todos los issues de NativeScript/docs
Issues similares
-
code-quality refactoring
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
github/gh-aw-firewall#8816 ·
-
integration:quickjs org:external priority:backlog topic:code-interpreter topic:middleware type:feature
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
langchain-ai/deepagents#6450 ·
-
optimization optimization:agents-md-curator
Dificultad 2/5 1-3 horas Aptitud para principiantes 86/100
githubnext/gh-aw-cao#13143 ·
-
status: needs triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100