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>
|
|
|
|
|
2016-11-23 15:47:52 +00:00
|
|
|
#import <React/RCTBridge.h>
|
|
|
|
#import <React/RCTBridgeModule.h>
|
2015-03-26 00:33:54 +00:00
|
|
|
|
2015-09-14 16:34:33 +00:00
|
|
|
@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
|
|
|
|
|
|
|
/**
|
2015-04-30 16:50:22 +00:00
|
|
|
* Is the menu enabled. The menu is enabled by default if RCT_DEV=1, but
|
2015-04-19 19:55:46 +00:00
|
|
|
* you may wish to disable it so that you can provide your own shake handler.
|
|
|
|
*/
|
|
|
|
@property (nonatomic, assign) BOOL shakeToShow;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Enables performance profiling.
|
|
|
|
*/
|
|
|
|
@property (nonatomic, assign) BOOL profilingEnabled;
|
|
|
|
|
2017-01-25 22:28:02 +00:00
|
|
|
/**
|
|
|
|
* Enables starting of profiling sampler on launch
|
|
|
|
*/
|
|
|
|
@property (nonatomic, assign) BOOL startSamplingProfilerOnLaunch;
|
|
|
|
|
2015-04-19 19:55:46 +00:00
|
|
|
/**
|
|
|
|
* Enables automatic polling for JS code changes. Only applicable when
|
|
|
|
* running the app from a server.
|
|
|
|
*/
|
|
|
|
@property (nonatomic, assign) BOOL liveReloadEnabled;
|
2015-03-26 00:33:54 +00:00
|
|
|
|
2016-01-04 18:39:07 +00:00
|
|
|
/**
|
|
|
|
* Enables hot loading. Currently not supported in open source.
|
|
|
|
*/
|
|
|
|
@property (nonatomic, assign) BOOL hotLoadingEnabled;
|
|
|
|
|
2015-05-21 01:24:34 +00:00
|
|
|
/**
|
2015-09-14 16:34:33 +00:00
|
|
|
* Shows the FPS monitor for the JS and Main threads.
|
2015-05-21 01:24:34 +00:00
|
|
|
*/
|
|
|
|
@property (nonatomic, assign) BOOL showFPS;
|
|
|
|
|
2016-11-29 21:29:29 +00:00
|
|
|
/**
|
|
|
|
* 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
|
|
|
|
|
|
|
/**
|
2015-05-01 13:21:03 +00:00
|
|
|
* Manually reload the application. Equivalent to calling [bridge reload]
|
|
|
|
* directly, but can be called from JS.
|
2015-04-19 19:55:46 +00:00
|
|
|
*/
|
2015-05-01 13:21:03 +00:00
|
|
|
- (void)reload;
|
2015-03-25 17:38:32 +00:00
|
|
|
|
2015-09-14 16:34:33 +00:00
|
|
|
/**
|
|
|
|
* Deprecated. Use the `-addItem:` method instead.
|
|
|
|
*/
|
|
|
|
- (void)addItem:(NSString *)title
|
|
|
|
handler:(void(^)(void))handler DEPRECATED_ATTRIBUTE;
|
|
|
|
|
2015-06-03 23:40:14 +00:00
|
|
|
/**
|
|
|
|
* Add custom item to the development menu. The handler will be called
|
|
|
|
* when user selects the item.
|
|
|
|
*/
|
2015-09-14 16:34:33 +00:00
|
|
|
- (void)addItem:(RCTDevMenuItem *)item;
|
|
|
|
|
|
|
|
@end
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Developer menu item, used to expose additional functionality via the menu.
|
|
|
|
*/
|
|
|
|
@interface RCTDevMenuItem : NSObject
|
2015-06-03 23:40:14 +00:00
|
|
|
|
2015-09-14 16:34:33 +00:00
|
|
|
/**
|
|
|
|
* This creates an item with a simple push-button interface, used to trigger an
|
|
|
|
* action.
|
|
|
|
*/
|
|
|
|
+ (instancetype)buttonItemWithTitle:(NSString *)title
|
|
|
|
handler:(void(^)(void))handler;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This creates an item with a toggle behavior. The key is used to store the
|
|
|
|
* state of the toggle. For toggle items, the handler will be called immediately
|
|
|
|
* after the item is added if the item was already selected when the module was
|
|
|
|
* last loaded.
|
|
|
|
*/
|
|
|
|
+ (instancetype)toggleItemWithKey:(NSString *)key
|
|
|
|
title:(NSString *)title
|
|
|
|
selectedTitle:(NSString *)selectedTitle
|
|
|
|
handler:(void(^)(BOOL selected))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
|