Better documentation for extending native classes
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 4/5
- Tempo estimado
- 3-5 dias
- Facilidade para iniciantes
- 35/100
- Tipo de issue
- Documentação
- Clareza
- Precisa de esclarecimento
- Status de atividade
- Estagnada
- Stack de tecnologia
- android, typescript
- Domínio
- documentation, mobile
Direção de pesquisa
Comece pela seção de documentação existente que contém o exemplo de TypeScript NativeClass e android.widget.Button. Esclareça os imports, o posicionamento da classe e como renderizar uma view nativa subclassificada em um StackLayout, incluindo o uso com NativeScript, Vue e Svelte; considera-se concluído quando a página responde a essas perguntas com exemplos completos e explica como XML se relaciona com o código.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
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
- Linguagem predominante
- JavaScript
- Estrelas
- 17
- Forks
- 31
- Merge médio
- 8h 51min
- PRs com merge (30d)
- 2
Guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de NativeScript/docs
-
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 68/100
NativeScript/docs#177 ·
-
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 38/100
NativeScript/docs#189 ·
-
Label: maxLines Aberta
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 48/100
NativeScript/docs#182 ·
-
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 45/100
NativeScript/docs#178 · 1 comentário ·
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 35/100
NativeScript/docs#159 ·
Todas as issues de NativeScript/docs
Issues semelhantes
-
code-quality refactoring
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 84/100
github/gh-aw-firewall#8816 ·
-
integration:quickjs org:external priority:backlog topic:code-interpreter topic:middleware type:feature
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 74/100
langchain-ai/deepagents#6450 ·
-
optimization optimization:agents-md-curator
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 86/100
githubnext/gh-aw-cao#13143 ·
-
status: needs triage
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 88/100
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 88/100