Using button created from SwiftUI in ReactNative
This commit is contained in:
parent
97fb795866
commit
41081b5084
7 changed files with 52 additions and 1 deletions
16
ios/Native/Application/BaseButton/BaseButton.swift
Normal file
16
ios/Native/Application/BaseButton/BaseButton.swift
Normal file
|
@ -0,0 +1,16 @@
|
|||
//
|
||||
// BaseButton.swift
|
||||
// RNPlayground
|
||||
//
|
||||
// Created by Artur Gurgul on 02/08/2025.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct BaseButton: View {
|
||||
var body: some View {
|
||||
Button("SwiftUI Button") {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
12
ios/Native/Application/BaseButton/BaseButtonManager.m
Normal file
12
ios/Native/Application/BaseButton/BaseButtonManager.m
Normal file
|
@ -0,0 +1,12 @@
|
|||
//
|
||||
// BaseButtonManager.m
|
||||
// RNPlayground
|
||||
//
|
||||
// Created by Artur Gurgul on 02/08/2025.
|
||||
//
|
||||
|
||||
#import <React/RCTViewManager.h>
|
||||
|
||||
@interface RCT_EXTERN_MODULE(BaseButtonManager, RCTViewManager)
|
||||
|
||||
@end
|
21
ios/Native/Application/BaseButton/BaseButtonManager.swift
Normal file
21
ios/Native/Application/BaseButton/BaseButtonManager.swift
Normal file
|
@ -0,0 +1,21 @@
|
|||
//
|
||||
// BaseButtonManager.swift
|
||||
// RNPlayground
|
||||
//
|
||||
// Created by Artur Gurgul on 02/08/2025.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import React
|
||||
import SwiftUI
|
||||
|
||||
@objc(BaseButtonManager)
|
||||
class BaseButtonManager: RCTViewManager {
|
||||
override func view() -> UIView! {
|
||||
return UIHostingController(rootView: BaseButton()).view
|
||||
}
|
||||
|
||||
override static func requiresMainQueueSetup() -> Bool {
|
||||
return true
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue