Skip to content
Merged
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
3 changes: 2 additions & 1 deletion packages/react-native/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ let reactRendererConsistency = RNTarget(
let reactDebug = RNTarget(
name: .reactDebug,
path: "ReactCommon/react/debug",
excludedPaths: ["tests", "redbox/tests"],
dependencies: [.reactNativeDependencies]
)
/// React-jsi.podspec
Expand Down Expand Up @@ -380,7 +381,7 @@ let reactCoreModules = RNTarget(
name: .reactCoreModules,
path: "React/CoreModules",
excludedPaths: ["PlatformStubs/RCTStatusBarManager.mm"],
dependencies: [.reactNativeDependencies, .jsi, .yoga, .reactTurboModuleCore]
dependencies: [.reactNativeDependencies, .jsi, .yoga, .reactTurboModuleCore, .reactFeatureFlags]
)

/// React-runtimeCore.podspec
Expand Down
23 changes: 23 additions & 0 deletions packages/react-native/React/CoreModules/RCTJscSafeUrl+Internal.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

#import <Foundation/Foundation.h>

/**
* Converts between standard URLs and JSC-safe URLs.
*
* JSC (JavaScriptCore) strips query strings from source URLs in stack traces
* as of iOS 16.4. Metro works around this by encoding the query string into
* the URL path. These methods convert between the two formats.
*/
@interface RCTJscSafeUrl : NSObject

+ (nonnull NSString *)normalUrlFromJscSafeUrl:(nonnull NSString *)url;
+ (nonnull NSString *)jscSafeUrlFromNormalUrl:(nonnull NSString *)url;
+ (BOOL)isJscSafeUrl:(nonnull NSString *)url;

@end
38 changes: 38 additions & 0 deletions packages/react-native/React/CoreModules/RCTJscSafeUrl.mm
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

#import "RCTJscSafeUrl+Internal.h"

#import <React/RCTDefines.h>
#import <react/debug/redbox/JscSafeUrl.h>

#if RCT_DEV_MENU

using facebook::react::unstable_redbox::isJscSafeUrl;
using facebook::react::unstable_redbox::toJscSafeUrl;
using facebook::react::unstable_redbox::toNormalUrl;

@implementation RCTJscSafeUrl

+ (NSString *)normalUrlFromJscSafeUrl:(NSString *)url
{
return [NSString stringWithUTF8String:toNormalUrl(url.UTF8String).c_str()];
}

+ (NSString *)jscSafeUrlFromNormalUrl:(NSString *)url
{
return [NSString stringWithUTF8String:toJscSafeUrl(url.UTF8String).c_str()];
}

+ (BOOL)isJscSafeUrl:(NSString *)url
{
return isJscSafeUrl(url.UTF8String);
}

@end

#endif
42 changes: 42 additions & 0 deletions packages/react-native/React/CoreModules/RCTRedBox+Internal.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

#import <React/RCTDefines.h>
#import <UIKit/UIKit.h>

#if RCT_DEV_MENU

@class RCTJSStackFrame;

@protocol RCTRedBoxControllerActionDelegate <NSObject>

- (void)redBoxController:(UIViewController *)redBoxController openStackFrameInEditor:(RCTJSStackFrame *)stackFrame;
- (void)reloadFromRedBoxController:(UIViewController *)redBoxController;
- (void)loadExtraDataViewController;

@end

@protocol RCTRedBoxControlling <NSObject>

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

- (void)showErrorMessage:(NSString *)message
withStack:(NSArray<RCTJSStackFrame *> *)stack
isUpdate:(BOOL)isUpdate
errorCookie:(int)errorCookie;

- (void)dismiss;

@end

@protocol RCTRedBox2Controlling <RCTRedBoxControlling>

@property (nonatomic, strong, nullable) NSURL *bundleURL;

@end

#endif
Loading
Loading