react-native/React/DevSupport/RCTDevMenu.h

109 lines
2.7 KiB
C
Raw Normal View History

2015-03-25 17:38:32 +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.
*/
#import <UIKit/UIKit.h>
#import <React/RCTBridge.h>
#import <React/RCTBridgeModule.h>
@class RCTDevMenuItem;
2015-04-19 19:55:46 +00:00
/**
* Developer menu, useful for exposing extra functionality when debugging.
*/
2015-04-30 16:50:22 +00:00
@interface RCTDevMenu : NSObject
2015-04-19 19:55:46 +00:00
/**
* Deprecated, use RCTDevSettings instead.
2015-04-19 19:55:46 +00:00
*/
@property (nonatomic, assign) BOOL shakeToShow DEPRECATED_ATTRIBUTE;
2015-04-19 19:55:46 +00:00
/**
* Deprecated, use RCTDevSettings instead.
2015-04-19 19:55:46 +00:00
*/
@property (nonatomic, assign) BOOL profilingEnabled DEPRECATED_ATTRIBUTE;
2015-04-19 19:55:46 +00:00
/**
* Deprecated, use RCTDevSettings instead.
*/
@property (nonatomic, assign) BOOL liveReloadEnabled DEPRECATED_ATTRIBUTE;
2015-04-19 19:55:46 +00:00
/**
* Deprecated, use RCTDevSettings instead.
2015-04-19 19:55:46 +00:00
*/
@property (nonatomic, assign) BOOL hotLoadingEnabled DEPRECATED_ATTRIBUTE;
/**
* Presented items in development menu
*/
@property (nonatomic, copy, readonly) NSArray<RCTDevMenuItem *> *presentedItems;
/**
* Detect if actions sheet (development menu) is shown
*/
- (BOOL)isActionSheetShown;
2015-04-19 19:55:46 +00:00
/**
2015-05-01 13:21:03 +00:00
* Manually show the dev menu (can be called from JS).
2015-04-19 19:55:46 +00:00
*/
2015-05-01 13:21:03 +00:00
- (void)show;
2015-04-19 19:55:46 +00:00
/**
* Deprecated, use -[RCTBRidge reload] instead.
2015-04-19 19:55:46 +00:00
*/
- (void)reload DEPRECATED_ATTRIBUTE;
2015-03-25 17:38:32 +00:00
/**
* Deprecated. Use the `-addItem:` method instead.
*/
- (void)addItem:(NSString *)title
handler:(void(^)(void))handler DEPRECATED_ATTRIBUTE;
/**
* Add custom item to the development menu. The handler will be called
* when user selects the item.
*/
- (void)addItem:(RCTDevMenuItem *)item;
@end
typedef NSString *(^RCTDevMenuItemTitleBlock)(void);
/**
* Developer menu item, used to expose additional functionality via the menu.
*/
@interface RCTDevMenuItem : NSObject
/**
* This creates an item with a simple push-button interface, used to trigger an
* action.
*/
+ (instancetype)buttonItemWithTitle:(NSString *)title
handler:(dispatch_block_t)handler;
/**
* This creates an item with a simple push-button interface, used to trigger an
* action. getTitleForPresentation is called each time the item is about to be
* presented, and should return the item's title.
*/
+ (instancetype)buttonItemWithTitleBlock:(RCTDevMenuItemTitleBlock)titleBlock
handler:(dispatch_block_t)handler;
2015-03-25 17:38:32 +00:00
@end
2015-04-19 19:55:46 +00:00
/**
* This category makes the developer menu instance available via the
* RCTBridge, which is useful for any class that needs to access the menu.
*/
@interface RCTBridge (RCTDevMenu)
@property (nonatomic, readonly) RCTDevMenu *devMenu;
@end