-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Android] registerComponentDidAppearListener not triggering (sometimes) on functional components (release mode) #5244
Comments
@guyca Any updates on this issue? |
Also seems like life cycle hook is pretty slow on Android and I am testing the App on Samsung S10 so can't be the device is slow. Furthermore on iOS seems everything smooth. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
The issue is still happening it would be awesome if someone can take a look into. There's a I have simple react-native project to reproduce de issue here -> https://github.com/jpgarcia/rnn-events-issue |
Looks like life cycle hook is not guarantee to get fire on Debug build too. It's still happening:( |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
Hey @guyca do you have any updates on this issue? Thanks! |
@sintylapse mentioned here Nubescope/react-native-navigation-hooks#7 the cause of the events not being triggered. Basically you must use useLayoutEffect instead of useEffect 🚀 BTW I just published a new version of react-native-navigation-hooks which includes this fix |
Issue Description
If you use a functional (with hooks) component for a screen and you use
registerComponentDidAppearListener
you could end up with the events not being triggered (only on Android and in release mode)Steps to Reproduce / Code Snippets / Screenshots
I have created a simple react-native project on a public repo to reproduce it. The example reproduce the DidAppear not working on Android release mode only
The project includes a screen implemented as a Functional Component (with hooks) and also a PureComponent with the same behavior.
On Android (Debug Mode)
react-native run-android
The sample works perfect on both Functional and PureComponent
On Android (Release Mode)
react-native run-android --variant=release
The sample works perfect on the PureComponent implementation but the Functional doesn't work
Video of the example app running in release mode
Environment
The text was updated successfully, but these errors were encountered: