Skip to content

Commit

Permalink
ReactMethod: methodInfo fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ikhvorost committed Oct 10, 2023
1 parent e040596 commit 61b39c9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions Sources/ReactBridgeMacros/ReactMethod.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ extension ReactMethod: PeerMacro {
"""
@objc static func __rct_export__\(raw: funcName)() -> UnsafePointer<RCTMethodInfo>? {
struct Static {
static let jsName = NSString(string: \(raw: jsName))
static let objcName = NSString(string: "\(raw: objcName)")
static var methodInfo = RCTMethodInfo(jsName: jsName.utf8String, objcName: objcName.utf8String, isSync: \(raw: isSync))
static let jsName = strdup(\(raw: jsName))
static let objcName = strdup("\(raw: objcName)")
static var methodInfo = RCTMethodInfo(jsName: jsName, objcName: objcName, isSync: \(raw: isSync))
}
return withUnsafePointer(to: &Static.methodInfo) { $0 }
}
Expand Down
6 changes: 3 additions & 3 deletions Tests/ReactBridgeTests/ReactBridgeTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ final class ReactMethodTests: XCTestCase {
"""
@objc static func __rct_export__\(name)() -> UnsafePointer<RCTMethodInfo>? {
struct Static {
static let jsName = NSString(string: "\(jsName ?? name)")
static let objcName = NSString(string: "\(selector)")
static var methodInfo = RCTMethodInfo(jsName: jsName.utf8String, objcName: objcName.utf8String, isSync: \(isSync))
static let jsName = strdup("\(jsName ?? name)")
static let objcName = strdup("\(selector)")
static var methodInfo = RCTMethodInfo(jsName: jsName, objcName: objcName, isSync: \(isSync))
}
return withUnsafePointer(to: &Static.methodInfo) {
$0
Expand Down

0 comments on commit 61b39c9

Please sign in to comment.