2015-03-23 20:28:42 +00:00
|
|
|
/**
|
|
|
|
* 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.
|
|
|
|
*/
|
2015-02-20 04:10:52 +00:00
|
|
|
|
|
|
|
#import <UIKit/UIKit.h>
|
|
|
|
|
2016-11-23 15:47:52 +00:00
|
|
|
#import <React/RCTComponent.h>
|
Added mechanism for directly mapping JS event handlers to blocks
Summary:
Currently, the system for mapping JS event handlers to blocks is quite clean on the JS side, but is clunky on the native side. The event property is passed as a boolean, which can then be checked by the native side, and if true, the native side is supposed to send an event via the event dispatcher.
This diff adds the facility to declare the property as a block instead. This means that the event side can simply call the block, and it will automatically send the event. Because the blocks for bubbling and direct events are named differently, we can also use this to generate the event registration data and get rid of the arrays of event names.
The name of the event is inferred from the property name, which means that the property for an event called "load" must be called `onLoad` or the mapping won't work. This can be optionally remapped to a different property name on the view itself if necessary, e.g.
RCT_REMAP_VIEW_PROPERTY(onLoad, loadEventBlock, RCTDirectEventBlock)
If you don't want to use this mechanism then for now it is still possible to declare the property as a BOOL instead and use the old mechanism (this approach is now deprecated however, and may eventually be removed altogether).
2015-09-02 12:58:10 +00:00
|
|
|
|
2015-02-20 04:10:52 +00:00
|
|
|
@interface RCTNavItem : UIView
|
|
|
|
|
|
|
|
@property (nonatomic, copy) NSString *title;
|
2016-06-23 15:27:29 +00:00
|
|
|
@property (nonatomic, strong) UIImage *titleImage;
|
2015-05-07 14:16:59 +00:00
|
|
|
@property (nonatomic, strong) UIImage *leftButtonIcon;
|
|
|
|
@property (nonatomic, copy) NSString *leftButtonTitle;
|
2016-09-09 00:53:55 +00:00
|
|
|
@property (nonatomic, assign) UIBarButtonSystemItem leftButtonSystemIcon;
|
2015-05-07 14:16:59 +00:00
|
|
|
@property (nonatomic, strong) UIImage *rightButtonIcon;
|
2015-02-20 04:10:52 +00:00
|
|
|
@property (nonatomic, copy) NSString *rightButtonTitle;
|
2016-09-09 00:53:55 +00:00
|
|
|
@property (nonatomic, assign) UIBarButtonSystemItem rightButtonSystemIcon;
|
2015-05-07 14:16:59 +00:00
|
|
|
@property (nonatomic, strong) UIImage *backButtonIcon;
|
2015-02-20 04:10:52 +00:00
|
|
|
@property (nonatomic, copy) NSString *backButtonTitle;
|
2015-04-09 15:52:25 +00:00
|
|
|
@property (nonatomic, assign) BOOL navigationBarHidden;
|
2015-07-16 11:18:12 +00:00
|
|
|
@property (nonatomic, assign) BOOL shadowHidden;
|
2015-05-07 14:16:59 +00:00
|
|
|
@property (nonatomic, strong) UIColor *tintColor;
|
|
|
|
@property (nonatomic, strong) UIColor *barTintColor;
|
|
|
|
@property (nonatomic, strong) UIColor *titleTextColor;
|
2015-06-26 14:06:51 +00:00
|
|
|
@property (nonatomic, assign) BOOL translucent;
|
2015-05-07 14:16:59 +00:00
|
|
|
|
2016-06-23 15:27:29 +00:00
|
|
|
@property (nonatomic, readonly) UIImageView *titleImageView;
|
2015-05-07 14:16:59 +00:00
|
|
|
@property (nonatomic, readonly) UIBarButtonItem *backButtonItem;
|
|
|
|
@property (nonatomic, readonly) UIBarButtonItem *leftButtonItem;
|
|
|
|
@property (nonatomic, readonly) UIBarButtonItem *rightButtonItem;
|
2015-02-20 04:10:52 +00:00
|
|
|
|
2015-12-08 11:29:08 +00:00
|
|
|
@property (nonatomic, copy) RCTBubblingEventBlock onLeftButtonPress;
|
|
|
|
@property (nonatomic, copy) RCTBubblingEventBlock onRightButtonPress;
|
Added mechanism for directly mapping JS event handlers to blocks
Summary:
Currently, the system for mapping JS event handlers to blocks is quite clean on the JS side, but is clunky on the native side. The event property is passed as a boolean, which can then be checked by the native side, and if true, the native side is supposed to send an event via the event dispatcher.
This diff adds the facility to declare the property as a block instead. This means that the event side can simply call the block, and it will automatically send the event. Because the blocks for bubbling and direct events are named differently, we can also use this to generate the event registration data and get rid of the arrays of event names.
The name of the event is inferred from the property name, which means that the property for an event called "load" must be called `onLoad` or the mapping won't work. This can be optionally remapped to a different property name on the view itself if necessary, e.g.
RCT_REMAP_VIEW_PROPERTY(onLoad, loadEventBlock, RCTDirectEventBlock)
If you don't want to use this mechanism then for now it is still possible to declare the property as a BOOL instead and use the old mechanism (this approach is now deprecated however, and may eventually be removed altogether).
2015-09-02 12:58:10 +00:00
|
|
|
|
2015-02-20 04:10:52 +00:00
|
|
|
@end
|