* 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>
18 lines
454 B
Swift
18 lines
454 B
Swift
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) {}
|
|
}
|
|
}
|