@@ -2,7 +2,8 @@ import SwiftSyntaxMacros
22import SwiftSyntaxMacrosTestSupport
33import XCTest
44
5- // Macro implementations build for the host, so the corresponding module is not available when cross-compiling.
5+
6+ // Macro implementations build for the host, so the corresponding module is not available when cross-compiling.
67// Cross-compiled tests may still make use of the macro itself in end-to-end tests.
78#if DEBUG && canImport(ReactBridgeMacros)
89
@@ -14,13 +15,21 @@ final class ReactMethodTests: XCTestCase {
1415 " ReactMethod " : ReactMethod . self,
1516 ]
1617
18+ private static var nonisolatedUnsafe : String = {
19+ #if swift(>=5.10)
20+ " nonisolated (unsafe) "
21+ #else
22+ " "
23+ #endif
24+ } ( )
25+
1726 func rct_export( name: String , selector: String , isSync: Bool = false , jsName: String ? = nil ) -> String {
1827 """
1928 @objc static func __rct_export__ \( name) () -> UnsafePointer<RCTMethodInfo>? {
2029 struct Static {
2130 static let jsName = strdup( " \( jsName ?? name) " )
2231 static let objcName = strdup( " \( selector) " )
23- nonisolated (unsafe) static var methodInfo = RCTMethodInfo(jsName: jsName, objcName: objcName, isSync: \( isSync) )
32+ \( Self . nonisolatedUnsafe ) static var methodInfo = RCTMethodInfo(jsName: jsName, objcName: objcName, isSync: \( isSync) )
2433 }
2534 return withUnsafePointer(to: &Static.methodInfo) {
2635 $0
@@ -489,13 +498,13 @@ final class ReactPropertyTests: XCTestCase {
489498 """
490499 class View {
491500 @ReactProperty
492- var a , b: Int?
501+ let a: Int = 10 , b: Int = 20
493502 }
494503 """ ,
495504 expandedSource:
496505 """
497506 class View {
498- var a , b: Int?
507+ let a: Int = 10 , b: Int = 20
499508 }
500509 """ ,
501510 diagnostics: [ diagnostic] ,
@@ -571,7 +580,13 @@ final class ReactPropertyTests: XCTestCase {
571580 var set: Set<String>?
572581
573582 @ReactProperty
574- var onData: RCTBubblingEventBlock?
583+ var onDirect: RCTDirectEventBlock?
584+
585+ @ReactProperty
586+ var onBubbling: RCTBubblingEventBlock?
587+
588+ @ReactProperty
589+ var onCapturing: RCTCapturingEventBlock?
575590
576591 @ReactProperty(keyPath: " muted " )
577592 var isMute: Bool?
@@ -607,9 +622,15 @@ final class ReactPropertyTests: XCTestCase {
607622 var set: Set<String>?
608623
609624 \( propConfig ( name: " set " , objcType: " NSSet " ) )
610- var onData: RCTBubblingEventBlock?
625+ var onDirect: RCTDirectEventBlock?
626+
627+ \( propConfig ( name: " onDirect " , objcType: " RCTDirectEventBlock " ) )
628+ var onBubbling: RCTBubblingEventBlock?
629+
630+ \( propConfig ( name: " onBubbling " , objcType: " RCTBubblingEventBlock " ) )
631+ var onCapturing: RCTCapturingEventBlock?
611632
612- \( propConfig ( name: " onData " , objcType: " RCTBubblingEventBlock " ) )
633+ \( propConfig ( name: " onCapturing " , objcType: " RCTCapturingEventBlock " ) )
613634 var isMute: Bool?
614635
615636 \( propConfig ( name: " isMute " , objcType: " BOOL " , keyPath: " muted " ) )
0 commit comments