diff --git a/React/Base/RCTConstants.h b/React/Base/RCTConstants.h index f199450a4c9..217b7aabc21 100644 --- a/React/Base/RCTConstants.h +++ b/React/Base/RCTConstants.h @@ -75,3 +75,9 @@ RCT_EXTERN void RCTSetValidateCanSendEventInRCTEventEmitter(BOOL value); */ RCT_EXTERN BOOL RCTGetMemoryPressureUnloadLevel(void); RCT_EXTERN void RCTSetMemoryPressureUnloadLevel(int value); + +/* + * Parse JS stack for unhandled JS errors caught in C++ + */ +RCT_EXTERN BOOL RCTGetParseUnhandledJSErrorStackNatively(void); +RCT_EXTERN void RCTSetParseUnhandledJSErrorStackNatively(BOOL value); diff --git a/React/Base/RCTConstants.m b/React/Base/RCTConstants.m index d0bf96dc27c..03e5ffe984c 100644 --- a/React/Base/RCTConstants.m +++ b/React/Base/RCTConstants.m @@ -65,3 +65,19 @@ void RCTSetMemoryPressureUnloadLevel(int value) { RCTMemoryPressureUnloadLevel = value; } + +/* + * In Bridge mode, parse the JS stack for unhandled JS errors, to display in RedBox. + * When false (previous default behavior), a native stack is displayed in the RedBox. + */ +static BOOL RCTParseUnhandledJSErrorStackNatively = NO; + +BOOL RCTGetParseUnhandledJSErrorStackNatively() +{ + return RCTParseUnhandledJSErrorStackNatively; +} + +void RCTSetParseUnhandledJSErrorStackNatively(BOOL value) +{ + RCTParseUnhandledJSErrorStackNatively = value; +}