Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions packages/react-native/React/CoreModules/RCTRedBox.mm
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@

#import "CoreModulesPlugins.h"
#import "RCTRedBox+Internal.h"
#if !TARGET_OS_OSX // [macOS]
#import "RCTRedBox2Controller+Internal.h"
#endif // [macOS]
#import "RCTRedBoxController+Internal.h"

#if RCT_DEV_MENU
Expand Down Expand Up @@ -197,11 +195,9 @@ - (void)showErrorMessage:(NSString *)message
errorInfo = [self _customizeError:errorInfo];

if (self->_controller == nullptr) {
if (!TARGET_OS_OSX && facebook::react::ReactNativeFeatureFlags::redBoxV2IOS()) { // [macOS]
#if !TARGET_OS_OSX // [macOS]
if (facebook::react::ReactNativeFeatureFlags::redBoxV2IOS()) {
self->_controller = [[RCTRedBox2Controller alloc] initWithCustomButtonTitles:self->_customButtonTitles
customButtonHandlers:self->_customButtonHandlers];
#endif // [macOS]
} else {
self->_controller = [[RCTRedBoxController alloc] initWithCustomButtonTitles:self->_customButtonTitles
customButtonHandlers:self->_customButtonHandlers];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/

#import <React/RCTDefines.h>

#if !TARGET_OS_OSX // [macOS]
#import <UIKit/UIKit.h>
#import <React/RCTUIKit.h> // [macOS]

/**
* Parses ANSI escape sequences in text and produces an NSAttributedString
Expand All @@ -18,10 +15,14 @@
*/
@interface RCTRedBox2AnsiParser : NSObject

#if !TARGET_OS_OSX // [macOS]
+ (NSAttributedString *)attributedStringFromAnsiText:(NSString *)text
baseFont:(UIFont *)font
baseColor:(UIColor *)color;
#else // [macOS
+ (NSAttributedString *)attributedStringFromAnsiText:(NSString *)text
baseFont:(UIFont *)font
baseColor:(RCTPlatformColor *)color;
#endif // macOS]

@end

#endif // [macOS]
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,32 @@
#import <React/RCTDefines.h>
#import <react/debug/redbox/AnsiParser.h>

#if RCT_DEV_MENU && !TARGET_OS_OSX // [macOS]
#if RCT_DEV_MENU

using facebook::react::unstable_redbox::AnsiColor;
using facebook::react::unstable_redbox::parseAnsi;

#if !TARGET_OS_OSX // [macOS]
static UIColor *RCTUIColorFromAnsiColor(const AnsiColor &c)
{
return [UIColor colorWithRed:c.r / 255.0 green:c.g / 255.0 blue:c.b / 255.0 alpha:1.0];
}
#else // [macOS
static RCTPlatformColor *RCTUIColorFromAnsiColor(const AnsiColor &c)
{
return [RCTPlatformColor colorWithRed:c.r / 255.0 green:c.g / 255.0 blue:c.b / 255.0 alpha:1.0];
}
#endif // macOS]

@implementation RCTRedBox2AnsiParser

#if !TARGET_OS_OSX // [macOS]
+ (NSAttributedString *)attributedStringFromAnsiText:(NSString *)text baseFont:(UIFont *)font baseColor:(UIColor *)color
#else // [macOS
+ (NSAttributedString *)attributedStringFromAnsiText:(NSString *)text
baseFont:(UIFont *)font
baseColor:(RCTPlatformColor *)color
#endif // macOS]
{
if (text == nil) {
return [[NSAttributedString alloc] init];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,16 @@
*/

#import <React/RCTDefines.h>
#import <React/RCTUIKit.h> // [macOS]

#import "RCTRedBox+Internal.h"

#if RCT_DEV_MENU && !TARGET_OS_OSX // [macOS]
#if RCT_DEV_MENU

typedef void (^RCTRedBox2ButtonPressHandler)(void);

@interface RCTRedBox2Controller : UIViewController <RCTRedBox2Controlling, UITableViewDelegate, UITableViewDataSource>
@interface RCTRedBox2Controller
: RCTPlatformViewController <RCTRedBox2Controlling, RCTUITableViewDelegate, RCTUITableViewDataSource> // [macOS]

@property (nonatomic, weak) id<RCTRedBoxControllerActionDelegate> actionDelegate;

Expand Down
Loading
Loading