mirror of
https://github.com/status-im/react-native.git
synced 2025-01-14 03:26:07 +00:00
Added non-class-scanning-based approach fror registering js methods
This commit is contained in:
parent
21a054e9fc
commit
bf4868edda
@ -8,7 +8,6 @@
|
|||||||
|
|
||||||
/* Begin PBXBuildFile section */
|
/* Begin PBXBuildFile section */
|
||||||
00481BE81AC0C86700671115 /* libRCTWebSocketDebugger.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00481BE61AC0C7FA00671115 /* libRCTWebSocketDebugger.a */; };
|
00481BE81AC0C86700671115 /* libRCTWebSocketDebugger.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00481BE61AC0C7FA00671115 /* libRCTWebSocketDebugger.a */; };
|
||||||
00481BEA1AC0C89D00671115 /* libicucore.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 00481BE91AC0C89D00671115 /* libicucore.dylib */; };
|
|
||||||
008F07F31AC5B25A0029DE68 /* main.jsbundle in Resources */ = {isa = PBXBuildFile; fileRef = 008F07F21AC5B25A0029DE68 /* main.jsbundle */; };
|
008F07F31AC5B25A0029DE68 /* main.jsbundle in Resources */ = {isa = PBXBuildFile; fileRef = 008F07F21AC5B25A0029DE68 /* main.jsbundle */; };
|
||||||
00C302E51ABCBA2D00DB3ED1 /* libRCTActionSheet.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302AC1ABCB8CE00DB3ED1 /* libRCTActionSheet.a */; };
|
00C302E51ABCBA2D00DB3ED1 /* libRCTActionSheet.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302AC1ABCB8CE00DB3ED1 /* libRCTActionSheet.a */; };
|
||||||
00C302E61ABCBA2D00DB3ED1 /* libRCTAdSupport.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302B41ABCB8E700DB3ED1 /* libRCTAdSupport.a */; };
|
00C302E61ABCBA2D00DB3ED1 /* libRCTAdSupport.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302B41ABCB8E700DB3ED1 /* libRCTAdSupport.a */; };
|
||||||
@ -116,7 +115,6 @@
|
|||||||
isa = PBXFrameworksBuildPhase;
|
isa = PBXFrameworksBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
00481BEA1AC0C89D00671115 /* libicucore.dylib in Frameworks */,
|
|
||||||
146834051AC3E58100842450 /* libReact.a in Frameworks */,
|
146834051AC3E58100842450 /* libReact.a in Frameworks */,
|
||||||
00481BE81AC0C86700671115 /* libRCTWebSocketDebugger.a in Frameworks */,
|
00481BE81AC0C86700671115 /* libRCTWebSocketDebugger.a in Frameworks */,
|
||||||
00C302E51ABCBA2D00DB3ED1 /* libRCTActionSheet.a in Frameworks */,
|
00C302E51ABCBA2D00DB3ED1 /* libRCTActionSheet.a in Frameworks */,
|
||||||
|
@ -9,7 +9,6 @@
|
|||||||
/* Begin PBXBuildFile section */
|
/* Begin PBXBuildFile section */
|
||||||
004D28A31AAF61C70097A701 /* UIExplorerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 004D28A21AAF61C70097A701 /* UIExplorerTests.m */; };
|
004D28A31AAF61C70097A701 /* UIExplorerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 004D28A21AAF61C70097A701 /* UIExplorerTests.m */; };
|
||||||
00D2771A1AB8C3E100DC1E48 /* libRCTWebSocketDebugger.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00D277131AB8C2C700DC1E48 /* libRCTWebSocketDebugger.a */; };
|
00D2771A1AB8C3E100DC1E48 /* libRCTWebSocketDebugger.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00D277131AB8C2C700DC1E48 /* libRCTWebSocketDebugger.a */; };
|
||||||
00D2771C1AB8C55500DC1E48 /* libicucore.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 00D2771B1AB8C55500DC1E48 /* libicucore.dylib */; };
|
|
||||||
13417FE91AA91432003F314A /* libRCTImage.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 13417FE81AA91428003F314A /* libRCTImage.a */; };
|
13417FE91AA91432003F314A /* libRCTImage.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 13417FE81AA91428003F314A /* libRCTImage.a */; };
|
||||||
134180011AA9153C003F314A /* libRCTText.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 13417FEF1AA914B8003F314A /* libRCTText.a */; };
|
134180011AA9153C003F314A /* libRCTText.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 13417FEF1AA914B8003F314A /* libRCTText.a */; };
|
||||||
1341802C1AA9178B003F314A /* libRCTNetwork.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 1341802B1AA91779003F314A /* libRCTNetwork.a */; };
|
1341802C1AA9178B003F314A /* libRCTNetwork.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 1341802B1AA91779003F314A /* libRCTNetwork.a */; };
|
||||||
@ -118,7 +117,6 @@
|
|||||||
004D28A11AAF61C70097A701 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
004D28A11AAF61C70097A701 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||||
004D28A21AAF61C70097A701 /* UIExplorerTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = UIExplorerTests.m; sourceTree = "<group>"; };
|
004D28A21AAF61C70097A701 /* UIExplorerTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = UIExplorerTests.m; sourceTree = "<group>"; };
|
||||||
00D2770E1AB8C2C700DC1E48 /* RCTWebSocketDebugger.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTWebSocketDebugger.xcodeproj; path = ../../Libraries/RCTWebSocketDebugger/RCTWebSocketDebugger.xcodeproj; sourceTree = "<group>"; };
|
00D2770E1AB8C2C700DC1E48 /* RCTWebSocketDebugger.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTWebSocketDebugger.xcodeproj; path = ../../Libraries/RCTWebSocketDebugger/RCTWebSocketDebugger.xcodeproj; sourceTree = "<group>"; };
|
||||||
00D2771B1AB8C55500DC1E48 /* libicucore.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libicucore.dylib; path = usr/lib/libicucore.dylib; sourceTree = SDKROOT; };
|
|
||||||
13417FE31AA91428003F314A /* RCTImage.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTImage.xcodeproj; path = ../../Libraries/Image/RCTImage.xcodeproj; sourceTree = "<group>"; };
|
13417FE31AA91428003F314A /* RCTImage.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTImage.xcodeproj; path = ../../Libraries/Image/RCTImage.xcodeproj; sourceTree = "<group>"; };
|
||||||
13417FEA1AA914B8003F314A /* RCTText.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTText.xcodeproj; path = ../../Libraries/Text/RCTText.xcodeproj; sourceTree = "<group>"; };
|
13417FEA1AA914B8003F314A /* RCTText.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTText.xcodeproj; path = ../../Libraries/Text/RCTText.xcodeproj; sourceTree = "<group>"; };
|
||||||
134180261AA91779003F314A /* RCTNetwork.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTNetwork.xcodeproj; path = ../../Libraries/Network/RCTNetwork.xcodeproj; sourceTree = "<group>"; };
|
134180261AA91779003F314A /* RCTNetwork.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTNetwork.xcodeproj; path = ../../Libraries/Network/RCTNetwork.xcodeproj; sourceTree = "<group>"; };
|
||||||
@ -150,7 +148,6 @@
|
|||||||
isa = PBXFrameworksBuildPhase;
|
isa = PBXFrameworksBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
00D2771C1AB8C55500DC1E48 /* libicucore.dylib in Frameworks */,
|
|
||||||
14AADF051AC3DBB1002390C9 /* libReact.a in Frameworks */,
|
14AADF051AC3DBB1002390C9 /* libReact.a in Frameworks */,
|
||||||
00D2771A1AB8C3E100DC1E48 /* libRCTWebSocketDebugger.a in Frameworks */,
|
00D2771A1AB8C3E100DC1E48 /* libRCTWebSocketDebugger.a in Frameworks */,
|
||||||
58005BF21ABA80A60062E044 /* libRCTTest.a in Frameworks */,
|
58005BF21ABA80A60062E044 /* libRCTTest.a in Frameworks */,
|
||||||
@ -207,7 +204,6 @@
|
|||||||
13417FEA1AA914B8003F314A /* RCTText.xcodeproj */,
|
13417FEA1AA914B8003F314A /* RCTText.xcodeproj */,
|
||||||
00D2770E1AB8C2C700DC1E48 /* RCTWebSocketDebugger.xcodeproj */,
|
00D2770E1AB8C2C700DC1E48 /* RCTWebSocketDebugger.xcodeproj */,
|
||||||
D85B82911AB6D5CE003F4FE2 /* RCTVibration.xcodeproj */,
|
D85B82911AB6D5CE003F4FE2 /* RCTVibration.xcodeproj */,
|
||||||
00D2771B1AB8C55500DC1E48 /* libicucore.dylib */,
|
|
||||||
);
|
);
|
||||||
name = Libraries;
|
name = Libraries;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
|
@ -15,10 +15,13 @@
|
|||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation RCTActionSheetManager {
|
@implementation RCTActionSheetManager
|
||||||
|
{
|
||||||
NSMutableDictionary *_callbacks;
|
NSMutableDictionary *_callbacks;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RCT_EXPORT_MODULE()
|
||||||
|
|
||||||
- (instancetype)init
|
- (instancetype)init
|
||||||
{
|
{
|
||||||
if ((self = [super init])) {
|
if ((self = [super init])) {
|
||||||
|
@ -11,6 +11,8 @@
|
|||||||
|
|
||||||
@implementation RCTAdSupport
|
@implementation RCTAdSupport
|
||||||
|
|
||||||
|
RCT_EXPORT_MODULE()
|
||||||
|
|
||||||
- (void)getAdvertisingId:(RCTResponseSenderBlock)callback withErrorCallback:(RCTResponseSenderBlock)errorCallback
|
- (void)getAdvertisingId:(RCTResponseSenderBlock)callback withErrorCallback:(RCTResponseSenderBlock)errorCallback
|
||||||
{
|
{
|
||||||
RCT_EXPORT();
|
RCT_EXPORT();
|
||||||
|
@ -25,6 +25,8 @@
|
|||||||
RCTSparseArray *_animationRegistry; // Main thread only; animation tag -> view tag
|
RCTSparseArray *_animationRegistry; // Main thread only; animation tag -> view tag
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RCT_EXPORT_MODULE()
|
||||||
|
|
||||||
@synthesize bridge = _bridge;
|
@synthesize bridge = _bridge;
|
||||||
|
|
||||||
- (instancetype)init
|
- (instancetype)init
|
||||||
|
@ -99,6 +99,8 @@ static NSDictionary *RCTPositionError(RCTPositionErrorCode code, NSString *msg /
|
|||||||
RCTLocationOptions _observerOptions;
|
RCTLocationOptions _observerOptions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RCT_EXPORT_MODULE()
|
||||||
|
|
||||||
@synthesize bridge = _bridge;
|
@synthesize bridge = _bridge;
|
||||||
|
|
||||||
#pragma mark - Lifecycle
|
#pragma mark - Lifecycle
|
||||||
|
@ -19,6 +19,8 @@
|
|||||||
|
|
||||||
@implementation RCTCameraRollManager
|
@implementation RCTCameraRollManager
|
||||||
|
|
||||||
|
RCT_EXPORT_MODULE()
|
||||||
|
|
||||||
- (void)saveImageWithTag:(NSString *)imageTag successCallback:(RCTResponseSenderBlock)successCallback errorCallback:(RCTResponseSenderBlock)errorCallback
|
- (void)saveImageWithTag:(NSString *)imageTag successCallback:(RCTResponseSenderBlock)successCallback errorCallback:(RCTResponseSenderBlock)errorCallback
|
||||||
{
|
{
|
||||||
RCT_EXPORT();
|
RCT_EXPORT();
|
||||||
|
@ -18,6 +18,8 @@
|
|||||||
|
|
||||||
@implementation RCTNetworkImageViewManager
|
@implementation RCTNetworkImageViewManager
|
||||||
|
|
||||||
|
RCT_EXPORT_MODULE()
|
||||||
|
|
||||||
- (UIView *)view
|
- (UIView *)view
|
||||||
{
|
{
|
||||||
RCTNetworkImageView *view = [[RCTNetworkImageView alloc] initWithFrame:CGRectZero imageDownloader:[RCTImageDownloader sharedInstance]];
|
RCTNetworkImageView *view = [[RCTNetworkImageView alloc] initWithFrame:CGRectZero imageDownloader:[RCTImageDownloader sharedInstance]];
|
||||||
|
@ -18,6 +18,8 @@
|
|||||||
|
|
||||||
@implementation RCTStaticImageManager
|
@implementation RCTStaticImageManager
|
||||||
|
|
||||||
|
RCT_EXPORT_MODULE()
|
||||||
|
|
||||||
- (UIView *)view
|
- (UIView *)view
|
||||||
{
|
{
|
||||||
return [[RCTStaticImage alloc] init];
|
return [[RCTStaticImage alloc] init];
|
||||||
|
@ -16,6 +16,8 @@ NSString *const RCTOpenURLNotification = @"RCTOpenURLNotification";
|
|||||||
|
|
||||||
@implementation RCTLinkingManager
|
@implementation RCTLinkingManager
|
||||||
|
|
||||||
|
RCT_EXPORT_MODULE()
|
||||||
|
|
||||||
@synthesize bridge = _bridge;
|
@synthesize bridge = _bridge;
|
||||||
|
|
||||||
- (instancetype)init
|
- (instancetype)init
|
||||||
|
@ -15,6 +15,8 @@
|
|||||||
|
|
||||||
@implementation RCTDataManager
|
@implementation RCTDataManager
|
||||||
|
|
||||||
|
RCT_EXPORT_MODULE()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Executes a network request.
|
* Executes a network request.
|
||||||
* The responseSender block won't be called on same thread as called.
|
* The responseSender block won't be called on same thread as called.
|
||||||
|
@ -23,6 +23,8 @@ static NSString *const RCTReachabilityStateCell = @"cell";
|
|||||||
NSString *_status;
|
NSString *_status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RCT_EXPORT_MODULE()
|
||||||
|
|
||||||
@synthesize bridge = _bridge;
|
@synthesize bridge = _bridge;
|
||||||
|
|
||||||
static void RCTReachabilityCallback(__unused SCNetworkReachabilityRef target, SCNetworkReachabilityFlags flags, void *info)
|
static void RCTReachabilityCallback(__unused SCNetworkReachabilityRef target, SCNetworkReachabilityFlags flags, void *info)
|
||||||
|
@ -19,6 +19,8 @@ NSString *const RCTRemoteNotificationReceived = @"RemoteNotificationReceived";
|
|||||||
NSDictionary *_initialNotification;
|
NSDictionary *_initialNotification;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RCT_EXPORT_MODULE()
|
||||||
|
|
||||||
@synthesize bridge = _bridge;
|
@synthesize bridge = _bridge;
|
||||||
|
|
||||||
- (instancetype)init
|
- (instancetype)init
|
||||||
|
@ -13,12 +13,15 @@
|
|||||||
#import "RCTAssert.h"
|
#import "RCTAssert.h"
|
||||||
#import "RCTLog.h"
|
#import "RCTLog.h"
|
||||||
|
|
||||||
@implementation RCTTestModule {
|
@implementation RCTTestModule
|
||||||
|
{
|
||||||
__weak FBSnapshotTestController *_snapshotController;
|
__weak FBSnapshotTestController *_snapshotController;
|
||||||
__weak UIView *_view;
|
__weak UIView *_view;
|
||||||
NSMutableDictionary *_snapshotCounter;
|
NSMutableDictionary *_snapshotCounter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RCT_EXPORT_MODULE()
|
||||||
|
|
||||||
- (instancetype)initWithSnapshotController:(FBSnapshotTestController *)controller view:(UIView *)view
|
- (instancetype)initWithSnapshotController:(FBSnapshotTestController *)controller view:(UIView *)view
|
||||||
{
|
{
|
||||||
if ((self = [super init])) {
|
if ((self = [super init])) {
|
||||||
|
@ -19,9 +19,12 @@
|
|||||||
|
|
||||||
#import <Availability.h>
|
#import <Availability.h>
|
||||||
|
|
||||||
#if TARGET_OS_IPHONE
|
//NOTE: libicucore ins't actually needed for the socket to function
|
||||||
#define HAS_ICU
|
//and by commenting this out, we avoid the need to import it into every app.
|
||||||
#endif
|
|
||||||
|
//#if TARGET_OS_IPHONE
|
||||||
|
//#define HAS_ICU
|
||||||
|
//#endif
|
||||||
|
|
||||||
#ifdef HAS_ICU
|
#ifdef HAS_ICU
|
||||||
#import <unicode/utf8.h>
|
#import <unicode/utf8.h>
|
||||||
|
@ -13,6 +13,8 @@
|
|||||||
|
|
||||||
@implementation RCTRawTextManager
|
@implementation RCTRawTextManager
|
||||||
|
|
||||||
|
RCT_EXPORT_MODULE()
|
||||||
|
|
||||||
- (UIView *)view
|
- (UIView *)view
|
||||||
{
|
{
|
||||||
return nil;
|
return nil;
|
||||||
|
@ -20,6 +20,8 @@
|
|||||||
|
|
||||||
@implementation RCTTextManager
|
@implementation RCTTextManager
|
||||||
|
|
||||||
|
RCT_EXPORT_MODULE()
|
||||||
|
|
||||||
- (UIView *)view
|
- (UIView *)view
|
||||||
{
|
{
|
||||||
return [[RCTText alloc] init];
|
return [[RCTText alloc] init];
|
||||||
|
@ -13,6 +13,8 @@
|
|||||||
|
|
||||||
@implementation RCTVibration
|
@implementation RCTVibration
|
||||||
|
|
||||||
|
RCT_EXPORT_MODULE()
|
||||||
|
|
||||||
- (void)vibrate
|
- (void)vibrate
|
||||||
{
|
{
|
||||||
RCT_EXPORT();
|
RCT_EXPORT();
|
||||||
|
@ -26,8 +26,6 @@
|
|||||||
*/
|
*/
|
||||||
typedef NSArray *(^RCTBridgeModuleProviderBlock)(void);
|
typedef NSArray *(^RCTBridgeModuleProviderBlock)(void);
|
||||||
|
|
||||||
extern NSString *const RCTReloadBridge;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function returns the module name for a given class.
|
* This function returns the module name for a given class.
|
||||||
*/
|
*/
|
||||||
@ -38,8 +36,6 @@ extern NSString *RCTBridgeModuleNameForClass(Class bridgeModuleClass);
|
|||||||
*/
|
*/
|
||||||
@interface RCTBridge : NSObject <RCTInvalidating>
|
@interface RCTBridge : NSObject <RCTInvalidating>
|
||||||
|
|
||||||
@property (nonatomic, assign, readonly, getter=isLoaded) BOOL loaded;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The designated initializer. This creates a new bridge on top of the specified
|
* The designated initializer. This creates a new bridge on top of the specified
|
||||||
* executor. The bridge should then be used for all subsequent communication
|
* executor. The bridge should then be used for all subsequent communication
|
||||||
@ -55,16 +51,31 @@ extern NSString *RCTBridgeModuleNameForClass(Class bridgeModuleClass);
|
|||||||
/**
|
/**
|
||||||
* This method is used to call functions in the JavaScript application context.
|
* This method is used to call functions in the JavaScript application context.
|
||||||
* It is primarily intended for use by modules that require two-way communication
|
* It is primarily intended for use by modules that require two-way communication
|
||||||
* with the JavaScript code.
|
* with the JavaScript code. Method should be regsitered using the
|
||||||
|
* RCT_IMPORT_METHOD macro below. Attempting to call a method that has not been
|
||||||
|
* registered will result in an error.
|
||||||
*/
|
*/
|
||||||
- (void)enqueueJSCall:(NSString *)moduleDotMethod args:(NSArray *)args;
|
- (void)enqueueJSCall:(NSString *)moduleDotMethod args:(NSArray *)args;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This macro is used to register a JS method to be called via the enqueueJSCall
|
||||||
|
* bridge method. You should place this macro inside any file that uses the
|
||||||
|
* imported method. If a method has already been registered by another class, it
|
||||||
|
* is not necessary to register it again, but it is good practice. Registering
|
||||||
|
* the same method more than once will not result in an error.
|
||||||
|
*/
|
||||||
|
#define RCT_IMPORT_METHOD(module, method) \
|
||||||
|
__attribute__((used, section("__DATA,RCTImport"))) \
|
||||||
|
static const char *__rct_import_##module##_##method##__ = #module"."#method;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method is used to execute a new application script. It is called
|
* This method is used to execute a new application script. It is called
|
||||||
* internally whenever a JS application bundle is loaded/reloaded, but should
|
* internally whenever a JS application bundle is loaded/reloaded, but should
|
||||||
* probably not be used at any other time.
|
* probably not be used at any other time.
|
||||||
*/
|
*/
|
||||||
- (void)enqueueApplicationScript:(NSString *)script url:(NSURL *)url onComplete:(RCTJavaScriptCompleteBlock)onComplete;
|
- (void)enqueueApplicationScript:(NSString *)script
|
||||||
|
url:(NSURL *)url
|
||||||
|
onComplete:(RCTJavaScriptCompleteBlock)onComplete;
|
||||||
|
|
||||||
@property (nonatomic, strong) Class executorClass;
|
@property (nonatomic, strong) Class executorClass;
|
||||||
|
|
||||||
@ -86,14 +97,19 @@ extern NSString *RCTBridgeModuleNameForClass(Class bridgeModuleClass);
|
|||||||
*/
|
*/
|
||||||
@property (nonatomic, readonly) dispatch_queue_t shadowQueue;
|
@property (nonatomic, readonly) dispatch_queue_t shadowQueue;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The launch options that were used to initialize the bridge.
|
||||||
|
*/
|
||||||
@property (nonatomic, copy, readonly) NSDictionary *launchOptions;
|
@property (nonatomic, copy, readonly) NSDictionary *launchOptions;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use this to check if the bridge is currently loading.
|
||||||
|
*/
|
||||||
|
@property (nonatomic, readonly, getter=isLoaded) BOOL loaded;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method to check that a valid executor exists with which to log
|
* Reload the bundle and reset executor and modules.
|
||||||
*/
|
*/
|
||||||
+ (BOOL)hasValidJSExecutor;
|
|
||||||
|
|
||||||
- (void)reload;
|
- (void)reload;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
@ -39,11 +39,32 @@ typedef NS_ENUM(NSUInteger, RCTBridgeFields) {
|
|||||||
RCTBridgeFieldFlushDateMillis
|
RCTBridgeFieldFlushDateMillis
|
||||||
};
|
};
|
||||||
|
|
||||||
NSString *const RCTReloadBridge = @"RCTReloadBridge";
|
#ifdef __LP64__
|
||||||
|
typedef uint64_t RCTHeaderValue;
|
||||||
|
typedef struct section_64 RCTHeaderSection;
|
||||||
|
#define RCTGetSectByNameFromHeader getsectbynamefromheader_64
|
||||||
|
#else
|
||||||
|
typedef uint32_t RCTHeaderValue;
|
||||||
|
typedef struct section RCTHeaderSection;
|
||||||
|
#define RCTGetSectByNameFromHeader getsectbynamefromheader
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function returns the module name for a given class.
|
||||||
|
*/
|
||||||
NSString *RCTBridgeModuleNameForClass(Class cls)
|
NSString *RCTBridgeModuleNameForClass(Class cls)
|
||||||
{
|
{
|
||||||
return [cls respondsToSelector:@selector(moduleName)] ? [cls moduleName] : NSStringFromClass(cls);
|
NSString *name = nil;
|
||||||
|
if ([cls respondsToSelector:@selector(moduleName)]) {
|
||||||
|
name = [cls valueForKey:@"moduleName"];
|
||||||
|
}
|
||||||
|
if ([name length] == 0) {
|
||||||
|
name = NSStringFromClass(cls);
|
||||||
|
}
|
||||||
|
if ([name hasPrefix:@"RK"]) {
|
||||||
|
name = [name stringByReplacingCharactersInRange:(NSRange){0,@"RK".length} withString:@"RCT"];
|
||||||
|
}
|
||||||
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -57,11 +78,22 @@ static NSArray *RCTJSMethods(void)
|
|||||||
dispatch_once(&onceToken, ^{
|
dispatch_once(&onceToken, ^{
|
||||||
NSMutableSet *uniqueMethods = [NSMutableSet set];
|
NSMutableSet *uniqueMethods = [NSMutableSet set];
|
||||||
|
|
||||||
RCTEnumerateClasses(^(__unsafe_unretained Class cls) {
|
Dl_info info;
|
||||||
if (RCTClassOverridesClassMethod(cls, @selector(JSMethods))) {
|
dladdr(&RCTJSMethods, &info);
|
||||||
[uniqueMethods addObjectsFromArray:[cls JSMethods]];
|
|
||||||
|
const RCTHeaderValue mach_header = (RCTHeaderValue)info.dli_fbase;
|
||||||
|
const RCTHeaderSection *section = RCTGetSectByNameFromHeader((void *)mach_header, "__DATA", "RCTImport");
|
||||||
|
|
||||||
|
if (section) {
|
||||||
|
for (RCTHeaderValue addr = section->offset;
|
||||||
|
addr < section->offset + section->size;
|
||||||
|
addr += sizeof(const char **)) {
|
||||||
|
|
||||||
|
// Get data entry
|
||||||
|
NSString *entry = @(*(const char **)(mach_header + addr));
|
||||||
|
[uniqueMethods addObject:entry];
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
|
||||||
JSMethods = [uniqueMethods allObjects];
|
JSMethods = [uniqueMethods allObjects];
|
||||||
});
|
});
|
||||||
@ -70,35 +102,85 @@ static NSArray *RCTJSMethods(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function scans all classes available at runtime and returns an array
|
* This function scans all exported modules available at runtime and returns an
|
||||||
* of all classes that implement the RTCBridgeModule protocol.
|
* array. As a backup, it also scans all classes that implement the
|
||||||
|
* RTCBridgeModule protocol to ensure they've been exported. This scanning
|
||||||
|
* functionality is disabled in release mode to improve startup performance.
|
||||||
*/
|
*/
|
||||||
static NSArray *RCTModuleNamesByID;
|
static NSArray *RCTModuleNamesByID;
|
||||||
|
static NSArray *RCTModuleClassesByID;
|
||||||
static NSArray *RCTBridgeModuleClassesByModuleID(void)
|
static NSArray *RCTBridgeModuleClassesByModuleID(void)
|
||||||
{
|
{
|
||||||
static NSArray *modules;
|
|
||||||
static dispatch_once_t onceToken;
|
static dispatch_once_t onceToken;
|
||||||
dispatch_once(&onceToken, ^{
|
dispatch_once(&onceToken, ^{
|
||||||
modules = [NSMutableArray array];
|
|
||||||
RCTModuleNamesByID = [NSMutableArray array];
|
RCTModuleNamesByID = [NSMutableArray array];
|
||||||
|
RCTModuleClassesByID = [NSMutableArray array];
|
||||||
|
|
||||||
RCTEnumerateClasses(^(__unsafe_unretained Class cls) {
|
Dl_info info;
|
||||||
if ([cls conformsToProtocol:@protocol(RCTBridgeModule)]) {
|
dladdr(&RCTBridgeModuleClassesByModuleID, &info);
|
||||||
|
|
||||||
// Add module
|
const RCTHeaderValue mach_header = (RCTHeaderValue)info.dli_fbase;
|
||||||
[(NSMutableArray *)modules addObject:cls];
|
const RCTHeaderSection *section = RCTGetSectByNameFromHeader((void *)mach_header, "__DATA", "RCTExportModule");
|
||||||
|
|
||||||
// Add module name
|
if (section) {
|
||||||
NSString *moduleName = RCTBridgeModuleNameForClass(cls);
|
for (RCTHeaderValue addr = section->offset;
|
||||||
[(NSMutableArray *)RCTModuleNamesByID addObject:moduleName];
|
addr < section->offset + section->size;
|
||||||
|
addr += sizeof(const char **)) {
|
||||||
|
|
||||||
|
// Get data entry
|
||||||
|
NSString *entry = @(*(const char **)(mach_header + addr));
|
||||||
|
NSArray *parts = [[entry substringWithRange:(NSRange){2, entry.length - 3}] componentsSeparatedByString:@" "];
|
||||||
|
|
||||||
|
// Parse class name
|
||||||
|
NSString *moduleClassName = parts[0];
|
||||||
|
NSRange categoryRange = [moduleClassName rangeOfString:@"("];
|
||||||
|
if (categoryRange.length) {
|
||||||
|
moduleClassName = [moduleClassName substringToIndex:categoryRange.location];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get class
|
||||||
|
Class cls = NSClassFromString(moduleClassName);
|
||||||
|
RCTCAssert([cls conformsToProtocol:@protocol(RCTBridgeModule)],
|
||||||
|
@"%@ does not conform to the RCTBridgeModule protocol",
|
||||||
|
NSStringFromClass(cls));
|
||||||
|
|
||||||
|
// Register module
|
||||||
|
[(NSMutableArray *)RCTModuleNamesByID addObject:RCTBridgeModuleNameForClass(cls)];
|
||||||
|
[(NSMutableArray *)RCTModuleClassesByID addObject:cls];
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
|
||||||
|
#if DEBUG
|
||||||
|
|
||||||
|
// We may be able to get rid of this check in future, once people
|
||||||
|
// get used to the new registration system. That would potentially
|
||||||
|
// allow you to create modules that are not automatically registered
|
||||||
|
|
||||||
|
static unsigned int classCount;
|
||||||
|
Class *classes = objc_copyClassList(&classCount);
|
||||||
|
for (unsigned int i = 0; i < classCount; i++)
|
||||||
|
{
|
||||||
|
Class cls = classes[i];
|
||||||
|
Class superclass = cls;
|
||||||
|
while (superclass)
|
||||||
|
{
|
||||||
|
if (class_conformsToProtocol(superclass, @protocol(RCTBridgeModule)))
|
||||||
|
{
|
||||||
|
if (![RCTModuleClassesByID containsObject:cls]) {
|
||||||
|
RCTLogError(@"Class %@ was not exported. Did you forget to use RCT_EXPORT_MODULE()?", NSStringFromClass(cls));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
superclass = class_getSuperclass(superclass);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
modules = [modules copy];
|
|
||||||
RCTModuleNamesByID = [RCTModuleNamesByID copy];
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return modules;
|
return RCTModuleClassesByID;
|
||||||
}
|
}
|
||||||
|
|
||||||
@interface RCTBridge ()
|
@interface RCTBridge ()
|
||||||
@ -137,13 +219,12 @@ static Class _globalExecutorClass;
|
|||||||
if ((self = [super init])) {
|
if ((self = [super init])) {
|
||||||
|
|
||||||
_methodName = methodName;
|
_methodName = methodName;
|
||||||
NSArray *parts = [[methodName substringWithRange:NSMakeRange(2, methodName.length - 3)] componentsSeparatedByString:@" "];
|
NSArray *parts = [[methodName substringWithRange:(NSRange){2, methodName.length - 3}] componentsSeparatedByString:@" "];
|
||||||
|
|
||||||
// Parse class and method
|
// Parse class and method
|
||||||
_moduleClassName = parts[0];
|
_moduleClassName = parts[0];
|
||||||
NSRange categoryRange = [_moduleClassName rangeOfString:@"("];
|
NSRange categoryRange = [_moduleClassName rangeOfString:@"("];
|
||||||
if (categoryRange.length)
|
if (categoryRange.length) {
|
||||||
{
|
|
||||||
_moduleClassName = [_moduleClassName substringToIndex:categoryRange.location];
|
_moduleClassName = [_moduleClassName substringToIndex:categoryRange.location];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -308,18 +389,8 @@ static RCTSparseArray *RCTExportedMethodsByModuleID(void)
|
|||||||
Dl_info info;
|
Dl_info info;
|
||||||
dladdr(&RCTExportedMethodsByModuleID, &info);
|
dladdr(&RCTExportedMethodsByModuleID, &info);
|
||||||
|
|
||||||
#ifdef __LP64__
|
const RCTHeaderValue mach_header = (RCTHeaderValue)info.dli_fbase;
|
||||||
typedef uint64_t RCTExportValue;
|
const RCTHeaderSection *section = RCTGetSectByNameFromHeader((void *)mach_header, "__DATA", "RCTExport");
|
||||||
typedef struct section_64 RCTExportSection;
|
|
||||||
#define RCTGetSectByNameFromHeader getsectbynamefromheader_64
|
|
||||||
#else
|
|
||||||
typedef uint32_t RCTExportValue;
|
|
||||||
typedef struct section RCTExportSection;
|
|
||||||
#define RCTGetSectByNameFromHeader getsectbynamefromheader
|
|
||||||
#endif
|
|
||||||
|
|
||||||
const RCTExportValue mach_header = (RCTExportValue)info.dli_fbase;
|
|
||||||
const RCTExportSection *section = RCTGetSectByNameFromHeader((void *)mach_header, "__DATA", "RCTExport");
|
|
||||||
|
|
||||||
if (section == NULL) {
|
if (section == NULL) {
|
||||||
return;
|
return;
|
||||||
@ -328,7 +399,7 @@ static RCTSparseArray *RCTExportedMethodsByModuleID(void)
|
|||||||
NSArray *classes = RCTBridgeModuleClassesByModuleID();
|
NSArray *classes = RCTBridgeModuleClassesByModuleID();
|
||||||
NSMutableDictionary *methodsByModuleClassName = [NSMutableDictionary dictionaryWithCapacity:[classes count]];
|
NSMutableDictionary *methodsByModuleClassName = [NSMutableDictionary dictionaryWithCapacity:[classes count]];
|
||||||
|
|
||||||
for (RCTExportValue addr = section->offset;
|
for (RCTHeaderValue addr = section->offset;
|
||||||
addr < section->offset + section->size;
|
addr < section->offset + section->size;
|
||||||
addr += sizeof(const char **) * 2) {
|
addr += sizeof(const char **) * 2) {
|
||||||
|
|
||||||
@ -593,31 +664,34 @@ static id<RCTJavaScriptExecutor> _latestJSExecutor;
|
|||||||
_loaded = YES;
|
_loaded = YES;
|
||||||
} else if (_bundlePath != nil) { // Allow testing without a script
|
} else if (_bundlePath != nil) { // Allow testing without a script
|
||||||
RCTJavaScriptLoader *loader = [[RCTJavaScriptLoader alloc] initWithBridge:self];
|
RCTJavaScriptLoader *loader = [[RCTJavaScriptLoader alloc] initWithBridge:self];
|
||||||
[loader loadBundleAtURL:[NSURL URLWithString:_bundlePath]
|
[loader loadBundleAtURL:[NSURL URLWithString:_bundlePath] onComplete:^(NSError *error) {
|
||||||
onComplete:^(NSError *error) {
|
_loaded = YES;
|
||||||
_loaded = YES;
|
if (error != nil) {
|
||||||
if (error != nil) {
|
NSArray *stack = [[error userInfo] objectForKey:@"stack"];
|
||||||
NSArray *stack = [[error userInfo] objectForKey:@"stack"];
|
if (stack) {
|
||||||
if (stack) {
|
[[RCTRedBox sharedInstance] showErrorMessage:[error localizedDescription]
|
||||||
[[RCTRedBox sharedInstance] showErrorMessage:[error localizedDescription] withStack:stack];
|
withStack:stack];
|
||||||
} else {
|
} else {
|
||||||
[[RCTRedBox sharedInstance] showErrorMessage:[error localizedDescription] withDetails:[error localizedFailureReason]];
|
[[RCTRedBox sharedInstance] showErrorMessage:[error localizedDescription]
|
||||||
}
|
withDetails:[error localizedFailureReason]];
|
||||||
} else {
|
}
|
||||||
[[NSNotificationCenter defaultCenter] postNotificationName:RCTJavaScriptDidLoadNotification
|
} else {
|
||||||
object:self];
|
[[NSNotificationCenter defaultCenter] postNotificationName:RCTJavaScriptDidLoadNotification
|
||||||
}
|
object:self];
|
||||||
[[NSNotificationCenter defaultCenter] addObserver:self
|
}
|
||||||
selector:@selector(reload)
|
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||||
name:RCTReloadNotification
|
selector:@selector(reload)
|
||||||
object:nil];
|
name:RCTReloadNotification
|
||||||
}];
|
object:nil];
|
||||||
|
}];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)bindKeys
|
- (void)bindKeys
|
||||||
{
|
{
|
||||||
#if TARGET_IPHONE_SIMULATOR
|
#if TARGET_IPHONE_SIMULATOR
|
||||||
|
__weak RCTBridge *weakSelf = self;
|
||||||
|
|
||||||
// Workaround around the first cmd+r not working: http://openradar.appspot.com/19613391
|
// Workaround around the first cmd+r not working: http://openradar.appspot.com/19613391
|
||||||
// You can register just the cmd key and do nothing. This will trigger the bug and cmd+r
|
// You can register just the cmd key and do nothing. This will trigger the bug and cmd+r
|
||||||
// will work like a charm!
|
// will work like a charm!
|
||||||
@ -626,31 +700,38 @@ static id<RCTJavaScriptExecutor> _latestJSExecutor;
|
|||||||
action:^(UIKeyCommand *command) {
|
action:^(UIKeyCommand *command) {
|
||||||
// Do nothing
|
// Do nothing
|
||||||
}];
|
}];
|
||||||
|
|
||||||
[[RCTKeyCommands sharedInstance] registerKeyCommandWithInput:@"r"
|
[[RCTKeyCommands sharedInstance] registerKeyCommandWithInput:@"r"
|
||||||
modifierFlags:UIKeyModifierCommand
|
modifierFlags:UIKeyModifierCommand
|
||||||
action:^(UIKeyCommand *command) {
|
action:^(UIKeyCommand *command) {
|
||||||
[self reload];
|
[weakSelf reload];
|
||||||
}];
|
}];
|
||||||
[[RCTKeyCommands sharedInstance] registerKeyCommandWithInput:@"n"
|
[[RCTKeyCommands sharedInstance] registerKeyCommandWithInput:@"n"
|
||||||
modifierFlags:UIKeyModifierCommand
|
modifierFlags:UIKeyModifierCommand
|
||||||
action:^(UIKeyCommand *command) {
|
action:^(UIKeyCommand *command) {
|
||||||
_executorClass = Nil;
|
RCTBridge *strongSelf = weakSelf;
|
||||||
[self reload];
|
if (!strongSelf) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
strongSelf->_executorClass = Nil;
|
||||||
|
[strongSelf reload];
|
||||||
}];
|
}];
|
||||||
|
|
||||||
[[RCTKeyCommands sharedInstance] registerKeyCommandWithInput:@"d"
|
[[RCTKeyCommands sharedInstance] registerKeyCommandWithInput:@"d"
|
||||||
modifierFlags:UIKeyModifierCommand
|
modifierFlags:UIKeyModifierCommand
|
||||||
action:^(UIKeyCommand *command) {
|
action:^(UIKeyCommand *command) {
|
||||||
_executorClass = NSClassFromString(@"RCTWebSocketExecutor");
|
RCTBridge *strongSelf = weakSelf;
|
||||||
if (!_executorClass) {
|
if (!strongSelf) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
strongSelf->_executorClass = NSClassFromString(@"RCTWebSocketExecutor");
|
||||||
|
if (!strongSelf->_executorClass) {
|
||||||
RCTLogError(@"WebSocket debugger is not available. Did you forget to include RCTWebSocketExecutor?");
|
RCTLogError(@"WebSocket debugger is not available. Did you forget to include RCTWebSocketExecutor?");
|
||||||
}
|
}
|
||||||
[self reload];
|
[strongSelf reload];
|
||||||
}];
|
}];
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
- (NSDictionary *)modules
|
- (NSDictionary *)modules
|
||||||
{
|
{
|
||||||
RCTAssert(_modulesByName != nil, @"Bridge modules have not yet been initialized. \
|
RCTAssert(_modulesByName != nil, @"Bridge modules have not yet been initialized. \
|
||||||
@ -882,15 +963,9 @@ static id<RCTJavaScriptExecutor> _latestJSExecutor;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (BOOL)hasValidJSExecutor
|
|
||||||
{
|
|
||||||
return (_latestJSExecutor != nil && [_latestJSExecutor isValid]);
|
|
||||||
}
|
|
||||||
|
|
||||||
+ (void)logMessage:(NSString *)message level:(NSString *)level
|
+ (void)logMessage:(NSString *)message level:(NSString *)level
|
||||||
{
|
{
|
||||||
if (!_latestJSExecutor || ![_latestJSExecutor isValid]) {
|
if (!_latestJSExecutor || ![_latestJSExecutor isValid]) {
|
||||||
RCTLogError(@"ERROR: No valid JS executor to log '%@'.", message);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,8 +9,6 @@
|
|||||||
|
|
||||||
#import <Foundation/Foundation.h>
|
#import <Foundation/Foundation.h>
|
||||||
|
|
||||||
#import "RCTJSMethodRegistrar.h"
|
|
||||||
|
|
||||||
@class RCTBridge;
|
@class RCTBridge;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -22,7 +20,7 @@ typedef void (^RCTResponseSenderBlock)(NSArray *response);
|
|||||||
/**
|
/**
|
||||||
* Provides the interface needed to register a bridge module.
|
* Provides the interface needed to register a bridge module.
|
||||||
*/
|
*/
|
||||||
@protocol RCTBridgeModule <RCTJSMethodRegistrar>
|
@protocol RCTBridgeModule <NSObject>
|
||||||
@optional
|
@optional
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -34,10 +32,14 @@ typedef void (^RCTResponseSenderBlock)(NSArray *response);
|
|||||||
@property (nonatomic, strong) RCTBridge *bridge;
|
@property (nonatomic, strong) RCTBridge *bridge;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The module name exposed to JS. If omitted, this will be inferred
|
* Place this macro in your class implementation, to automatically register
|
||||||
* automatically by using the native module's class name.
|
* your module with the bridge when it loads. The optional js_name argument
|
||||||
|
* will be used as the JS module name. If omitted, the JS module name will
|
||||||
|
* match the Objective-C class name.
|
||||||
*/
|
*/
|
||||||
+ (NSString *)moduleName;
|
#define RCT_EXPORT_MODULE(js_name) \
|
||||||
|
+ (NSString *)moduleName { __attribute__((used, section("__DATA,RCTExportModule" \
|
||||||
|
))) static const char *__rct_export_entry__ = { __func__ }; return @#js_name; } \
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Place this macro inside the method body of any method you want to expose
|
* Place this macro inside the method body of any method you want to expose
|
||||||
|
@ -67,7 +67,7 @@
|
|||||||
- (void)_pollAndReload
|
- (void)_pollAndReload
|
||||||
{
|
{
|
||||||
if (_liveReload) {
|
if (_liveReload) {
|
||||||
RCTSourceCode *sourceCodeModule = self.bridge.modules[NSStringFromClass([RCTSourceCode class])];
|
RCTSourceCode *sourceCodeModule = self.bridge.modules[RCTBridgeModuleNameForClass([RCTSourceCode class])];
|
||||||
NSURL *url = sourceCodeModule.scriptURL;
|
NSURL *url = sourceCodeModule.scriptURL;
|
||||||
NSURL *longPollURL = [[NSURL alloc] initWithString:@"/onchange" relativeToURL:url];
|
NSURL *longPollURL = [[NSURL alloc] initWithString:@"/onchange" relativeToURL:url];
|
||||||
[self performSelectorInBackground:@selector(_checkForUpdates:) withObject:longPollURL];
|
[self performSelectorInBackground:@selector(_checkForUpdates:) withObject:longPollURL];
|
||||||
|
@ -25,14 +25,9 @@
|
|||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (NSArray *)JSMethods
|
RCT_IMPORT_METHOD(RCTNativeAppEventEmitter, emit);
|
||||||
{
|
RCT_IMPORT_METHOD(RCTDeviceEventEmitter, emit);
|
||||||
return @[
|
RCT_IMPORT_METHOD(RCTEventEmitter, receiveEvent);
|
||||||
@"RCTNativeAppEventEmitter.emit",
|
|
||||||
@"RCTDeviceEventEmitter.emit",
|
|
||||||
@"RCTEventEmitter.receiveEvent",
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)sendAppEventWithName:(NSString *)name body:(id)body
|
- (void)sendAppEventWithName:(NSString *)name body:(id)body
|
||||||
{
|
{
|
||||||
|
@ -1,31 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (c) 2015-present, Facebook, Inc.
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* This source code is licensed under the BSD-style license found in the
|
|
||||||
* LICENSE file in the root directory of this source tree. An additional grant
|
|
||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#import <Foundation/Foundation.h>
|
|
||||||
|
|
||||||
@class RCTBridge;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Provides an interface to register JS methods to be called via the bridge.
|
|
||||||
*/
|
|
||||||
@protocol RCTJSMethodRegistrar <NSObject>
|
|
||||||
@optional
|
|
||||||
|
|
||||||
/**
|
|
||||||
* An array of JavaScript methods that the class will call via the
|
|
||||||
* -[RCTBridge enqueueJSCall:args:] method. Each method should be specified
|
|
||||||
* as a string of the form "JSModuleName.jsMethodName". Attempting to call a
|
|
||||||
* method that has not been registered will result in an error. If a method
|
|
||||||
* has already been registered by another class, it is not necessary to
|
|
||||||
* register it again, but it is good practice. Registering the same method
|
|
||||||
* more than once is silently ignored and will not result in an error.
|
|
||||||
*/
|
|
||||||
+ (NSArray *)JSMethods;
|
|
||||||
|
|
||||||
@end
|
|
@ -128,7 +128,7 @@
|
|||||||
onComplete(error);
|
onComplete(error);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
RCTSourceCode *sourceCodeModule = _bridge.modules[NSStringFromClass([RCTSourceCode class])];
|
RCTSourceCode *sourceCodeModule = _bridge.modules[RCTBridgeModuleNameForClass([RCTSourceCode class])];
|
||||||
sourceCodeModule.scriptURL = scriptURL;
|
sourceCodeModule.scriptURL = scriptURL;
|
||||||
sourceCodeModule.scriptText = rawText;
|
sourceCodeModule.scriptText = rawText;
|
||||||
|
|
||||||
|
@ -42,8 +42,7 @@ typedef NS_ENUM(NSInteger, RCTLogLevel) {
|
|||||||
/**
|
/**
|
||||||
* A block signature to be used for custom logging functions. In most cases you
|
* A block signature to be used for custom logging functions. In most cases you
|
||||||
* will want to pass these arguments to the RCTFormatLog function in order to
|
* will want to pass these arguments to the RCTFormatLog function in order to
|
||||||
* generate a string, or use the RCTSimpleLogFunction() constructor to register
|
* generate a string.
|
||||||
* a simple function that does not use all of the arguments.
|
|
||||||
*/
|
*/
|
||||||
typedef void (^RCTLogFunction)(
|
typedef void (^RCTLogFunction)(
|
||||||
RCTLogLevel level,
|
RCTLogLevel level,
|
||||||
@ -65,13 +64,6 @@ NSString *RCTFormatLog(
|
|||||||
NSString *message
|
NSString *message
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
|
||||||
* A method to generate a log function from a block with a much simpler
|
|
||||||
* template. The message passed to the simpler block is equivalent to the
|
|
||||||
* output of the RCTFormatLog() function.
|
|
||||||
*/
|
|
||||||
RCTLogFunction RCTSimpleLogFunction(void (^logFunction)(RCTLogLevel level, NSString *message));
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The default logging function used by RCTLogXX.
|
* The default logging function used by RCTLogXX.
|
||||||
*/
|
*/
|
||||||
|
@ -116,12 +116,11 @@ NSString *RCTFormatLog(
|
|||||||
});
|
});
|
||||||
[log appendString:[formatter stringFromDate:timestamp]];
|
[log appendString:[formatter stringFromDate:timestamp]];
|
||||||
}
|
}
|
||||||
[log appendString:@"[react]"];
|
|
||||||
if (level) {
|
if (level) {
|
||||||
[log appendFormat:@"[%s]", RCTLogLevels[level - 1]];
|
[log appendFormat:@"[%s]", RCTLogLevels[level - 1]];
|
||||||
}
|
}
|
||||||
if (thread) {
|
if (thread) {
|
||||||
NSString *threadName = thread.name;
|
NSString *threadName = [thread isMainThread] ? @"main" : thread.name;
|
||||||
if (threadName.length == 0) {
|
if (threadName.length == 0) {
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
#pragma clang diagnostic push
|
#pragma clang diagnostic push
|
||||||
@ -149,19 +148,6 @@ NSString *RCTFormatLog(
|
|||||||
return log;
|
return log;
|
||||||
}
|
}
|
||||||
|
|
||||||
RCTLogFunction RCTSimpleLogFunction(void (^logFunction)(RCTLogLevel level, NSString *message))
|
|
||||||
{
|
|
||||||
return ^(RCTLogLevel level,
|
|
||||||
NSString *fileName,
|
|
||||||
NSNumber *lineNumber,
|
|
||||||
NSString *message) {
|
|
||||||
|
|
||||||
logFunction(level, RCTFormatLog(
|
|
||||||
[NSDate date], [NSThread currentThread], level, fileName, lineNumber, message
|
|
||||||
));
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
void _RCTLogFormat(RCTLogLevel level, const char *fileName, int lineNumber, NSString *format, ...)
|
void _RCTLogFormat(RCTLogLevel level, const char *fileName, int lineNumber, NSString *format, ...)
|
||||||
{
|
{
|
||||||
if (RCTCurrentLogFunction && level >= RCTCurrentLogThreshold) {
|
if (RCTCurrentLogFunction && level >= RCTCurrentLogThreshold) {
|
||||||
@ -193,9 +179,7 @@ void _RCTLogFormat(RCTLogLevel level, const char *fileName, int lineNumber, NSSt
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Log to JS executor
|
// Log to JS executor
|
||||||
if ([RCTBridge hasValidJSExecutor]) {
|
[RCTBridge logMessage:message level:level ? @(RCTLogLevels[level - 1]) : @"info"];
|
||||||
[RCTBridge logMessage:message level:level ? @(RCTLogLevels[level - 1]) : @"info"];
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -162,13 +162,8 @@ NSString *const RCTReloadViewsNotification = @"RCTReloadViewsNotification";
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (NSArray *)JSMethods
|
RCT_IMPORT_METHOD(AppRegistry, runApplication)
|
||||||
{
|
RCT_IMPORT_METHOD(ReactIOS, unmountComponentAtNodeAndRemoveContainer)
|
||||||
return @[
|
|
||||||
@"AppRegistry.runApplication",
|
|
||||||
@"ReactIOS.unmountComponentAtNodeAndRemoveContainer"
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)bundleFinishedLoading
|
- (void)bundleFinishedLoading
|
||||||
{
|
{
|
||||||
@ -176,9 +171,9 @@ NSString *const RCTReloadViewsNotification = @"RCTReloadViewsNotification";
|
|||||||
_registered = YES;
|
_registered = YES;
|
||||||
NSString *moduleName = _moduleName ?: @"";
|
NSString *moduleName = _moduleName ?: @"";
|
||||||
NSDictionary *appParameters = @{
|
NSDictionary *appParameters = @{
|
||||||
@"rootTag": _contentView.reactTag,
|
@"rootTag": _contentView.reactTag,
|
||||||
@"initialProps": self.initialProperties ?: @{},
|
@"initialProps": self.initialProperties ?: @{},
|
||||||
};
|
};
|
||||||
[_bridge.uiManager registerRootView:_contentView];
|
[_bridge.uiManager registerRootView:_contentView];
|
||||||
[_bridge enqueueJSCall:@"AppRegistry.runApplication"
|
[_bridge enqueueJSCall:@"AppRegistry.runApplication"
|
||||||
args:@[moduleName, appParameters]];
|
args:@[moduleName, appParameters]];
|
||||||
|
@ -200,10 +200,7 @@ typedef NS_ENUM(NSInteger, RCTTouchEventType) {
|
|||||||
reactTouch[@"timestamp"] = @(nativeTouch.timestamp * 1000); // in ms, for JS
|
reactTouch[@"timestamp"] = @(nativeTouch.timestamp * 1000); // in ms, for JS
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (NSArray *)JSMethods
|
RCT_IMPORT_METHOD(RCTEventEmitter, receiveTouches);
|
||||||
{
|
|
||||||
return @[@"RCTEventEmitter.receiveTouches"];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs information about touch events to send across the serialized
|
* Constructs information about touch events to send across the serialized
|
||||||
|
@ -45,9 +45,6 @@ void RCTSwapInstanceMethods(Class cls, SEL original, SEL replacement);
|
|||||||
BOOL RCTClassOverridesClassMethod(Class cls, SEL selector);
|
BOOL RCTClassOverridesClassMethod(Class cls, SEL selector);
|
||||||
BOOL RCTClassOverridesInstanceMethod(Class cls, SEL selector);
|
BOOL RCTClassOverridesInstanceMethod(Class cls, SEL selector);
|
||||||
|
|
||||||
// Enumerate all classes that conform to NSObject protocol
|
|
||||||
void RCTEnumerateClasses(void (^block)(Class cls));
|
|
||||||
|
|
||||||
// Creates a standardized error object
|
// Creates a standardized error object
|
||||||
// TODO(#6472857): create NSErrors and automatically convert them over the bridge.
|
// TODO(#6472857): create NSErrors and automatically convert them over the bridge.
|
||||||
NSDictionary *RCTMakeError(NSString *message, id toStringify, NSDictionary *extraData);
|
NSDictionary *RCTMakeError(NSString *message, id toStringify, NSDictionary *extraData);
|
||||||
|
@ -183,31 +183,6 @@ BOOL RCTClassOverridesInstanceMethod(Class cls, SEL selector)
|
|||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RCTEnumerateClasses(void (^block)(Class cls))
|
|
||||||
{
|
|
||||||
static Class *classes;
|
|
||||||
static unsigned int classCount;
|
|
||||||
static dispatch_once_t onceToken;
|
|
||||||
dispatch_once(&onceToken, ^{
|
|
||||||
classes = objc_copyClassList(&classCount);
|
|
||||||
});
|
|
||||||
|
|
||||||
for (unsigned int i = 0; i < classCount; i++)
|
|
||||||
{
|
|
||||||
Class cls = classes[i];
|
|
||||||
Class superclass = cls;
|
|
||||||
while (superclass)
|
|
||||||
{
|
|
||||||
if (class_conformsToProtocol(superclass, @protocol(NSObject)))
|
|
||||||
{
|
|
||||||
block(cls);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
superclass = class_getSuperclass(superclass);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
NSDictionary *RCTMakeError(NSString *message, id toStringify, NSDictionary *extraData)
|
NSDictionary *RCTMakeError(NSString *message, id toStringify, NSDictionary *extraData)
|
||||||
{
|
{
|
||||||
if (toStringify) {
|
if (toStringify) {
|
||||||
|
@ -23,6 +23,8 @@
|
|||||||
NSMutableArray *_alertButtonKeys;
|
NSMutableArray *_alertButtonKeys;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RCT_EXPORT_MODULE()
|
||||||
|
|
||||||
- (instancetype)init
|
- (instancetype)init
|
||||||
{
|
{
|
||||||
if ((self = [super init])) {
|
if ((self = [super init])) {
|
||||||
|
@ -33,6 +33,8 @@ static NSString *RCTCurrentAppBackgroundState()
|
|||||||
NSString *_lastKnownState;
|
NSString *_lastKnownState;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RCT_EXPORT_MODULE()
|
||||||
|
|
||||||
@synthesize bridge = _bridge;
|
@synthesize bridge = _bridge;
|
||||||
|
|
||||||
#pragma mark - Lifecycle
|
#pragma mark - Lifecycle
|
||||||
|
@ -88,6 +88,8 @@ static dispatch_queue_t RCTFileQueue(void)
|
|||||||
NSString *_storageDirectory;
|
NSString *_storageDirectory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RCT_EXPORT_MODULE()
|
||||||
|
|
||||||
- (NSString *)_filePathForKey:(NSString *)key
|
- (NSString *)_filePathForKey:(NSString *)key
|
||||||
{
|
{
|
||||||
NSString *safeFileName = RCTMD5Hash(key);
|
NSString *safeFileName = RCTMD5Hash(key);
|
||||||
|
@ -16,6 +16,8 @@
|
|||||||
__weak id<RCTExceptionsManagerDelegate> _delegate;
|
__weak id<RCTExceptionsManagerDelegate> _delegate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RCT_EXPORT_MODULE()
|
||||||
|
|
||||||
- (instancetype)initWithDelegate:(id<RCTExceptionsManagerDelegate>)delegate
|
- (instancetype)initWithDelegate:(id<RCTExceptionsManagerDelegate>)delegate
|
||||||
{
|
{
|
||||||
if ((self = [super init])) {
|
if ((self = [super init])) {
|
||||||
|
@ -14,6 +14,8 @@
|
|||||||
|
|
||||||
@implementation RCTSourceCode
|
@implementation RCTSourceCode
|
||||||
|
|
||||||
|
RCT_EXPORT_MODULE()
|
||||||
|
|
||||||
- (void)getScriptText:(RCTResponseSenderBlock)successCallback failureCallback:(RCTResponseSenderBlock)failureCallback
|
- (void)getScriptText:(RCTResponseSenderBlock)successCallback failureCallback:(RCTResponseSenderBlock)failureCallback
|
||||||
{
|
{
|
||||||
RCT_EXPORT();
|
RCT_EXPORT();
|
||||||
|
@ -24,6 +24,8 @@ static BOOL RCTViewControllerBasedStatusBarAppearance()
|
|||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RCT_EXPORT_MODULE()
|
||||||
|
|
||||||
- (void)setStyle:(UIStatusBarStyle)statusBarStyle animated:(BOOL)animated
|
- (void)setStyle:(UIStatusBarStyle)statusBarStyle animated:(BOOL)animated
|
||||||
{
|
{
|
||||||
RCT_EXPORT();
|
RCT_EXPORT();
|
||||||
|
@ -61,12 +61,11 @@
|
|||||||
id _updateTimer;
|
id _updateTimer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RCT_EXPORT_MODULE()
|
||||||
|
|
||||||
@synthesize bridge = _bridge;
|
@synthesize bridge = _bridge;
|
||||||
|
|
||||||
+ (NSArray *)JSMethods
|
RCT_IMPORT_METHOD(RCTJSTimers, callTimers)
|
||||||
{
|
|
||||||
return @[@"RCTJSTimers.callTimers"];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (instancetype)init
|
- (instancetype)init
|
||||||
{
|
{
|
||||||
|
@ -195,6 +195,8 @@ static UIViewAnimationCurve UIViewAnimationCurveFromRCTAnimationType(RCTAnimatio
|
|||||||
NSUInteger _rootTag;
|
NSUInteger _rootTag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RCT_EXPORT_MODULE()
|
||||||
|
|
||||||
@synthesize bridge = _bridge;
|
@synthesize bridge = _bridge;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -209,6 +211,7 @@ extern NSString *RCTBridgeModuleNameForClass(Class cls);
|
|||||||
static NSString *RCTViewNameForModuleName(NSString *moduleName)
|
static NSString *RCTViewNameForModuleName(NSString *moduleName)
|
||||||
{
|
{
|
||||||
NSString *name = moduleName;
|
NSString *name = moduleName;
|
||||||
|
RCTCAssert(name.length, @"Invalid moduleName '%@'", moduleName);
|
||||||
if ([name hasSuffix:@"Manager"]) {
|
if ([name hasSuffix:@"Manager"]) {
|
||||||
name = [name substringToIndex:name.length - @"Manager".length];
|
name = [name substringToIndex:name.length - @"Manager".length];
|
||||||
}
|
}
|
||||||
@ -797,7 +800,7 @@ static void RCTSetShadowViewProps(NSDictionary *props, RCTShadowView *shadowView
|
|||||||
RCT_EXPORT();
|
RCT_EXPORT();
|
||||||
|
|
||||||
RCTViewManager *viewManager = _viewManagerRegistry[reactTag];
|
RCTViewManager *viewManager = _viewManagerRegistry[reactTag];
|
||||||
NSString *viewName = RCTViewNameForModuleName([[viewManager class] moduleName]);
|
NSString *viewName = RCTViewNameForModuleName(RCTBridgeModuleNameForClass([viewManager class]));
|
||||||
|
|
||||||
RCTShadowView *shadowView = _shadowViewRegistry[reactTag];
|
RCTShadowView *shadowView = _shadowViewRegistry[reactTag];
|
||||||
RCTSetShadowViewProps(props, shadowView, _defaultShadowViews[viewName], viewManager);
|
RCTSetShadowViewProps(props, shadowView, _defaultShadowViews[viewName], viewManager);
|
||||||
@ -1417,7 +1420,8 @@ static void RCTMeasureLayout(RCTShadowView *view,
|
|||||||
if (config[@"delete"] != nil) {
|
if (config[@"delete"] != nil) {
|
||||||
RCTLogError(@"LayoutAnimation only supports create and update right now. Config: %@", config);
|
RCTLogError(@"LayoutAnimation only supports create and update right now. Config: %@", config);
|
||||||
}
|
}
|
||||||
_nextLayoutAnimation = [[RCTLayoutAnimation alloc] initWithDictionary:config callback:callback];
|
_nextLayoutAnimation = [[RCTLayoutAnimation alloc] initWithDictionary:config
|
||||||
|
callback:callback];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)startOrResetInteractionTiming
|
- (void)startOrResetInteractionTiming
|
||||||
@ -1449,7 +1453,7 @@ static void RCTMeasureLayout(RCTShadowView *view,
|
|||||||
timingData[reactTag.stringValue] = [rootView endAndResetInteractionTiming];
|
timingData[reactTag.stringValue] = [rootView endAndResetInteractionTiming];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
onSuccess(@[ timingData ]);
|
onSuccess(@[timingData]);
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1466,7 +1470,7 @@ static UIView *_jsResponder;
|
|||||||
|
|
||||||
- (RCTUIManager *)uiManager
|
- (RCTUIManager *)uiManager
|
||||||
{
|
{
|
||||||
return self.modules[NSStringFromClass([RCTUIManager class])];
|
return self.modules[RCTBridgeModuleNameForClass([RCTUIManager class])];
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
@ -146,7 +146,6 @@
|
|||||||
13E067501A70F44B002CDEE1 /* RCTView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTView.m; sourceTree = "<group>"; };
|
13E067501A70F44B002CDEE1 /* RCTView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTView.m; sourceTree = "<group>"; };
|
||||||
13E067531A70F44B002CDEE1 /* UIView+React.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIView+React.h"; sourceTree = "<group>"; };
|
13E067531A70F44B002CDEE1 /* UIView+React.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIView+React.h"; sourceTree = "<group>"; };
|
||||||
13E067541A70F44B002CDEE1 /* UIView+React.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIView+React.m"; sourceTree = "<group>"; };
|
13E067541A70F44B002CDEE1 /* UIView+React.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIView+React.m"; sourceTree = "<group>"; };
|
||||||
13EFFCCF1A98E6FE002607DC /* RCTJSMethodRegistrar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTJSMethodRegistrar.h; sourceTree = "<group>"; };
|
|
||||||
14200DA81AC179B3008EE6BA /* RCTJavaScriptLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTJavaScriptLoader.h; sourceTree = "<group>"; };
|
14200DA81AC179B3008EE6BA /* RCTJavaScriptLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTJavaScriptLoader.h; sourceTree = "<group>"; };
|
||||||
14200DA91AC179B3008EE6BA /* RCTJavaScriptLoader.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTJavaScriptLoader.m; sourceTree = "<group>"; };
|
14200DA91AC179B3008EE6BA /* RCTJavaScriptLoader.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTJavaScriptLoader.m; sourceTree = "<group>"; };
|
||||||
14435CE11AAC4AE100FC20F4 /* RCTMap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTMap.h; sourceTree = "<group>"; };
|
14435CE11AAC4AE100FC20F4 /* RCTMap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTMap.h; sourceTree = "<group>"; };
|
||||||
@ -366,7 +365,6 @@
|
|||||||
83CBBA661A601EF300E9B192 /* RCTEventDispatcher.m */,
|
83CBBA661A601EF300E9B192 /* RCTEventDispatcher.m */,
|
||||||
83CBBA4C1A601E3B00E9B192 /* RCTInvalidating.h */,
|
83CBBA4C1A601E3B00E9B192 /* RCTInvalidating.h */,
|
||||||
83CBBA631A601ECA00E9B192 /* RCTJavaScriptExecutor.h */,
|
83CBBA631A601ECA00E9B192 /* RCTJavaScriptExecutor.h */,
|
||||||
13EFFCCF1A98E6FE002607DC /* RCTJSMethodRegistrar.h */,
|
|
||||||
13A1F71C1A75392D00D3D453 /* RCTKeyCommands.h */,
|
13A1F71C1A75392D00D3D453 /* RCTKeyCommands.h */,
|
||||||
13A1F71D1A75392D00D3D453 /* RCTKeyCommands.m */,
|
13A1F71D1A75392D00D3D453 /* RCTKeyCommands.m */,
|
||||||
83CBBA4D1A601E3B00E9B192 /* RCTLog.h */,
|
83CBBA4D1A601E3B00E9B192 /* RCTLog.h */,
|
||||||
|
@ -27,6 +27,8 @@ RCT_ENUM_CONVERTER(UIDatePickerMode, (@{
|
|||||||
|
|
||||||
@implementation RCTDatePickerManager
|
@implementation RCTDatePickerManager
|
||||||
|
|
||||||
|
RCT_EXPORT_MODULE()
|
||||||
|
|
||||||
- (UIView *)view
|
- (UIView *)view
|
||||||
{
|
{
|
||||||
UIDatePicker *picker = [[UIDatePicker alloc] init];
|
UIDatePicker *picker = [[UIDatePicker alloc] init];
|
||||||
|
@ -54,6 +54,8 @@
|
|||||||
|
|
||||||
@implementation RCTMapManager
|
@implementation RCTMapManager
|
||||||
|
|
||||||
|
RCT_EXPORT_MODULE()
|
||||||
|
|
||||||
- (UIView *)view
|
- (UIView *)view
|
||||||
{
|
{
|
||||||
RCTMap *map = [[RCTMap alloc] init];
|
RCTMap *map = [[RCTMap alloc] init];
|
||||||
|
@ -14,6 +14,8 @@
|
|||||||
|
|
||||||
@implementation RCTNavItemManager
|
@implementation RCTNavItemManager
|
||||||
|
|
||||||
|
RCT_EXPORT_MODULE()
|
||||||
|
|
||||||
- (UIView *)view
|
- (UIView *)view
|
||||||
{
|
{
|
||||||
return [[RCTNavItem alloc] init];
|
return [[RCTNavItem alloc] init];
|
||||||
|
@ -17,6 +17,8 @@
|
|||||||
|
|
||||||
@implementation RCTNavigatorManager
|
@implementation RCTNavigatorManager
|
||||||
|
|
||||||
|
RCT_EXPORT_MODULE()
|
||||||
|
|
||||||
- (UIView *)view
|
- (UIView *)view
|
||||||
{
|
{
|
||||||
return [[RCTNavigator alloc] initWithEventDispatcher:self.bridge.eventDispatcher];
|
return [[RCTNavigator alloc] initWithEventDispatcher:self.bridge.eventDispatcher];
|
||||||
|
@ -15,6 +15,8 @@
|
|||||||
|
|
||||||
@implementation RCTPickerManager
|
@implementation RCTPickerManager
|
||||||
|
|
||||||
|
RCT_EXPORT_MODULE()
|
||||||
|
|
||||||
- (UIView *)view
|
- (UIView *)view
|
||||||
{
|
{
|
||||||
return [[RCTPicker alloc] initWithEventDispatcher:self.bridge.eventDispatcher];
|
return [[RCTPicker alloc] initWithEventDispatcher:self.bridge.eventDispatcher];
|
||||||
|
@ -17,6 +17,8 @@
|
|||||||
|
|
||||||
@implementation RCTScrollViewManager
|
@implementation RCTScrollViewManager
|
||||||
|
|
||||||
|
RCT_EXPORT_MODULE()
|
||||||
|
|
||||||
- (UIView *)view
|
- (UIView *)view
|
||||||
{
|
{
|
||||||
return [[RCTScrollView alloc] initWithEventDispatcher:self.bridge.eventDispatcher];
|
return [[RCTScrollView alloc] initWithEventDispatcher:self.bridge.eventDispatcher];
|
||||||
|
@ -15,6 +15,8 @@
|
|||||||
|
|
||||||
@implementation RCTSliderManager
|
@implementation RCTSliderManager
|
||||||
|
|
||||||
|
RCT_EXPORT_MODULE()
|
||||||
|
|
||||||
- (UIView *)view
|
- (UIView *)view
|
||||||
{
|
{
|
||||||
UISlider *slider = [[UISlider alloc] init];
|
UISlider *slider = [[UISlider alloc] init];
|
||||||
|
@ -16,6 +16,8 @@
|
|||||||
|
|
||||||
@implementation RCTSwitchManager
|
@implementation RCTSwitchManager
|
||||||
|
|
||||||
|
RCT_EXPORT_MODULE()
|
||||||
|
|
||||||
- (UIView *)view
|
- (UIView *)view
|
||||||
{
|
{
|
||||||
RCTSwitch *switcher = [[RCTSwitch alloc] init];
|
RCTSwitch *switcher = [[RCTSwitch alloc] init];
|
||||||
|
@ -14,6 +14,8 @@
|
|||||||
|
|
||||||
@implementation RCTTabBarItemManager
|
@implementation RCTTabBarItemManager
|
||||||
|
|
||||||
|
RCT_EXPORT_MODULE()
|
||||||
|
|
||||||
- (UIView *)view
|
- (UIView *)view
|
||||||
{
|
{
|
||||||
return [[RCTTabBarItem alloc] init];
|
return [[RCTTabBarItem alloc] init];
|
||||||
|
@ -14,6 +14,8 @@
|
|||||||
|
|
||||||
@implementation RCTTabBarManager
|
@implementation RCTTabBarManager
|
||||||
|
|
||||||
|
RCT_EXPORT_MODULE()
|
||||||
|
|
||||||
@synthesize bridge = _bridge;
|
@synthesize bridge = _bridge;
|
||||||
|
|
||||||
- (UIView *)view
|
- (UIView *)view
|
||||||
|
@ -17,6 +17,8 @@
|
|||||||
|
|
||||||
@implementation RCTTextFieldManager
|
@implementation RCTTextFieldManager
|
||||||
|
|
||||||
|
RCT_EXPORT_MODULE()
|
||||||
|
|
||||||
- (UIView *)view
|
- (UIView *)view
|
||||||
{
|
{
|
||||||
return [[RCTTextField alloc] initWithEventDispatcher:self.bridge.eventDispatcher];
|
return [[RCTTextField alloc] initWithEventDispatcher:self.bridge.eventDispatcher];
|
||||||
|
@ -24,6 +24,8 @@ RCT_ENUM_CONVERTER(UIActivityIndicatorViewStyle, (@{
|
|||||||
|
|
||||||
@implementation RCTUIActivityIndicatorViewManager
|
@implementation RCTUIActivityIndicatorViewManager
|
||||||
|
|
||||||
|
RCT_EXPORT_MODULE(UIActivityIndicatorViewManager)
|
||||||
|
|
||||||
- (UIView *)view
|
- (UIView *)view
|
||||||
{
|
{
|
||||||
return [[UIActivityIndicatorView alloc] init];
|
return [[UIActivityIndicatorView alloc] init];
|
||||||
|
@ -30,14 +30,6 @@ typedef void (^RCTViewManagerUIBlock)(RCTUIManager *uiManager, RCTSparseArray *v
|
|||||||
*/
|
*/
|
||||||
@property (nonatomic, strong) RCTBridge *bridge;
|
@property (nonatomic, strong) RCTBridge *bridge;
|
||||||
|
|
||||||
/**
|
|
||||||
* The module name exposed to React JS. If omitted, this will be inferred
|
|
||||||
* automatically by using the view module's class name. It is better to not
|
|
||||||
* override this, and just follow standard naming conventions for your view
|
|
||||||
* module subclasses.
|
|
||||||
*/
|
|
||||||
+ (NSString *)moduleName;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method instantiates a native view to be managed by the module. Override
|
* This method instantiates a native view to be managed by the module. Override
|
||||||
* this to return a custom view instance, which may be preconfigured with default
|
* this to return a custom view instance, which may be preconfigured with default
|
||||||
|
@ -19,20 +19,9 @@
|
|||||||
|
|
||||||
@implementation RCTViewManager
|
@implementation RCTViewManager
|
||||||
|
|
||||||
@synthesize bridge = _bridge;
|
RCT_EXPORT_MODULE()
|
||||||
|
|
||||||
+ (NSString *)moduleName
|
@synthesize bridge = _bridge;
|
||||||
{
|
|
||||||
// Default implementation, works in most cases
|
|
||||||
NSString *name = NSStringFromClass(self);
|
|
||||||
if ([name hasPrefix:@"RK"]) {
|
|
||||||
name = [name stringByReplacingCharactersInRange:(NSRange){0,@"RK".length} withString:@"RCT"];
|
|
||||||
}
|
|
||||||
if ([name hasPrefix:@"RCTUI"]) {
|
|
||||||
name = [name substringFromIndex:@"RCT".length];
|
|
||||||
}
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (UIView *)view
|
- (UIView *)view
|
||||||
{
|
{
|
||||||
|
@ -16,6 +16,8 @@
|
|||||||
|
|
||||||
@implementation RCTWebViewManager
|
@implementation RCTWebViewManager
|
||||||
|
|
||||||
|
RCT_EXPORT_MODULE()
|
||||||
|
|
||||||
- (UIView *)view
|
- (UIView *)view
|
||||||
{
|
{
|
||||||
return [[RCTWebView alloc] initWithEventDispatcher:self.bridge.eventDispatcher];
|
return [[RCTWebView alloc] initWithEventDispatcher:self.bridge.eventDispatcher];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user