...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
I've seen some notations in plugins, like @profile, @CSSType, and @cssProperty. I'm just leaving it here to collect. I think they have nothing to do with the previous ones but well
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
```ts @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.