Document @NativeClass and co.
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 35/100
- Issue 类型
- 文档
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- android, ios, typescript
调研方向
首先查看现有的 NativeScript 文档结构以及此 issue 中的 Android 示例,然后确定当前针对 @NativeClass、@ObjCProtocols、@JavaProxy 和 @Interfaces 的指导。记录常见的 Android 和 iOS 原生访问模式,包括委托,并确保解释每个注解的用法和用途。
由索引模型根据 Issue 内容生成。
描述
From @vallemar
...how and when to use the @NativeClass or @Interface annotations, also how to add delegates in iOS. In general, how to access native under the most common situations
Example android class
@NativeClass()
@Interfaces([android.hardware.SensorEventListener])
class SensorEventListenerAndroid
extends java.lang.Object
implements android.hardware.SensorEventListener
{
callback: (event: number[]) => void;
callbackOnAccuracyChanged: (
sensor: android.hardware.Sensor,
accuracy: number
) => void;
constructor(callback: (data) => void) {
super();
this.callback = callback;
return global.__native(this);
}
onAccuracyChanged(sensor: android.hardware.Sensor, accuracy: number): void {
if (this.callbackOnAccuracyChanged) {
this.callbackOnAccuracyChanged(sensor, accuracy);
}
}
onSensorChanged(event: android.hardware.SensorEvent): void {
if (!event || (event.values.length === 0 && event.values[0])) return;
this.callback(event.values as number[]);
}
}
export { SensorEventListenerAndroid };
Document:
@NativeClass@ObjCProtocols@JavaProxy@Interfaces- ... ?
Eventually, we'll consolidate all of these into the @NativeClass as parameters, but until then, let's document all of these.
- 主要语言
- 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
-
Edit: CW+ 未关闭channels:edit check:passed
难度 2/5 1-3 小时 新手友好度 68/100
-
难度 2/5 1-3 小时 新手友好度 78/100
idean3885/claude-ops-agent#521 ·
-
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