diff --git a/android/src/main/java/io/ltbl/bdkrn/BdkRnModule.kt b/android/src/main/java/io/ltbl/bdkrn/BdkRnModule.kt index 4ac62e1..0cd67a9 100644 --- a/android/src/main/java/io/ltbl/bdkrn/BdkRnModule.kt +++ b/android/src/main/java/io/ltbl/bdkrn/BdkRnModule.kt @@ -393,8 +393,10 @@ class BdkRnModule(reactContext: ReactApplicationContext) : @ReactMethod fun sync(id: String, blockChainId: String, result: Promise) { try { - getWalletById(id).sync(getBlockchainById(blockChainId), BdkProgress) - result.resolve(true) + Thread { + getWalletById(id).sync(getBlockchainById(blockChainId), BdkProgress) + result.resolve(true) + }.start() } catch (error: Throwable) { result.reject("Sync wallet error", error.localizedMessage, error) } diff --git a/ios/BdkRnModule.swift b/ios/BdkRnModule.swift index f96ce44..1323e47 100644 --- a/ios/BdkRnModule.swift +++ b/ios/BdkRnModule.swift @@ -494,11 +494,13 @@ class BdkRnModule: NSObject { resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock ) { - do { - try getWalletById(id: id).sync(blockchain: getBlockchainById(id: blockChainId), progress: BdkProgress()) - resolve(true) - } catch let error { - reject("Sync wallet error", "\(error)", error) + DispatchQueue.main.async { [self] in + do { + try getWalletById(id: id).sync(blockchain: self.getBlockchainById(id: blockChainId), progress: BdkProgress()) + resolve(true) + } catch let error { + reject("Sync wallet error", "\(error)", error) + } } }