0

I implemented a native module and I would like to display an error for a developer using the redbox error screen from the native module. This error will inform about obsolete values.

Does anyone know, how to display this kind of screen with a custom message?

Below I am attaching a screenshot, what I would like to achieve:

1 Answer 1

2

On android you can achieve this with the following code:

val exceptionManager = reactContext.getNativeModule(ExceptionsManagerModule::class.java)
val error: WritableMap = WritableNativeMap()
error.putString("message", "Error message")
exceptionManager.reportException(error)

on iOS it's also quite straightforward:

let exceptionsManager = bridge.module(forName: "RCTExceptionsManager") as? exceptionsManager
exceptionsManager?.reportFatalException("message", stack: nil, exceptionId: 1)
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.