Document @NativeClass and co.
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
- Issue type
- Documentation
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- android, ios, typescript
- Domain
- documentation, mobile-dev
Research direction
Start by reviewing the existing NativeScript documentation structure and the Android example in this issue, then identify the current guidance for @NativeClass, @ObjCProtocols, @JavaProxy, and @Interfaces. Document common Android and iOS native-access patterns, including delegates, and ensure each annotation's usage and purpose are explained.
Written by the indexing model from the issue text.
Description
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.
- Dominant language
- JavaScript
- Stars
- 17
- Forks
- 31
- Avg merge
- 8h 51m
- Merged PRs (30d)
- 2
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from NativeScript/docs
-
Difficulty 1/5 Under an hour Newbie friendliness 68/100
NativeScript/docs#177 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 38/100
NativeScript/docs#189 ·
-
Label: maxLines Open
Difficulty 1/5 Under an hour Newbie friendliness 48/100
NativeScript/docs#182 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
NativeScript/docs#178 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 35/100
NativeScript/docs#159 ·
All issues in NativeScript/docs
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
palladius/rails8-app-on-gcp#145 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
dotenvx/dotenv-vscode#139 ·
-
test-change-proposal
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
web-platform-tests/interop#1455 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
corsairdev/corsair#1764 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100