mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-23 20:01:01 +08:00
Added non-class-scanning-based approach fror registering js methods
This commit is contained in:
@@ -27,6 +27,8 @@ RCT_ENUM_CONVERTER(UIDatePickerMode, (@{
|
||||
|
||||
@implementation RCTDatePickerManager
|
||||
|
||||
RCT_EXPORT_MODULE()
|
||||
|
||||
- (UIView *)view
|
||||
{
|
||||
UIDatePicker *picker = [[UIDatePicker alloc] init];
|
||||
|
||||
@@ -54,6 +54,8 @@
|
||||
|
||||
@implementation RCTMapManager
|
||||
|
||||
RCT_EXPORT_MODULE()
|
||||
|
||||
- (UIView *)view
|
||||
{
|
||||
RCTMap *map = [[RCTMap alloc] init];
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
|
||||
@implementation RCTNavItemManager
|
||||
|
||||
RCT_EXPORT_MODULE()
|
||||
|
||||
- (UIView *)view
|
||||
{
|
||||
return [[RCTNavItem alloc] init];
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
|
||||
@implementation RCTNavigatorManager
|
||||
|
||||
RCT_EXPORT_MODULE()
|
||||
|
||||
- (UIView *)view
|
||||
{
|
||||
return [[RCTNavigator alloc] initWithEventDispatcher:self.bridge.eventDispatcher];
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
|
||||
@implementation RCTPickerManager
|
||||
|
||||
RCT_EXPORT_MODULE()
|
||||
|
||||
- (UIView *)view
|
||||
{
|
||||
return [[RCTPicker alloc] initWithEventDispatcher:self.bridge.eventDispatcher];
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
|
||||
@implementation RCTScrollViewManager
|
||||
|
||||
RCT_EXPORT_MODULE()
|
||||
|
||||
- (UIView *)view
|
||||
{
|
||||
return [[RCTScrollView alloc] initWithEventDispatcher:self.bridge.eventDispatcher];
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
|
||||
@implementation RCTSliderManager
|
||||
|
||||
RCT_EXPORT_MODULE()
|
||||
|
||||
- (UIView *)view
|
||||
{
|
||||
UISlider *slider = [[UISlider alloc] init];
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
|
||||
@implementation RCTSwitchManager
|
||||
|
||||
RCT_EXPORT_MODULE()
|
||||
|
||||
- (UIView *)view
|
||||
{
|
||||
RCTSwitch *switcher = [[RCTSwitch alloc] init];
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
|
||||
@implementation RCTTabBarItemManager
|
||||
|
||||
RCT_EXPORT_MODULE()
|
||||
|
||||
- (UIView *)view
|
||||
{
|
||||
return [[RCTTabBarItem alloc] init];
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
|
||||
@implementation RCTTabBarManager
|
||||
|
||||
RCT_EXPORT_MODULE()
|
||||
|
||||
@synthesize bridge = _bridge;
|
||||
|
||||
- (UIView *)view
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
|
||||
@implementation RCTTextFieldManager
|
||||
|
||||
RCT_EXPORT_MODULE()
|
||||
|
||||
- (UIView *)view
|
||||
{
|
||||
return [[RCTTextField alloc] initWithEventDispatcher:self.bridge.eventDispatcher];
|
||||
|
||||
@@ -24,6 +24,8 @@ RCT_ENUM_CONVERTER(UIActivityIndicatorViewStyle, (@{
|
||||
|
||||
@implementation RCTUIActivityIndicatorViewManager
|
||||
|
||||
RCT_EXPORT_MODULE(UIActivityIndicatorViewManager)
|
||||
|
||||
- (UIView *)view
|
||||
{
|
||||
return [[UIActivityIndicatorView alloc] init];
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
|
||||
@implementation RCTWebViewManager
|
||||
|
||||
RCT_EXPORT_MODULE()
|
||||
|
||||
- (UIView *)view
|
||||
{
|
||||
return [[RCTWebView alloc] initWithEventDispatcher:self.bridge.eventDispatcher];
|
||||
|
||||
Reference in New Issue
Block a user