I cant see the component boundary
See original GitHub issueHi, I cant see the boundary component when I throw an error.
the throw error: throw new Error('💥 CABOOM 💥');
trigged by onPress
and the only error that show was the react-native error screen. I was click in dismiss, but the error boundary component not show.
Issue Analytics
- State:
- Created 3 years ago
- Comments:14 (7 by maintainers)
Top Results From Across the Web
Error Boundaries - React
Error boundaries are React components that catch JavaScript errors anywhere in their child component tree, log those errors, and display a fallback UI ......
Read more >React Error Boundaries not working with React - Stack Overflow
For checking your ErrorBoundary , throw an error from a reachable section in the component tree which is not: Event handlers; Asynchronous code...
Read more >Component error handling in React using Error Boundaries
Upgrade React, wrap your component tree with the boundary and start drilling down to find where errors are happening in your existing code...
Read more >What you may not know about the Error Boundary
Use componentDidCatch() to log error information. Look at these lines, if there is an error then we return the fallback component, else return ......
Read more >Error Boundaries in React 16 - Rollbar
Error boundaries are React components that catch JavaScript errors anywhere in their child component tree. They can log errors and display a ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
No problem, a pleasure to explain. Thanks to you aswell for creating the demo repository ❤️
Have a great day!
Hey @DwCleb
You don’t need state to show the ErrorBoundary component. What happens is that on development mode some errors are catched by the LogBox component -> https://reactnative.dev/blog/2020/07/06/version-0.63#logbox
This component is made for catching unhandled errors on release mode. Not for displaying errors on development. You can read more about this in here: https://carloscuesta.me/blog/managing-react-native-crashes-with-error-boundaries
So you won’t able to render the
ErrorBoundary
component on Development just by throwing an error from the Button. Because those type of errors are getting caught by theLogBox
component on development. As taken out fromreact-native
docs: https://reactnative.dev/docs/debugging#logboxOn release mode, it will work because the LogBox it’s not shipped to your application, so the component will catch all the JavaScript errors just by using the ErrorBoundary component.
As you say, you’re simulating an error so that clearly it’s not a real case. You’re trying to force an error to render the ErrorBoundary component on development. If you want to render the ErrorBoundary, using the
throw Error
, usereact-native run-ios --variant=release
to set the application on release mode, and avoid the LogBox component.