onHostDestroy() not called as documented - react-native

According to https://github.com/facebook/react-native/blob/master/ReactAndroid/src/main/java/com/facebook/react/bridge/LifecycleEventListener.java
Navigating back from Activity A to a non-React Activity or to the home screen will trigger two events: onHostPause and onHostDestroy.
I have tried switching to the home screen from a React Activity, but only onHostPause is called. Shouldn't both onHostPause and onHostDestroy be called? Is this a bug?
I'm on react-native 0.51.

For me onHostDestroy was called only when there is no debug session (React native packager, Metro server etc. not running, npx react-native run-android command was stopped). When debug session is on, onHostDestroy was not raised.
I'm on react-native 0.63.2.

Related

React native app closes immediately after running in expo

When I want to run my react-native app with the command 'expo start', my app is built in the expo app. The emulator then displays 'building app ...%'.
I now have the problem that the expo app closes immediately when it reaches 100% but it does not give an error code.
I have already tried 'expo r -c' as well as deleting the android emulator data.
Can someone help me with this?

React Native memoryWarning listener not getting called on Android

I'm having the following AppState listener for memory warnings in my react-native app.
AppState.addEventListener('memoryWarning', e => {
console.log(...);
});
When I trigger memory warning on iOS the listener get's called, unfortunately that's not the case on Android.
I'm trying to trigger the warning with the following adb command
adb shell am send-low-memory <appId> <memoryEvent>
I tried with all the events (MODERATE, RUNNING_CRITICAL, etc.) listed here with the app both in focus and in background. The listener wasn't called even once. (I'm sure the appId I used is correct)
React native docs don't mark the memoryWarning as iOS only in the docs.
Any ideas?

Detox Hung on Splash Screen for React Native App

Trying to set up Detox for my react native app. It seems to hang on the splash screen. I've managed to run tests on a seperate app with no splash screen. On the splash screen app it simply hangs and it outputs :
detox[34248] ERROR: Error: Exceeded timeout of 30000ms while handling jest-circus "setup" event
detox[34248] INFO: Scratch Test is assigned to undefined
I recognize that a showing of 'undefined' is incorrect.
I see reference for the 'waitFor' function but the links to the documentation all seem to be broken and I can't find a reference to it in the docs.
I'm trying to understand how to go about debugging this or if the splash screen is at all responsible for the hanging / error.
Do you use the "react-native-splash-screen" library? That apparently has some issue working with Detox and once I removed that, I did not have the timeout error.
Another potential source of the hanging is an animation that runs in the background. Detox tries to synchronize correctly, but isn't always able to, per their docs: https://github.com/wix/Detox/blob/master/docs/Troubleshooting.Synchronization.md.
I found that by adding
// to allow for less flaky detox tests
console.disableYellowBox = true;
to my app.tsx I was able to remove some warnings that were interfering with Detox.

React native app gets crashed whenever I'm using mapbox

Hey can anyone help me with react-native and mapbox?
Whenever I'm running the command react-native run-android it first starts the app and immediately the app gets crashed

Debug a react-native application using nuclide

Is there any good document/video that talks about how to debug a react-native application using Nuclide.
Am a newbie. Its my first time app development and first time with React.
I did create the project using react-native init. I don't think i found a BUCK file for me to run and debug my app. I also don't see to get how to view the errors in my JS file. I have to run the simulator to see. I run it using react-native run-ios.
I tried Nuclide->React Native->Start Debugging. Not sure what this is supposed to do.
Sorry if these questions sound silly.
According to this instruction you should:
From the command Palette (Cmd-Shift-P) choose "Nuclide React Native: Start Packager" to start the React Native Server.
Ensure that you are in the root directory of the React Native project, then run the application from the command-line: "$ react-native run-ios" (or choose other existing simulator, for example react-native run-ios --simulator="iPhone4s").
After starting the server, you can prime the React Native Debugger for when the application begins running. From the command Palette (Cmd-Shift-P), launch "Nuclide React Native: Start Debugging".
From the Simulator press Cmd-D (Ctrl-D on Linux). This will bring up the debug options for your application. Select "Debug JS Remotely.
...After you enable debugging from the simulated application, Nuclide will attach to that debugging process automatically, since we primed the Debugger above.
Debug JS in Nuclide is now an option in the dev menu added in React Native version 0.52 December 2017 release.
See This