Git Product home page Git Product logo

reactbridge's Introduction

GitHub stats Top Langs

reactbridge's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

reactbridge's Issues

Class extensions not working on modules

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?

Getting Error while building XcFramework

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')

Screenshot 2024-01-11 at 3 53 44 PM

`@ReactView` with `@ReactProperty` that has a type of `RCTDirectEventBlock`

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 ๐Ÿ’œ

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.