-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Class extensions not working on modules #2
Comments
Update: weirdly enough, if I explicitly add the static method which is generated by extension TestModule {
// React detects this!
@objc static func __rct_export__sayHello2() -> UnsafePointer<RCTMethodInfo>? {
struct Static {
static let jsName = strdup("sayHello2")
static let objcName = strdup("sayHello2")
static var methodInfo = RCTMethodInfo(jsName: jsName, objcName: objcName, isSync: false)
}
return withUnsafePointer(to: &Static.methodInfo) {
$0
}
}
@objc func sayHello2() {
print("Hello, world!")
}
} |
Hi! Looks like it is the compiler issue because it does't generate objc exported methods for React Native in the extensions. I saw the similar problems with Xcode 15.0 betas and hope it will be fixed in new releases of Xcode. |
That explains a lot, thanks. Is there anywhere where we could report this bug? |
@tmoran-stenoa, the issue is fixed on Xcode 15.3 and you can declare your bridged methods within extensions. |
Nice, thanks! I can't confirm this right now but will take your word for it. |
Hey!
Thank you so much for making this package. I've found a small issue: methods declared in extensions are not picked up by React. For example:
In the above, React is able to detect
sayHello
, but notsayHello2
, so only the 1st can be invoked by the JS.If I manually declare the methods, then it works:
Any idea what could be causing this?
The text was updated successfully, but these errors were encountered: