-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
49 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
// | ||
// RegisterModules.m | ||
// ReactBridgeUtils.m | ||
// | ||
// Created by Iurii Khvorost <[email protected]> on 2023/07/24. | ||
// Copyright © 2023 Iurii Khvorost. All rights reserved. | ||
|
@@ -24,9 +24,20 @@ | |
// | ||
|
||
#import <objc/runtime.h> | ||
#import <Foundation/Foundation.h> | ||
#import "ReactBridgeUtils.h" | ||
|
||
__attribute__((constructor)) | ||
static void registerModules(void) { | ||
|
||
// From RCTBridgeModule.h | ||
typedef struct RCTMethodInfo { | ||
const char * jsName; | ||
const char * objcName; | ||
BOOL isSync; | ||
} RCTMethodInfo; | ||
|
||
@implementation ReactBridgeUtils | ||
|
||
+ (void)load { | ||
SEL selector = @selector(_registerModule); | ||
|
||
int numClasses = objc_getClassList(NULL, 0); | ||
|
@@ -50,3 +61,13 @@ static void registerModules(void) { | |
} | ||
free(classes); | ||
} | ||
|
||
+ (const void *)methodInfo:(NSString *)jsName objcName:(NSString *)objcName isSync:(BOOL)isSync { | ||
RCTMethodInfo* methodInfo = malloc(sizeof(RCTMethodInfo)); | ||
methodInfo->jsName = strdup([jsName cStringUsingEncoding: NSUTF8StringEncoding]); | ||
methodInfo->objcName = strdup([objcName cStringUsingEncoding: NSUTF8StringEncoding]); | ||
methodInfo->isSync = isSync; | ||
return methodInfo; | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#import <Foundation/Foundation.h> | ||
|
||
NS_ASSUME_NONNULL_BEGIN | ||
|
||
@interface ReactBridgeUtils: NSObject | ||
|
||
+ (const void *)methodInfo:(NSString *)jsName objcName:(NSString *)objcName isSync:(BOOL)isSync; | ||
|
||
@end | ||
|
||
NS_ASSUME_NONNULL_END |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module ReactBridgeUtils { | ||
header "ReactBridgeUtils.h" | ||
} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters