How to resolve promise in react native kotlin override function?

Viewed 16

I still have no idea how to connect react function and get output from non react override function from native library, can anyone help me on this?

class NewLibModule(reactContext: ReactApplicationContext) : ReactContextBaseJavaModule(reactContext), OpenpathMobileAccessCore.OpenpathEventHandler {
    override fun getName(): String {
        return "NewLib"
    }

    @ReactMethod
    fun multiply(a: Int, b: Int, promise: Promise) {
          promise.resolve(a * b)
    }


    @ReactMethod
    fun initOpenPath(promise: Promise) {
      OpenpathMobileAccessCore.getInstance().init(application, this)
    }

  override fun onInit() {
    // This function is from openPath library,
    // will be called whenever OpenpathMobileAccessCore.getInstance().init called
    // and I want to promise.resolve here
  }
}
0 Answers
Related