diff options
author | Samuel Newman <mozzius@protonmail.com> | 2024-05-29 07:08:46 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-28 21:08:46 -0700 |
commit | b59c8e22af0d92988d2145ea28299230f3b71180 (patch) | |
tree | 3bfc697a5e709a29ee4f71fc538e9104855f9d07 /modules/expo-bluesky-translate/ios/ExpoBlueskyTranslateModule.swift | |
parent | a60f9933d8c5734391b9f5b14c1bdb0d17ac0468 (diff) | |
download | voidsky-b59c8e22af0d92988d2145ea28299230f3b71180.tar.zst |
Native translation expo module (#4098)
* translation expo module * add `onClose` and `onReplacementAction` * rm onReplacementAction * make all props published * make translation api available globally w/o wrapper (#4110) * conditionally import the translation module * only use native translation if language is probably supported * open native translation via dropdown menu --------- Co-authored-by: Hailey <me@haileyok.com> Co-authored-by: Dan Abramov <dan.abramov@gmail.com>
Diffstat (limited to 'modules/expo-bluesky-translate/ios/ExpoBlueskyTranslateModule.swift')
-rw-r--r-- | modules/expo-bluesky-translate/ios/ExpoBlueskyTranslateModule.swift | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/modules/expo-bluesky-translate/ios/ExpoBlueskyTranslateModule.swift b/modules/expo-bluesky-translate/ios/ExpoBlueskyTranslateModule.swift new file mode 100644 index 000000000..afa813722 --- /dev/null +++ b/modules/expo-bluesky-translate/ios/ExpoBlueskyTranslateModule.swift @@ -0,0 +1,18 @@ +import ExpoModulesCore +import Foundation +import SwiftUI + +public class ExpoBlueskyTranslateModule: Module { + public func definition() -> ModuleDefinition { + Name("ExpoBlueskyTranslate") + + AsyncFunction("presentAsync") { (text: String) in + DispatchQueue.main.async { [weak state = TranslateViewState.shared] in + state?.isPresented = true + state?.text = text + } + } + + View(ExpoBlueskyTranslateView.self) {} + } +} |