Skip to content
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

@ReactView with @ReactProperty that has a type of RCTDirectEventBlock #7

Closed
Brett-Best opened this issue Apr 30, 2024 · 4 comments
Closed

Comments

@Brett-Best
Copy link
Contributor

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 💜

@Brett-Best
Copy link
Contributor Author

Brett-Best commented May 1, 2024

I made a change similar to the support for RCTBubblingEventBlock here Brett-Best@ccdff7b - seems to work well.

Feel free to cherry pick / modify it :)

@ikhvorost
Copy link
Owner

You can use RCTBubblingEventBlock instead of RCTDirectEventBlock because they have equal signatures but I consider adding those types to new release.

@ikhvorost
Copy link
Owner

The types are added to 1.1.0. Thanks.

@Brett-Best
Copy link
Contributor Author

Thanks 💜

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants