Better documentation for extending native classes
還沒有人認領這個 Issue。
評估
- 難度
- 4/5
- 預估耗時
- 3-5 天
- 新手友好度
- 35/100
- Issue 類型
- 文件
- 描述清晰度
- 需要釐清
- 活躍度
- 停滯
- 技術堆疊
- android, typescript
- 領域
- documentation, mobile
研究方向
從包含 TypeScript NativeClass 和 android.widget.Button 範例的現有文件區段開始。釐清 imports、類別放置的位置,以及如何在 StackLayout 中呈現子類別化的原生檢視,包括 NativeScript、Vue 和 Svelte 的用法;完成的標準是頁面透過完整範例回答這些問題,並說明 XML 如何與程式碼相關。
由索引模型根據 Issue 內容生成。
描述
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
- 主要語言
- JavaScript
- 星號
- 17
- 分支
- 31
- 平均合併
- 8 小時 51 分鐘
- 30 天內合併 PR
- 2
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
NativeScript/docs 的其他 Issue
-
難度 1/5 1 小時以內 新手友好度 68/100
NativeScript/docs#177 ·
-
難度 3/5 1-2 天 新手友好度 38/100
NativeScript/docs#189 ·
-
Label: maxLines 未關閉
難度 1/5 1 小時以內 新手友好度 48/100
NativeScript/docs#182 ·
-
難度 3/5 1-2 天 新手友好度 45/100
NativeScript/docs#178 · 1 則留言 ·
-
難度 2/5 1-3 小時 新手友好度 35/100
NativeScript/docs#159 ·
查看 NativeScript/docs 的全部 Issue
相似的 Issue
-
bug
難度 2/5 1-3 小時 新手友好度 76/100
avniproject/avni-client#2135 ·
-
automated broken-link
難度 1/5 1 小時以內 新手友好度 85/100
-
agent/security hive/hosted-available-lke648397-260827-5n31 security
難度 2/5 1-3 小時 新手友好度 84/100
-
enhancement
難度 2/5 1-3 小時 新手友好度 70/100
babalae/bettergi-scripts-list#3674 ·
-
A-Release-Notes C-Editing D-Modest S-Ready-For-Implementation
難度 2/5 1-3 小時 新手友好度 72/100
bevyengine/bevy-website#2595 ·