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
// Kuyruk tarafından gruplanan çağrılar `buckets` içerisindedir | |
for (id queue in buckets) { | |
dispatch_block_t block = ^{ | |
NSOrderedSet *calls = [buckets objectForKey:queue]; | |
for (NSNumber *indexObj in calls) { | |
// Gerçek çağrım | |
} | |
}; | |
if (queue == RCTJSThread) { | |
[_javaScriptExecutor executeBlockOnJavaScriptQueue:block]; |
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
var { NativeModules } = require('react-native'); | |
var { Person } = NativeModules; | |
Person.greet('Zafer'); |
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
JSValueRef jsError = NULL; | |
JSStringRef execJSString = JSStringCreateWithCFString((__bridge CFStringRef)script); | |
JSStringRef jsURL = JSStringCreateWithCFString((__bridge CFStringRef)sourceURL.absoluteString); | |
JSValueRef result = JSEvaluateScript(strongSelf->_context.ctx, execJSString, NULL, jsURL, 0, &jsError); | |
JSStringRelease(jsURL); | |
JSStringRelease(execJSString); |
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
{ | |
"remoteModuleConfig": { | |
"Logger": { | |
"constants": { }, | |
"moduleID": 1, | |
"methods": { | |
"requestPermissions": { | |
"type": "remote", | |
"methodID": 1 | |
} |
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
JSGlobalContextRef ctx = JSGlobalContextCreate(NULL); | |
_context = [[RCTJavaScriptContext alloc] initWithJSContext:ctx]; |
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
unsigned int methodCount; | |
Method *methods = class_copyMethodList(moduleClass, &methodCount); | |
for (unsigned int i = 0; i < methodCount; i++) { | |
Method method = methods[i]; | |
SEL selector = method_getName(method); | |
if ([NSStringFromSelector(selector) hasPrefix:@"__rct_export__"]) { | |
IMP imp = method_getImplementation(method); | |
NSArray *entries = ((NSArray *(*)(id, SEL))imp)(_moduleClass, selector); | |
//... | |
[moduleMethods addObject:/* Object representing the method */]; |
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
NSMutableDictionary *modulesByName; // = ... | |
for (Class moduleClass in RCTGetModuleClasses()) { | |
// ... | |
module = [moduleClass new]; | |
if ([module respondsToSelector:@selector(setBridge:)]) { | |
module.bridge = self; | |
} | |
modulesByName[moduleName] = module; | |
// ... | |
} |
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
+ (NSArray *)__rct_export__12 | |
{ | |
return @[ @"", @"log:(NSString *)message" ]; | |
} |
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
#define RCT_EXPORT_MODULE(js_name) \ | |
RCT_EXTERN void RCTRegisterModule(Class); \ | |
+ (NSString *)moduleName { return @#js_name; } \ | |
+ (void)load { RCTRegisterModule(self); } |
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
@interface Person : NSObject <RCTBridgeModule> | |
@end | |
@implementation Logger | |
RCT_EXPORT_MODULE() | |
RCT_EXPORT_METHOD(greet:(NSString *)name) | |
{ | |
NSLog(@"Merhaba %@!", name); |