Skip to content

Commit

Permalink
rm onReplacementAction
Browse files Browse the repository at this point in the history
  • Loading branch information
mozzius committed May 19, 2024
1 parent 9be4231 commit 9d06ffd
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ public class ExpoBlueskyTranslateModule: Module {
Name("ExpoBlueskyTranslate")
View(ExpoBlueskyTranslateView.self) {
Events("onClose")
Events("onReplacementAction")
Prop("text") { (view: ExpoBlueskyTranslateView, text: String) in
view.props.text = text
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,22 @@ class TranslateViewProps: ObservableObject {
}
var children: [UIView]?
var onClose: EventDispatcher
var onReplacementAction: EventDispatcher
init(onClose: EventDispatcher, onReplacementAction: EventDispatcher) {
init(onClose: EventDispatcher) {
self.onClose = onClose
self.onReplacementAction = onReplacementAction
}
}

class ExpoBlueskyTranslateView: ExpoView {
let props: TranslateViewProps
let onClose = EventDispatcher()
let onReplacementAction = EventDispatcher()

override func didUpdateReactSubviews() {
let subChildren = self.reactSubviews()
props.children = subChildren
}

required init(appContext: AppContext? = nil) {
props = TranslateViewProps(onClose: onClose, onReplacementAction: onReplacementAction)
props = TranslateViewProps(onClose: onClose)
let hostingController = UIHostingController(rootView: TranslateView(props: props))
super.init(appContext: appContext)
setupHostingController(hostingController)
Expand Down
4 changes: 1 addition & 3 deletions modules/expo-bluesky-translate/ios/TranslateView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ struct TranslateView: View {
.translationPresentation(
isPresented: $props.isPresented,
text: props.text
) { translation in
props.onReplacementAction(["text": translation])
}
)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,4 @@ export type ExpoBlueskyTranslateProps = {
isPresented?: boolean
children: React.ReactNode
onClose?: () => void
onReplacementAction?: (event: {nativeEvent: {text: string}}) => void
}

0 comments on commit 9d06ffd

Please sign in to comment.