Trying to get the error recovery working in prod. What goes into “props” here? Also, where do I declare this (presumably on app load?). Additionally, how do I recover the actual errors on the subsequent app restart (.e.g exp.errorRecovery)? Could we get an example of this in code?
I am working on this as we speak but here’s what I got so far:
1.According to the documentation, when a fatal error occurs( or global error, whatever you want to call it), expo will allow you to set arbitrary props on as the initial props for you app (via ErrorRecovery.setRecoveryProps). This doesn’t help a bit in telling us how to get the actual error.
2.According to this : https://medium.com/@benhur.ott/dealing-with-global-errors-in-react-native-expo-as-simple-as-possible-bc8e440caeae what we need to do is replace the default global error handler (the one set by expo that does the app reload in prod) with a custom one that will:
a) log the error
b) ErrorRecovery.setRecoveryProps(the error)
c) maybe do some other stuff
d) call the original error handler (to get the crash behaviour Expo is talking about in the docs)
Hope this helps, I’ll update if this works out ok.
Update: I ended up doing this:
in my App.js
outside the App component: