ikhvorost / reactbridge Goto Github PK
View Code? Open in Web Editor NEWSwift Macros for React Native
License: MIT License
Swift Macros for React Native
License: MIT License
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:
// TestModule.swift
import Foundation
import React
import ReactBridge
@ReactModule
class TestModule: NSObject, RCTBridgeModule {
@ReactMethod
@objc func sayHello() {
print("Hello, world!")
}
}
extension TestModule {
@ReactMethod
@objc func sayHello2() {
print("Hello, world!")
}
}
In the above, React is able to detect sayHello
, but not sayHello2
, so only the 1st can be invoked by the JS.
If I manually declare the methods, then it works:
#import "React/RCTBridgeModule.h"
@interface RCT_EXTERN_MODULE(TestModule, NSObject)
RCT_EXTERN_METHOD(sayHello)
RCT_EXTERN_METHOD(sayHello2)
@end
Any idea what could be causing this?
Thank you so much for making a great package. It helps me avoid Objective-C code while implementing the React Native Modules. Please help me solve this error, I am getting this error while building the XcFramework in iOS.
error: The package product 'SwiftSyntaxMacros' requires minimum platform version 13.0 for the iOS platform, but this target supports 12.0 (in target 'ReactBridgeMacros' from project 'ReactBridge')
error: The package product 'SwiftCompilerPlugin' requires minimum platform version 13.0 for the iOS platform, but this target supports 12.0 (in target 'ReactBridgeMacros' from project 'ReactBridge')
Hi,
I'm trying to migrate the below:
#import <React/RCTViewManager.h>
#import "React/RCTBridgeModule.h"
@interface RCT_EXTERN_MODULE(NativeAppViewManager, RCTViewManager)
RCT_EXPORT_VIEW_PROPERTY(onNavUpdate, RCTDirectEventBlock)
RCT_EXPORT_VIEW_PROPERTY(onNavBack, RCTDirectEventBlock)
RCT_EXPORT_VIEW_PROPERTY(screenOptions, NSDictionary *)
RCT_EXTERN_METHOD(create: (nonnull NSNumber *) node)
RCT_EXTERN_METHOD(navigate: (nonnull NSNumber *) node action: (nonnull NSDictionary *) action)
RCT_EXTERN_METHOD(navigateMulti: (nonnull NSNumber *) node actions: (nonnull NSArray *) actions)
@end
I got this far and hit the error: ReactBridge: 'RCTDirectEventBlock' type is not supported
@ReactView
class NativeAppViewManager: RCTViewManager {
@ReactProperty var onNavUpdate: RCTDirectEventBlock?
Would you have any ideas of a workaround? Or where a fix would need to be made either in the code above or in the macro?
Thanks so much ๐
Just wondering if you've had any thought on ways to address the strict concurrency warnings which will become errors in Swift 6?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.