UNPKG

2.44 kBtext/x-cView Raw
1/*
2 * Copyright (c) Facebook, Inc. and its affiliates.
3 *
4 * This source code is licensed under the MIT license found in the
5 * LICENSE file in the root directory of this source tree.
6 */
7
8#import <UIKit/UIKit.h>
9
10#import <React/RCTBridge.h>
11#import <React/RCTBridgeModule.h>
12#import <React/RCTErrorCustomizer.h>
13
14@class RCTJSStackFrame;
15
16typedef void (^RCTRedBoxButtonPressHandler)(void);
17
18@interface RCTRedBox : NSObject <RCTBridgeModule>
19
20- (void)registerErrorCustomizer:(id<RCTErrorCustomizer>)errorCustomizer;
21- (void)showError:(NSError *)error;
22- (void)showErrorMessage:(NSString *)message;
23- (void)showErrorMessage:(NSString *)message withDetails:(NSString *)details;
24- (void)showErrorMessage:(NSString *)message withRawStack:(NSString *)rawStack;
25- (void)showErrorMessage:(NSString *)message withRawStack:(NSString *)rawStack errorCookie:(int)errorCookie;
26- (void)showErrorMessage:(NSString *)message withStack:(NSArray<NSDictionary *> *)stack;
27- (void)updateErrorMessage:(NSString *)message withStack:(NSArray<NSDictionary *> *)stack;
28- (void)showErrorMessage:(NSString *)message withStack:(NSArray<NSDictionary *> *)stack errorCookie:(int)errorCookie;
29- (void)updateErrorMessage:(NSString *)message withStack:(NSArray<NSDictionary *> *)stack errorCookie:(int)errorCookie;
30- (void)showErrorMessage:(NSString *)message withParsedStack:(NSArray<RCTJSStackFrame *> *)stack;
31- (void)updateErrorMessage:(NSString *)message withParsedStack:(NSArray<RCTJSStackFrame *> *)stack;
32- (void)showErrorMessage:(NSString *)message withParsedStack:(NSArray<RCTJSStackFrame *> *)stack errorCookie:(int)errorCookie;
33- (void)updateErrorMessage:(NSString *)message withParsedStack:(NSArray<RCTJSStackFrame *> *)stack errorCookie:(int)errorCookie;
34
35- (void)dismiss;
36
37- (void)addCustomButton:(NSString *)title onPressHandler:(RCTRedBoxButtonPressHandler)handler;
38
39/** Overrides bridge.bundleURL. Modify on main thread only. You shouldn't need to use this. */
40@property (nonatomic, strong) NSURL *overrideBundleURL;
41
42/** Overrides the default behavior of calling [bridge reload] on reload. You shouldn't need to use this. */
43@property (nonatomic, strong) dispatch_block_t overrideReloadAction;
44
45@end
46
47/**
48 * This category makes the red box instance available via the RCTBridge, which
49 * is useful for any class that needs to access the red box or error log.
50 */
51@interface RCTBridge (RCTRedBox)
52
53@property (nonatomic, readonly) RCTRedBox *redBox;
54
55@end