Added non-class-scanning-based approach fror registering js methods

This commit is contained in:
Nick Lockwood
2015-04-08 05:42:43 -07:00
parent 21a054e9fc
commit bf4868edda
55 changed files with 283 additions and 237 deletions

View File

@@ -27,6 +27,8 @@ RCT_ENUM_CONVERTER(UIDatePickerMode, (@{
@implementation RCTDatePickerManager
RCT_EXPORT_MODULE()
- (UIView *)view
{
UIDatePicker *picker = [[UIDatePicker alloc] init];

View File

@@ -54,6 +54,8 @@
@implementation RCTMapManager
RCT_EXPORT_MODULE()
- (UIView *)view
{
RCTMap *map = [[RCTMap alloc] init];

View File

@@ -14,6 +14,8 @@
@implementation RCTNavItemManager
RCT_EXPORT_MODULE()
- (UIView *)view
{
return [[RCTNavItem alloc] init];

View File

@@ -17,6 +17,8 @@
@implementation RCTNavigatorManager
RCT_EXPORT_MODULE()
- (UIView *)view
{
return [[RCTNavigator alloc] initWithEventDispatcher:self.bridge.eventDispatcher];

View File

@@ -15,6 +15,8 @@
@implementation RCTPickerManager
RCT_EXPORT_MODULE()
- (UIView *)view
{
return [[RCTPicker alloc] initWithEventDispatcher:self.bridge.eventDispatcher];

View File

@@ -17,6 +17,8 @@
@implementation RCTScrollViewManager
RCT_EXPORT_MODULE()
- (UIView *)view
{
return [[RCTScrollView alloc] initWithEventDispatcher:self.bridge.eventDispatcher];

View File

@@ -15,6 +15,8 @@
@implementation RCTSliderManager
RCT_EXPORT_MODULE()
- (UIView *)view
{
UISlider *slider = [[UISlider alloc] init];

View File

@@ -16,6 +16,8 @@
@implementation RCTSwitchManager
RCT_EXPORT_MODULE()
- (UIView *)view
{
RCTSwitch *switcher = [[RCTSwitch alloc] init];

View File

@@ -14,6 +14,8 @@
@implementation RCTTabBarItemManager
RCT_EXPORT_MODULE()
- (UIView *)view
{
return [[RCTTabBarItem alloc] init];

View File

@@ -14,6 +14,8 @@
@implementation RCTTabBarManager
RCT_EXPORT_MODULE()
@synthesize bridge = _bridge;
- (UIView *)view

View File

@@ -17,6 +17,8 @@
@implementation RCTTextFieldManager
RCT_EXPORT_MODULE()
- (UIView *)view
{
return [[RCTTextField alloc] initWithEventDispatcher:self.bridge.eventDispatcher];

View File

@@ -24,6 +24,8 @@ RCT_ENUM_CONVERTER(UIActivityIndicatorViewStyle, (@{
@implementation RCTUIActivityIndicatorViewManager
RCT_EXPORT_MODULE(UIActivityIndicatorViewManager)
- (UIView *)view
{
return [[UIActivityIndicatorView alloc] init];

View File

@@ -30,14 +30,6 @@ typedef void (^RCTViewManagerUIBlock)(RCTUIManager *uiManager, RCTSparseArray *v
*/
@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 to return a custom view instance, which may be preconfigured with default

View File

@@ -19,20 +19,9 @@
@implementation RCTViewManager
@synthesize bridge = _bridge;
RCT_EXPORT_MODULE()
+ (NSString *)moduleName
{
// 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;
}
@synthesize bridge = _bridge;
- (UIView *)view
{

View File

@@ -16,6 +16,8 @@
@implementation RCTWebViewManager
RCT_EXPORT_MODULE()
- (UIView *)view
{
return [[RCTWebView alloc] initWithEventDispatcher:self.bridge.eventDispatcher];