Passing events from SwiftUI Button created by RN and getting it back to SwiftUI
This commit is contained in:
parent
41081b5084
commit
1a9884e0e9
6 changed files with 24 additions and 14 deletions
|
@ -8,9 +8,11 @@
|
|||
import SwiftUI
|
||||
|
||||
struct BaseButton: View {
|
||||
@EnvironmentObject var sharedState: SharedState
|
||||
|
||||
var body: some View {
|
||||
Button("SwiftUI Button") {
|
||||
|
||||
sharedState.text1 = "Clicked in SwiftUI button that was created in RN"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,7 +12,9 @@ import SwiftUI
|
|||
@objc(BaseButtonManager)
|
||||
class BaseButtonManager: RCTViewManager {
|
||||
override func view() -> UIView! {
|
||||
return UIHostingController(rootView: BaseButton()).view
|
||||
return UIHostingController(
|
||||
rootView: BaseButton()
|
||||
).view
|
||||
}
|
||||
|
||||
override static func requiresMainQueueSetup() -> Bool {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue