package com.checkoutreactnativecomponents.components.card import com.checkoutreactnativecomponents.utils.Constants import com.facebook.react.bridge.ReactApplicationContext import com.facebook.react.bridge.ReactContextBaseJavaModule import com.facebook.react.bridge.ReactMethod import com.facebook.react.module.annotations.ReactModule import com.facebook.react.uimanager.UIManagerHelper import com.facebook.react.uimanager.common.UIManagerType @ReactModule(name = Constants.CARD_PAPER_MODULE) public class CardPaperModule(reactContext: ReactApplicationContext) : ReactContextBaseJavaModule(reactContext) { override fun getName(): String = Constants.CARD_PAPER_MODULE @ReactMethod public fun submit(reactTag: Double) { val tag = reactTag.toInt() val uiManager = UIManagerHelper.getUIManager(reactApplicationContext, UIManagerType.LEGACY) reactApplicationContext.runOnUiQueueThread { val view = uiManager?.resolveView(tag) as? Card view?.submit() } } @ReactMethod public fun tokenize(reactTag: Double) { val tag = reactTag.toInt() val uiManager = UIManagerHelper.getUIManager(reactApplicationContext, UIManagerType.LEGACY) reactApplicationContext.runOnUiQueueThread { val view = uiManager?.resolveView(tag) as? Card view?.tokenize() } } }